A progressive, on-demand skill loading method for large language model agents

By dividing skill information into metadata, operation guides, and resource layers, and combining semantic vector retrieval and dynamic K-value calculation, the problems of token waste and limited recall in large language model agents are solved, achieving high efficiency and reliability of on-demand loading.

CN123114587APending Publication Date: 2026-11-17QISHU DATA INTELLIGENT SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611618691.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-20
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies in large language model agents have failed to effectively address the issues of hierarchical granularity of skill information and budget control over the amount of information loaded, leading to problems such as token waste, limited recall rate, and uncontrollable screening.

Method used

Skill information is divided into a metadata layer, an operation guide layer, and a resource layer, which are loaded on demand during system initialization, user message arrival, and skill execution, respectively. Token consumption and recall are optimized through semantic vector retrieval and dynamic K-value calculation.

Benefits of technology

It maximizes skill discoverability within a limited context window budget, significantly reduces token consumption, dynamically and adaptively adjusts the recall quantity, ensures core functionality is available during failures, and is friendly to multi-process deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114587A_ABST
    Figure CN123114587A_ABST
Patent Text Reader

Abstract

This invention discloses a progressive on-demand loading method for skill determination in a large language model agent. It divides the information of each reusable skill into three logical layers: a metadata layer, an operation guide layer, and a resource layer, and sets differentiated loading trigger conditions for each layer. Upon system startup, the metadata layer of all skills is extracted, written to a resident memory cache, and a resident vector index is constructed. When a user message arrives, the top K skills with similarity meeting a preset threshold are selected as the hit set through semantic vector retrieval, where K is dynamically calculated based on the context token budget. The operation guide layer is loaded only for the hit skills and converted into a tool call format recognizable by the large language model before being injected into the context. The resource layer is loaded on demand when a skill is selected for execution and released after execution. This invention significantly reduces token consumption while ensuring skill discoverability and solves the context window overflow problem under large-scale skill sets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and large language model intelligent agents, and in particular to a method for determining the hierarchical loading and on-demand disclosure of a large set of reusable skills under the condition of limited context window of a large language model intelligent agent. Background Technology

[0002] As Large Language Model (LLM)-driven agent systems mature, "skills" are widely adopted as reusable capability modules. Each skill typically includes a name, description, parameter definition (schema), operation guidelines (when to invoke, how to invoke, precautions), and associated resources, with an overall scale ranging from hundreds to thousands of tokens. A token is the smallest unit of measurement when a large language model processes text; one token corresponds to one character, one word, or one symbol. The number of tokens that a large language model's context window can hold has an upper limit, known as the context window budget. Currently, there are four existing solutions on the market:

[0003] (1) Full injection scheme, such as the schemes of LangChain and early versions of AutoGPT: inject the complete descriptions and parameter definitions of all available skills into the LLM's system prompt or function calling tool list at once. This scheme is feasible when the number of skills is small, but when the skill set expands to dozens or more, it will seriously crowd out the limited context window budget, resulting in the truncation or loss of key information such as user messages and history conversations.

[0004] (2) Static grouping schemes, such as AutoGen's role grouping scheme: skills are statically grouped according to preset categories or roles, and only the subset corresponding to the current role is loaded each time. Although this scheme alleviates the token pressure, the grouping rules need to be predefined manually, cannot be adaptively selected according to the dynamic semantics of user messages, and cross-group skills cannot be recalled simultaneously.

[0005] (3) Pure semantic retrieval schemes, such as Voyager's skill retrieval scheme: semantic retrieval of user messages, selecting Top-K (first K) relevant skills and injecting them into the context. Although this scheme achieves dynamic selection, it usually injects the complete content of the retrieved skills, including parameter definitions, operation guides, etc., without layering and distinguishing the skill information itself. When the content of a single skill is large, multiple skills hitting at the same time will still cause token overflow.

[0006] (4) Model autonomous disclosure scheme, such as the Anthropic Agent Skills scheme: inject the metadata of all skills, "name + description", into the system prompt, and let the large language model LLM autonomously determine whether to read the text file of a certain skill. This scheme realizes two-level disclosure of "metadata resident and text on demand", but there are two shortcomings: (a) the skill selection depends entirely on the large language model to make autonomous judgment during inference. All skill metadata must be injected into the system prompt without difference. When the skill scale increases, the metadata itself will still expand linearly, and the accuracy of the large language model's autonomous selection of hundreds of metadata is uncontrollable; (b) there is a lack of loading quantity control linked to the context token budget. The number of text loaded is not constrained by the budget and may still cause context overflow.

[0007] It is evident that none of the above solutions simultaneously address the issues of "layered granularity of skill information" and "budget control over the number of skills loaded," namely: which information must be permanently stored for retrieval, which information only needs to be loaded when a skill is selected, which information only needs to be read when a skill is actually executed, and how many skills should be loaded given a token budget. This lack of a mechanism leads to: token waste: the complete parameter definitions of a large number of unused skills occupy context; limited recall: due to the excessive size of individual skills, the recall quantity K value has to be reduced, resulting in more potentially relevant skills not being perceived by the large language model; and uncontrollable filtering: solutions relying on the large language model's autonomous judgment become uncontrollable in terms of filtering accuracy and latency as the skill scale increases.

[0008] Therefore, there is an urgent need to provide a progressive, on-demand skill loading determination method for agents in large oracle models to solve the above problems. Summary of the Invention

[0009] Therefore, a progressive on-demand loading method for skill determination is needed for big oracle model agents. This method involves splitting the information of each skill into three logical levels and setting differentiated loading trigger conditions to maximize skill discoverability while minimizing actual token consumption within a limited context window budget.

[0010] To achieve the above objectives, the inventors provide a method for progressively loading and determining the skills of a large language model agent on demand, comprising the following steps:

[0011] S1, the information of each reusable skill is divided into three logical layers: the first layer is the metadata layer, which contains skill identification and summary information; the second layer is the operation guide layer, which contains parameter definitions and calling guidance information; the third layer is the resource layer, which contains the associated resources for execution; wherein, the amount of information in the first layer is less than the amount of information in the second layer.

[0012] S2, during the system initialization phase, extract the first-level information of all registered skills and write it into the resident memory cache, and generate a semantic vector for the first-level text of each skill to build a resident vector index;

[0013] S3, when a user message arrives, a query vector is generated for the user message, the similarity between the query vector and the first-layer semantic vector of each skill is calculated, and the top K skills whose similarity meets the preset threshold are selected as the hit set; wherein, the value of K is dynamically calculated and determined based on the current context token budget and the estimated occupancy of the second layer of a single skill.

[0014] S4, load the second layer information of the skills in the hit set, and convert the loaded second layer information into the tool call format recognized by the large language model and inject it into the context;

[0015] S5. When the large language model selects and executes a skill, the third-layer resource of the skill is loaded on demand, and the third-layer resource is released after execution is completed.

[0016] In a preferred embodiment of the present invention, in step S3, the K value is dynamically calculated as follows: an upper limit value is calculated, wherein the upper limit value is the smaller of a preset maximum number of skills and a first ratio, wherein the first ratio is the quotient obtained by dividing the current context token budget by the estimated occupancy of the second layer of a single skill; and the K value is determined to be the larger of a preset minimum recall number and the upper limit value.

[0017] As a preferred embodiment of the present invention, a degraded retrieval step is also included: when the semantic vector generation service is unavailable, the retrieval is reverted to keyword substring matching, that is, the user message is segmented to obtain a keyword sequence; each keyword in the keyword sequence is matched with the metadata layer text of each skill for substring inclusion; the candidate skills are sorted according to the number of keywords or scores of each skill, and the top K skills are selected as the hit set.

[0018] As a preferred embodiment of the present invention, a fallback supplementation step is also included: when the number of skills in the hit set is less than K, skills whose names or descriptions contain preset keywords are automatically added to the hit set.

[0019] In a preferred embodiment of the present invention, in step S2, the semantic vector is shared among several working processes through a shared cache: the first working process that calculates the first-layer semantic vector of the skill writes the semantic vector into the shared cache and sets an expiration time, while the other working processes read directly from the shared cache.

[0020] In a preferred embodiment of the present invention, in step S1, the metadata layer includes the following fields: unique skill name, display name, one-sentence summary, business domain classification, tag list, and version number;

[0021] The operation guide layer includes the following fields: complete description text, operation guide text, complete parameter definition, output definition, runtime configuration, and resource identifier list.

[0022] As a preferred embodiment of the present invention, the similarity is cosine similarity; the amount of information for a single skill in the metadata layer is less than or equal to 100 tokens; the preset similarity threshold is 0.25; the estimated occupancy of the second layer for a single skill is 800 tokens; and the minimum recall number for the K value is 3.

[0023] As a preferred embodiment of the present invention, when a new skill automatically extracted from interactive experience lacks a one-sentence summary field, a one-sentence summary is automatically generated from the description text of the new skill. After removing whitespace from the description text, if the length does not exceed a preset length, it is directly used as a one-sentence summary; otherwise, it is truncated to one character less than the preset length and an ellipsis mark is added, so that the new skill is included in the resident memory cache and the resident vector index.

[0024] As a preferred embodiment of the present invention, a dynamic inclusion step is also included: when a new skill is automatically extracted from the interaction experience, the metadata layer of the new skill is written to the resident memory cache in real time, and a semantic vector is generated for the first layer text of the new skill and included in the resident vector index, so that the new skill can be retrieved and discovered without restarting the system.

[0025] Unlike existing technologies, the above technical solution achieves the following beneficial effects:

[0026] (1) Token consumption is significantly reduced: The amount of information for a single skill in the metadata layer is only about 100 tokens, and the operation guide layer only loads the skills that are retrieved (usually 3 to 8). Compared with the full injection scheme that injects all the complete information of all skills at once, it can save 60% to 80% of the token consumption.

[0027] (2) Maximize skill discoverability: The metadata layer of all skills is resident when the system starts up, and any skill has the opportunity to be hit by vector retrieval, without being restricted by static grouping;

[0028] (3) Dynamic Adaptation: The K value is dynamically adjusted according to the context Token budget, which can automatically balance the number of recalls and the integrity of single skill information in different context length scenarios;

[0029] (4) Graceful degradation: When the vector service fails, it automatically falls back to keyword substring matching search to ensure that the core on-demand loading judgment function remains available;

[0030] (5) Multi-process deployment friendly: The semantic vector shared caching mechanism reduces the vector calculation volume from "number of working processes × number of skills" times to about the number of skills, significantly reducing the call pressure of upstream semantic vector generation services. Attached Figure Description

[0031] Figure 1 A flowchart illustrating the overall process of a progressive on-demand skill loading determination method for a large language model agent, as provided in an embodiment of the present invention.

[0032] Figure 2 This is a schematic diagram of the three-layer logical structure of skill information provided in an embodiment of the present invention;

[0033] Figure 3 A flowchart illustrating the three-level trigger loading determination mechanism provided in this embodiment of the invention;

[0034] Figure 4 This is a schematic diagram of the three-layer loading process in a video monitoring and judgment scenario provided by an embodiment of the present invention. Detailed Implementation

[0035] To explain in detail the technical content, structural features, objectives, and effects of the technical solution, the following description is provided in conjunction with specific embodiments and accompanying drawings.

[0036] like Figure 1 As shown, this embodiment provides a method for progressive on-demand skill loading determination for large language model agents, including the following steps:

[0037] In step S1, the information for each reusable skill is broken down into three logical levels. Please refer to [link / reference]. Figure 2 The system consists of three layers: the first is the metadata layer, which contains skill identifiers and summary information, including fields such as unique skill name, display name, brief summary, business domain classification, tag list, and version number; the second is the operation guide layer, which contains parameter definitions and calling guidance information, including complete description text, operation guide text, complete parameter definitions (i.e., complete definitions of parameter name, type, description, and whether it is required), output definitions, runtime configuration, and resource identifier list; the third is the resource layer, which contains executable associated resources, specifically associated script files, template files, datasets, and other executable resources. The information content of the first layer is less than that of the second layer: the information content of a single skill in the metadata layer is typically no more than 100 tokens, while the information content of a single skill in the operation guide layer is approximately 500-800 tokens. The resource layer is read on demand and not preloaded. The information content of the three layers increases sequentially, and the timing of their disclosure to the large language model is progressively delayed.

[0038] In step S2, during the system initialization phase, the first-layer information of all registered skills is extracted and written to a persistent memory cache. A semantic vector is generated for the first-layer text of each skill, and a persistent vector index is constructed. Specifically, the SkillRegistry module maintains all registered skills, and the SkillMetadataCache module scans all skills in the SkillRegistry module and extracts their metadata layer when the system starts. The metadata layer text is composed of a display name, a one-sentence summary, a business domain classification, and tags, for example, in the format "Display Name | One-Sentence Summary | Domain: ×× | Tags: ××". The SkillEmbeddingIndex module calls the semantic vector generation service (embedding service) to generate a semantic vector (i.e., an embedding vector) for the metadata layer text of each skill, and constructs a persistent vector index. Since the information volume of a single skill in the metadata layer is only about 100 Tokens, even with hundreds of skills, the total occupancy of the persistent cache can be controlled within 10K Tokens, without crowding out the context space of user messages and historical conversations.

[0039] In step S3, when a user message arrives, a query vector is generated for the user message. The similarity (e.g., cosine similarity) between the query vector and the first-layer semantic vector of each skill is calculated. The top K skills whose similarity meets a preset threshold are selected as the hit set. The preset threshold can be configured according to the actual scenario, for example, 0.25. K is dynamically calculated and determined based on the current context token budget and the estimated second-layer occupancy of a single skill: an upper limit is calculated, which is the smaller of the preset maximum number of skills and a first ratio, where the first ratio is the quotient obtained by dividing the current context token budget by the estimated second-layer occupancy of a single skill; then K is determined as the larger of the preset minimum recall number and the upper limit value. This can be expressed as: K = max(Kmin, min(Kmax, token budget ÷ estimated second-layer occupancy of a single skill)), where Kmin is the preset minimum recall number and Kmax is the preset maximum number of skills.

[0040] In step S4, only the second-layer information of skills in the hit set is loaded, and the loaded second-layer information is converted into a tool call format recognizable by the large language model and injected into the context; the second-layer information of skills that are not hit is not loaded. Specifically, the operation guide layer acquisition interface of each hit skill can be called in batches to obtain the complete parameter definition and operation guide text, and then converted into a function calling tool list format and injected into the large language model context. Skills that are not hit do not consume any operation guide layer tokens.

[0041] In step S5, when the large language model selects and executes a skill according to the injected tool call format, the third-layer resources of the skill are loaded as needed, such as loading associated script files, template files, etc. from disk or remote storage. After execution, the third-layer resources are released and not retained in the context.

[0042] Please see Figure 3 Steps S2, S3, and S5 constitute a three-level trigger loading mechanism: the first level trigger is persistent at startup, meaning that during system initialization, the metadata layer of all skills is written to the persistent memory cache and a persistent vector index is built; the second level trigger is on-demand loading upon semantic retrieval hit, meaning that after a user message arrives, a hit set is obtained through semantic retrieval, and only the operation guide layer is loaded and the context is injected for the skills in the hit set; the third level trigger is on-demand loading when the skill is actually executed, meaning that the resource layer is loaded only when the large language model selects to execute a certain skill, and released after execution. The three trigger conditions correspond one-to-one with the three levels, realizing a progressive on-demand disclosure of "which information is persistent for retrieval, which information is loaded after a hit, and which information is read during execution".

[0043] In an optional implementation, the method further includes a fallback retrieval step: when the semantic vector generation service is unavailable, it falls back to keyword substring matching retrieval, specifically including: segmenting the user message to obtain a keyword sequence; performing substring inclusion matching between each keyword in the keyword sequence and the metadata layer text of each skill; ranking candidate skills according to the number of keywords hit or the score of each skill, and selecting the top K skills as the hit set. The score can be calculated as follows: 0.2 points for each hit keyword, with a maximum score of 0.9 points for a single skill. The fallback retrieval path does not depend on any external services, ensuring the continued availability of the core on-demand loading and judgment function; after the semantic vector generation service recovers, it automatically switches back to the semantic retrieval path.

[0044] In an optional implementation, the method further includes a fallback supplementation step: when the number of skills in the hit set obtained from semantic retrieval is less than K, skills whose names or descriptions contain preset keywords are automatically added to the hit set. For example, preset keywords may include "rendering," "visualization," "render," "chart," "visual," etc., to ensure that output-type skills such as rendering and charts can always be discovered.

[0045] In one optional implementation, the semantic vector in step S2 is shared among multiple worker processes via a shared cache: the first worker process to calculate the first-level semantic vector of a skill writes the semantic vector to the shared cache and sets an expiration time, such as 7 days. The vector expires and is recalculated automatically after changes to the skill's metadata. Other worker processes read directly from the shared cache, avoiding repeated calculations of "number of worker processes × number of skills". The shared cache can be implemented using Redis, for example.

[0046] In an optional implementation, the method further includes a dynamic inclusion step: when the system automatically extracts new skills from interaction experiences, the metadata layer of the new skills is written to the resident memory cache in real time and included in the resident vector index, allowing them to be retrieved and discovered without restarting the system. When a new skill lacks a brief field, it is automatically generated from its description text: after removing extra whitespace from the description text, if the length does not exceed a preset length, such as 50 characters, it is directly used as a brief; otherwise, it is truncated to the preset length minus one, such as 49 characters, and an ellipsis is appended. This ensures that automatically generated skills can also immediately enter the metadata layer resident cache and resident vector index, and can be discovered by the large language model without manual intervention.

[0047] To illustrate the above technical solution in detail, the following examples are provided.

[0048] Example 1: Three-layer loading in video monitoring and judgment scenarios, please refer to... Figure 4 .

[0049] Taking the video monitoring and judgment intelligent agent as an example, the intelligent agent is equipped with 12 professional skills, including case inquiry, spatiotemporal device inquiry, capture acquisition, capture analysis, file aggregation, tag analysis, trajectory inquiry, target personnel recommendation, final judgment and diversion, report rendering, etc. The complete information of each skill (including parameter definition and operation guide) is about 600 to 1000 tokens.

[0050] Step 1: The metadata layer remains resident at startup.

[0051] When the system starts, the metadata caching module (SkillMetadataCache) scans all 12 skills in the skill registration module (SkillRegistry) and extracts their respective metadata layers. Taking the case query skill (case_query) as an example, its metadata layer includes:

[0052] Unique name for the skill: "case_query";

[0053] Display name (display_name): "Case Information Inquiry";

[0054] A brief summary: "Query case information by case name and return the time, location, and latitude and longitude of the incident."

[0055] Business category: "Security Management";

[0056] Tag list: ["Case", "Query", "Video Monitoring"];

[0057] Version number: "1.0.0".

[0058] The metadata layer for the 12 skills totals approximately 1200 tokens and resides in memory. The vector index module (SkillEmbeddingIndex) generates semantic vectors from the semantic vector generation service for each skill's metadata layer text, such as: "Case Information Query | Query case information by case name, returning the event time, location, and latitude and longitude | Domain: Security Management | Tags: Case Query Video Monitoring", and constructs a resident vector index.

[0059] Step 2: Semantic retrieval when user messages arrive.

[0060] A user sends the message: "Help me check the surrounding surveillance footage of the Zhang San target event." The system generates a query vector for this message and calculates the cosine similarity with the first-layer semantic vectors of the 12 skills. Setting the context token budget to 8000 tokens and the estimated second-layer usage for a single skill to 800 tokens, then K = max(3, min(10, 8000÷800)) = 10.

[0061] The search results (similarity ≥ 0.25) are: case_query (similarity 0.82), spacetime_device_query (spacetime device query, similarity 0.65), capture_retrieval (capture acquisition, similarity 0.58), and archive_query (archive query, similarity 0.31), a total of 4 skills.

[0062] Step 3: Load the operation guide layer only for hit skills.

[0063] The system only calls the operation guide layer retrieval interface in batches for the above four hit skills to obtain complete parameter definitions and operation guide text. Taking case_query as an example, its operation guide layer includes:

[0064] Parameter definition: case_name (string, required, case name);

[0065] Operation Guide: When to call, prerequisites, call order, precautions, etc.;

[0066] Output definition: object type, case information.

[0067] The operation guide layers for these four skills are converted into function call format and injected into the large language model context. The operation guide layers for the remaining eight unmatched skills are not loaded and do not consume tokens.

[0068] The quantitative comparisons are shown in Table 1.

[0069] Table 1: Quantitative Comparison Analysis Table

[0070] plan Injected content Token usage Full injection solution Complete information on 12 skills (approximately 800 tokens each) Approximately 9600 tokens This method 4 hit skill operation guide layers (approximately 800 tokens each) + the retrieval process does not occupy context. Approximately 3200 tokens

[0071] In this embodiment, approximately 67% of tool description tokens are saved. The larger the skill scale, the more significant the savings: when the number of skills expands to 100, full injection requires approximately 80,000 tokens, far exceeding the available budget of most models; while using the method of this invention, only the K hit skills are injected, where K is determined by the budget (e.g., K=10 with a budget of 8,000 tokens, occupying approximately 8,000 tokens), saving approximately 90%.

[0072] Step 4: The resource layer is loaded on demand during the execution of the large language model selection.

[0073] The large language model selects to invoke the `case_query` skill. The system executes the code implementation of this skill, and only then does it load the associated real plugin call configuration (resource layer). After execution, the resources are released. Finally, the case information, such as the time, location, and latitude and longitude of the event, is output to the user.

[0074] Example 2: Automatically generate a one-sentence summary of a skill and automatically extract it.

[0075] When the system automatically extracts new skills from interactive experiences, a brief summary of the new skill may not be explicitly specified. In this case, the system automatically extracts it from its description text: after removing extra whitespace, if the length is no more than 50 characters, it is used directly; otherwise, the first 49 characters are truncated and an ellipsis is added. This ensures that automatically generated skills can immediately enter the metadata layer's resident cache and resident vector index, and can be discovered by the large language model without manual intervention.

[0076] Example 3: Degraded retrieval when semantic vector generation service is unavailable.

[0077] A temporary failure occurred in the semantic vector generation service (embedding service) of a certain deployment environment, resulting in failed vector generation queries. The system automatically downgraded to keyword substring matching: the user message "Help me check the surrounding monitoring of Zhang San's target event" was segmented by spaces to obtain a keyword sequence. Each keyword was then compared with the metadata layer text of each skill (display name + one-sentence summary + domain + tag + skill name concatenation) for substring inclusion judgment. Each matched keyword earned 0.2 points (maximum score of 0.9 points per skill), and the top K skills were selected in descending order of score. This downgraded path does not rely on any external services, ensuring the continued availability of the core on-demand loading judgment function; once the service recovers, it automatically switches back to the semantic retrieval path.

[0078] It should be noted that although the above embodiments have been described herein, this does not limit the scope of patent protection of the present invention. Therefore, any changes and modifications made to the embodiments described herein based on the innovative concept of the present invention, or equivalent structural or procedural transformations made using the content of the present invention's specification and drawings, directly or indirectly applying the above technical solutions to other related technical fields, are all included within the scope of patent protection of the present invention.

Claims

1. A method for progressively loading and determining skills on demand for a large language model intelligent agent, characterized in that, Includes the following steps: S1 breaks down the information of each reused skill into three logical levels: the first level is the metadata layer, which contains skill identifier and summary information; The second layer is the operation guide layer, which contains parameter definitions and calling instructions; The third layer is the resource layer, which contains the associated resources for execution; the amount of information in the first layer is less than that in the second layer. S2, during the system initialization phase, extract the first-level information of all registered skills and write it into the resident memory cache, and generate a semantic vector for the first-level text of each skill to build a resident vector index; S3, when a user message arrives, a query vector is generated for the user message, the similarity between the query vector and the first-layer semantic vector of each skill is calculated, and the top K skills whose similarity meets the preset threshold are selected as the hit set; wherein, the value of K is dynamically calculated and determined based on the current context token budget and the estimated occupancy of the second layer of a single skill. S4, load the second layer information of the skills in the hit set, and convert the loaded second layer information into the tool call format recognized by the large language model and inject it into the context; S5. When the large language model selects and executes a skill, the third-layer resource of the skill is loaded on demand, and the third-layer resource is released after execution is completed.

2. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that, In step S3, the K value is dynamically calculated as follows: the upper limit value is calculated, which is the smaller of the preset maximum number of skills and the first ratio, where the first ratio is the quotient obtained by dividing the current context token budget by the estimated occupancy of the second layer of a single skill; the K value is determined as the larger of the preset minimum recall number and the upper limit value.

3. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that, It also includes a degraded retrieval step: when the semantic vector generation service is unavailable, it falls back to keyword substring matching retrieval, that is, the user message is segmented to obtain a keyword sequence; each keyword in the keyword sequence is matched with the metadata layer text of each skill; according to the number of keywords or scores of each skill, the candidate skills are sorted, and the top K skills are selected as the hit set.

4. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that, It also includes a fallback supplement step: when the number of skills in the hit set is less than K, skills whose names or descriptions contain preset keywords are automatically added to the hit set.

5. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that, In step S2, the semantic vector is shared among several working processes through a shared cache: the first working process that calculates the first-layer semantic vector of the skill writes the semantic vector into the shared cache and sets an expiration time, while the other working processes read directly from the shared cache.

6. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that, In step S1, the metadata layer includes the following fields: unique skill name, display name, one-sentence summary, business domain category, tag list, and version number; The operation guide layer includes the following fields: complete description text, operation guide text, complete parameter definition, output definition, runtime configuration, and resource identifier list.

7. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that: The similarity is cosine similarity; The metadata layer contains less than or equal to 100 tokens for a single skill; the preset similarity threshold is 0.25; the estimated occupancy of the second layer for a single skill is 800 tokens; and the minimum recall number for the K value is 3.

8. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that: When a new skill automatically extracted from interactive experience lacks a one-sentence summary field, a one-sentence summary is automatically generated from the description text of the new skill. After removing whitespace from the description text, if the length does not exceed the preset length, it is directly used as a one-sentence summary; otherwise, it is truncated to one character less than the preset length and an ellipsis mark is added, so that the new skill is included in the resident memory cache and the resident vector index.

9. The skill-progressive on-demand loading determination method for large language model agents according to claim 1, characterized in that: It also includes a dynamic inclusion step: when a new skill is automatically extracted from the interaction experience, the metadata layer of the new skill is written to the resident memory cache in real time, and a semantic vector is generated for the first layer of text of the new skill and included in the resident vector index, so that the new skill can be retrieved and discovered without restarting the system.