An agent-oriented multi-level cache reuse method

By employing a multi-level caching and reuse method, the problems of redundant tool calls and unstable policies in intelligent agent systems are solved, enabling direct reuse of tool results and policy migration, thereby improving the system's operating efficiency and interpretability.

CN121680833BActive Publication Date: 2026-04-17QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
Filing Date
2026-02-10
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In large-scale language model-driven intelligent agent systems, tool calls suffer from high overhead due to repeated calls, unstable and non-transferable tool policy generation, and lack of parameter consistency leading to cache hits, resulting in system performance bottlenecks and poor interpretability.

Method used

A multi-level cache reuse method is adopted, which realizes cache reuse at the issue-result level and the strategy planning level through issue signature generation, semantic similarity and context consistency matching. Combined with tool parameter consistency matching, historical tool results are directly reused and the cache is updated.

Benefits of technology

It reduces tool call redundancy, improves system performance and interpretability, reduces repeated oscillations and redundant verifications in inference paths, and improves system operating efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121680833B_ABST
    Figure CN121680833B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of intelligent agents, and particularly provides a multi-level cache reuse method for intelligent agents. The method comprises the following steps: analyzing each natural language question, generating a question signature, and performing cache retrieval and writing in a question-result level layer; matching the natural language question and historical cache, directly reusing the result if a hit is obtained, entering a strategy planning reuse level layer if a miss is obtained, executing a historical tool strategy according to the question category, reusing the historical tool strategy if a hit is obtained, re-planning by the intelligent agent if a miss is obtained, and generating a new strategy; obtaining a tool list and a parameter list by using the intelligent agent according to the historical tool strategy or the new strategy and the natural language question, reusing the historical tool calling result through consistency matching of tool parameters, and obtaining an execution result; and updating a three-stage cache according to the execution result, so that the method realizes redundancy elimination of tool calling, strategy migration and result short-circuit reuse.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent agent technology, and in particular to a multi-level cache reuse method for intelligent agents. Background Technology

[0002] With the rapid development of artificial intelligence technology, large-scale language models (LLM-Agents) have been widely applied in various fields. In large-model-driven agent systems, tool invocation is a key component for realizing external environment perception, logical computation, and problem-solving. Typically, after a user's question arrives, the agent follows a complete inference chain: intent parsing, tool selection strategy generation, parameter construction and tool invocation execution, tool result fusion, and final response generation. With the widespread application of agents in general scenarios such as intelligent operation and maintenance, network analysis, knowledge-based question answering, and scheduling decision-making, the latency and execution cost of tool invocation have become significant sources of system performance bottlenecks.

[0003] The current intelligent agent tool invocation faces several structural problems: (1) High overhead of repeated invocation: In multi-turn dialogues or similar queries, even if the semantics of user questions are highly similar, the intelligent agent still needs to re-trigger tool selection and invocation, resulting in frequent tool execution; (2) Unstable and non-transferable tool strategy generation: Large models dynamically generate tool chain invocation plans based on ReAct-style inference. Although they are highly flexible, they often cannot directly reuse the previous tool selection strategy when encountering the same type of question in the future, resulting in repeated oscillations of the inference path. Especially under the conditions of multiple tools and multiple parameters, the model often has repeated policy judgment, repeated planning, and repeated verification, which increases the invocation cost and affects interpretability; (3) Invocation parameters must be strictly consistent to be reused, but the model lacks a parameter-level consistency awareness mechanism: In the existing system, even if the large model selects the same tool, it often generates parameter strings that are equivalent but different in appearance (such as different JSON field order, different units, different formats, inconsistent spaces and types, etc.), making it difficult to hit the cache and causing the results to be unusable. Summary of the Invention

[0004] In view of this, the present invention provides a multi-level cache reuse method for intelligent agents to achieve redundancy elimination of tool calls, policy migration, and short-circuit reuse of results.

[0005] In a first aspect, the present invention provides a multi-level cache reuse method for intelligent agents, the method comprising:

[0006] Step 1: Parse each natural language question Q, generate a question signature, and perform cache retrieval and writing in the question-result level Q-ACache;

[0007] Step 2: Based on the question signature, match the natural language question and the historical cache at the question-result level. If a match is found, reuse the result directly. If no match is found, proceed to step 3.

[0008] Step 3: Enter the Strategy Cache layer for strategy planning and reuse. Execute historical tool strategies according to the problem category. If a hit occurs, the historical tool strategy is reused. If a miss occurs, the agent re-plans and generates a new strategy.

[0009] Step 4: Using an intelligent agent, obtain a tool list and parameter list based on historical tool strategies or new strategies and the natural language problem. By matching the consistency of tool parameters, reuse the results of historical tool calls and obtain the execution results.

[0010] Step 5: Update the three-stage cache based on the execution results.

[0011] Optionally, the problem signature in step 1 consists of three parts:

[0012] I. Semantic Representation q_vec: The natural language question Q is encoded into a fixed-dimensional vector q_vec(Q) by the semantic coding model;

[0013] II. The question category q_class is generated by the large language model and is used to map parent categories and compatible categories. The category label is a higher-level abstraction of the task intent.

[0014] III. Constraint context ctx includes session time, domain ID, permissions, and data version, which are used to limit whether the cache can be reliably reused;

[0015] Serialize the constraint context (ctx) and perform deterministic hash calculation. As a stable index, when generating the issue signature, a unique primary key QID is generated by combining (q_vec, q_class, ctx_hash). The QID will be used as the primary key when retrieving and writing in the issue-result level cache, and will be used for subsequent multi-level cache retrieval, constraint and reuse judgment.

[0016] Optionally, the question-result level in step 2 can be directly reused at the final answer level, and the process is as follows:

[0017] The issue signature will enter the cache matching stage. First, all candidate q_class_i that are compatible with the current issue category q_class are retrieved from the cache. The semantic similarity between q_vec_i and q_vec of the corresponding entry in the candidate cache is calculated. If the similarity is greater than the threshold, the context consistency ctx_i is further checked. If the context does not conflict, reuse is allowed. If there are multiple candidates, the one with the latest execution time and the highest feedback score is selected as the result and returned.

[0018] Optionally, step 3 includes:

[0019] When the cache at the problem-result level is not hit, the strategy planning phase begins. First, it attempts to reuse the previously successful tool strategy path. The strategy cache is organized by problem category `q_class` as the parent key, with multiple historical strategy entries maintained under each problem category. When a problem category identical to the natural language problem exists in the strategy planning cache, it compares a set of tool strategy schemes maintained under the current problem category. First, it checks the `status` and `scene_scope` fields to determine if the historical tool strategy is available and if the scene is compatible. Second, it performs tool version verification to ensure that the tools in the historical tool strategy are the same as those in the tool documentation. If all verifications pass, the historical tool strategy is reused; at this point, the agent does not need to replan the tool name list `tool_set` and the tool execution order template `Plan`. If the relevant record is not hit in the current strategy planning cache, the agent will plan and generate a new strategy based on the natural language problem and the tool documentation.

[0020] Optionally, step 4 includes:

[0021] Receive the structured execution plan returned during the strategy planning phase, which includes: (a) a list of selected tool names tool_set; (b) a tool execution order template Plan; (c) the parameter fields required by each tool and the corresponding set of parameter values; when the cache is hit, read the historical tool execution result result from the cache and skip the actual call or network request process of the current historical tool.

[0022] Optionally, step 5 includes:

[0023] After an agent completes a task, it enters the cache update phase based on the execution result, which includes problem-result level cache update, strategy planning cache update, and tool call level cache update.

[0024] Question-result level cache update: First, calculate the unique primary key QID based on the semantic representation q_vec of the task input, the question category q_class, and the constraint context ctx, and write the final answer generated by the current agent into the question-result level cache; if the current task directly returns the result through a hit in the question-result level cache, only update the current write time timestamp and the system score or user feedback_score.

[0025] Policy Planning Cache Update: In the current task, when the tool invocation policy comes from the policy-level cache or is regenerated by the agent through replanning, the system will update the policy cache based on the execution effect. If the historical tool policy is used and the execution effect is good, the score value of the current historical tool policy will be increased, and its last usage time will be updated. If the historical tool policy is used but the agent modifies its structure multiple times, the score of the current historical tool policy will be decreased, and its reuse priority will be reduced in subsequent tasks. If the current tool invocation policy is a new policy generated by the agent, the system will create a new policy entry according to the question category q_class corresponding to the primary key QID and write it into the cache for quick reuse of future similar questions.

[0026] Tool Invocation Cache: After completing the tool invocation policy planning, the agent enters the stage of comparing the tool execution with the parameter-level cache. After obtaining the execution result result, in the current inference chain, the execution result result is used as the return value of the current tool invocation and input into the agent to continue completing subsequent inferences or result fusion. After reading, the hit count field in the cache entry is immediately updated to hit_count + 1. At the same time, the time-to-live TTL of the current cache entry is adjusted: if it is a high-frequency call item, the validity period is extended based on the original TTL. When the cache is not hit, the real tool execution process is triggered, and the target tool is called through the LangChain tool scheduling interface and the parameters generated by the agent are passed in for execution. If the tool execution is successful, the name of the current called tool, the parameter key-value pair, the tool execution result, the call timestamp, and the default TTL information corresponding to the question category are written into the cache library as a new cache entry. If <tool_name="exchange_rate_api", parameters are the same> is called again and it is still valid within the TTL, the execution result result is directly reused, the tool execution is skipped, and hit_count is updated.

[0027] The technical solution provided by this invention includes the following steps: parsing each natural language question Q to generate a question signature; performing cache retrieval and writing in the question-result level Q-A Cache; matching the natural language question with the historical cache in the question-result level based on the question signature; if a match is found, the result is directly reused; if a match is not found, the process proceeds to the strategy planning and reuse level Strategy Cache, where historical tool strategies are executed according to the question category; if a match is found, the historical tool strategy is reused; if a match is not found, the agent re-plans and generates a new strategy; the agent obtains a tool list and a parameter list based on the historical tool strategy or the new strategy and the natural language question; through consistency matching of tool parameters, the results of historical tool calls are reused, and the execution result is obtained; and the three-stage cache is updated based on the execution result. This method achieves redundancy elimination of tool calls, strategy migration, and short-circuit reuse of results. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 A flowchart of a multi-level cache reuse method for intelligent agents provided in an embodiment of the present invention;

[0030] Figure 2 This is a schematic diagram illustrating the problem-result level layer cache reuse provided in an embodiment of the present invention.

[0031] Figure 3 This is a schematic diagram of strategy planning reuse level cache reuse provided in an embodiment of the present invention;

[0032] Figure 4 This is a schematic diagram illustrating tool call-level cache reuse provided in an embodiment of the present invention. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0034] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0035] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The singular forms “a,” “the,” and “the” used in the embodiments of this invention are also intended to include the plural forms unless the context clearly indicates otherwise.

[0036] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0037] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0038] Figure 1 A flowchart of a multi-level cache reuse method for intelligent agents provided in an embodiment of the present invention is shown below. Figure 1 As shown, the method includes:

[0039] Step 1: Parse each natural language question Q, generate a question signature, and perform cache retrieval and writing in the question-result level Q-ACache.

[0040] In this embodiment of the invention, the problem signature in step 1 consists of three parts:

[0041] I. Semantic Representation q_vec: The natural language question Q is encoded into a fixed-dimensional vector q_vec(Q) by the semantic coding model;

[0042] II. The problem category q_class is generated by the large language model and is used to map parent categories and compatible categories. The category label is a higher-level abstraction of the task intent, such as: system alarm diagnosis, mathematical expression calculation, network log query, configuration parsing and translation, etc.

[0043] III. Constraint context ctx includes session time, domain ID, permissions, and data version, which are used to limit whether the cache can be reliably reused;

[0044] Serialize the constraint context (ctx) and perform deterministic hash calculation. As a stable index, when generating the issue signature, a unique primary key QID is generated by combining (q_vec, q_class, ctx_hash). The QID will be used as the primary key when retrieving and writing in the issue-result level cache, and will be used for subsequent multi-level cache retrieval, constraint and reuse judgment.

[0045] Step 2: Based on the question signature, match the natural language question with the historical cache at the question-result level. If a match is found, reuse the result directly; otherwise, proceed to step 3.

[0046] Since each user's natural language question, context, and use case may be different, the primary key does not need to be exactly the same to match during the cache matching stage. It can be matched based on category consistency, semantic similarity, and context compatibility / similarity.

[0047] In embodiments of the present invention, such as Figure 2 As shown, in step 2, the question-result level layer directly reuses the solution at the final answer level, avoiding repeated triggering of strategy generation. The process is as follows:

[0048] The issue signature will enter the cache matching stage. First, all candidate q_class_i that are compatible with the current issue category q_class are retrieved in the cache. The semantic similarity between q_vec_i and q_vec of the corresponding entry in the candidate cache is calculated. If the similarity is greater than the threshold (0.85), the context consistency ctx_i is further checked. If the context does not conflict, reuse is allowed. If there are multiple candidates, the one with the latest execution time and the highest feedback score is selected as the result and returned.

[0049] Step 3: Enter the Strategy Cache layer for strategy planning and reuse. Execute historical tool strategies based on the problem category. If a hit occurs, the historical tool strategy is reused; otherwise, the agent re-plans and generates a new strategy.

[0050] In embodiments of the present invention, such as Figure 3 As shown, step 3 includes:

[0051] When the cache at the problem-result level is not found, the strategy planning phase begins. First, it attempts to reuse the previously successful tool strategy path (tool set + execution order template) to reduce the cost of the model repeatedly selecting inference paths. The strategy cache is organized by problem category q_class as the parent key, and multiple historical strategy entries are maintained under each problem category. An example of the strategy planning cache is shown in Table 1. When a problem category identical to the natural language problem exists in the strategy planning cache, the set of tool strategy schemes maintained under the current problem category is compared. First, the status and scene_scope fields are checked to determine if the historical tool strategy is available and if the scene is compatible; this step is determined by the agent. Second, tool version verification is performed to ensure that the tools in the historical tool strategy are the same as the tools in the tool documentation. This step avoids compatibility issues caused by tool version updates. If all verifications pass, the historical tool strategy is reused; at this point, the agent does not need to replan the tool name list tool_set and the tool execution order template Plan. If the relevant record is not found in the current strategy planning cache, the agent will plan and generate a new strategy based on the natural language problem and the tool documentation.

[0052] Table 1. Example of Cache Strategy Planning

[0053] .

[0054] Step 4: Using the intelligent agent, obtain a tool list and parameter list based on historical tool strategies or new strategies and natural language problems. By matching the consistency of tool parameters, reuse the results of historical tool calls and obtain the execution results.

[0055] The core objective of this phase is to achieve precise reuse and short-circuit return of historical tool call results through strict consistency matching of tool parameters, without changing the main inference process or sacrificing the accuracy of the results. This will avoid redundant call overhead, reduce execution latency, and improve the overall operating efficiency of the system.

[0056] In embodiments of the present invention, such as Figure 4 As shown, step 4 includes:

[0057] The system receives a structured execution plan returned during the strategy planning phase, which includes: (a) a list of selected tool names (tool_set); (b) a tool execution order template (Plan); and (c) the parameter fields required by each tool and their corresponding parameter value sets. When a cache hit occurs, the system reads the historical tool execution result (result) from the cache and skips the actual call or network request process of the current historical tool. In this invention, both the tool name and parameter fields must be determined using a deterministic, structured, and fully consistent matching method to ensure that cache hit results are directly reused.

[0058] Step 5: Update the three-stage cache based on the execution results.

[0059] In this embodiment of the invention, step 5 includes:

[0060] After an agent completes a task (i.e., completing the process of problem understanding, tool strategy selection, tool execution or cache hit reuse, and final result generation), it enters the cache update phase based on the execution result. This phase includes problem-result level cache update, strategy planning level cache update, and tool call level cache update. The core objective of this phase is to incrementally update the problem-result level cache, strategy planning level cache, and tool call level cache based on the actual execution trajectory of the task. This enables the cache system to continuously optimize and learn as the system runs, thereby improving the reuse hit rate and execution efficiency of subsequent tasks.

[0061] Question-result level cache update: First, calculate the unique primary key QID based on the semantic representation q_vec of the task input, the question category q_class, and the constraint context ctx, and write the final answer generated by the current agent into the question-result level cache. An example of the question-result level cache is shown in Table 2. If the current task directly returns a result through a hit in the question-result level cache, only the current write time timestamp and the system score or user feedback_score are updated.

[0062] Table 2. Examples of Problem-Result Level Caching

[0063] .

[0064] Policy planning cache update: In the current task, when a tool invocation policy originates from the policy-level cache or is re-planned and generated by the agent, the system updates the policy cache based on the execution effect. If a historical tool policy is used and the execution effect is good, the score of the current historical tool policy is increased, and its most recent usage time is updated. If a historical tool policy is used but the agent modifies its structure multiple times, the score of the current historical tool policy is decreased, indicating that the policy has good reliability and adaptability in the current task category. If necessary, it is marked as an unstable policy, and its reuse priority is reduced in subsequent tasks. If the current tool invocation policy is a new policy generated by the agent, the system will create a new policy entry according to the problem category q_class corresponding to the primary key QID and write it into the cache for quick reuse of similar problems in the future.

[0065] Tool Invocation Cache. After completing the tool invocation strategy planning, the agent enters the stage of comparing the tool execution with the parameter-level cache. An example of the tool invocation cache is shown in Table 3. In Table 3, exchange_rate_api is the exchange rate calculation tool, and currency_pair and date_range are the corresponding parameters; as Figure 4 shown, after obtaining the execution result result, in the current inference chain, the execution result result is input into the agent as the return value of the current tool invocation to continue with subsequent inferences or result fusion; after reading, the hit_count field in the cache entry is immediately updated to hit_count + 1; at the same time, adjust the time-to-live TTL of the current cache entry: if it is a high-frequency invocation item (such as the number of hits in the last N times ≥ the preset threshold), then extend the validity period based on the original TTL to increase the cache effective window and hit rate; when the cache misses, trigger the real tool execution process, and through the LangChain tool scheduling interface, call the target tool and pass in the parameters generated by the agent for execution; if the tool execution is successful, write the tool name, parameter key-value pair, tool execution result, call timestamp, and default TTL information corresponding to the problem category of the current invocation as a new cache entry into the cache library for subsequent strict consistency reuse;

[0066] If <tool_name="exchange_rate_api", parameters are the same> is called again and it is still valid within the TTL, then directly reuse the execution result result, skip the tool execution, and update hit_count.

[0067] Table 3 Example of Tool Invocation Cache

[0068] .

[0069] The present invention proposes a top-down three-layer reuse system, which explicitly introduces three reuse mechanisms at the problem-result level, strategy planning level, and tool invocation level in the agent inference chain, and combines signature consistency judgment and cache linkage update to achieve redundancy elimination of tool invocation, strategy migration reuse, and result short-circuit return.

[0070] The overall method of the present invention is driven by five stages in the agent inference process: problem understanding, strategy planning, parameter construction, tool execution, and result generation. In this main process, multi-level reuse management components are embedded to achieve high reuse of tool results, stable migration of strategy paths, and call short-circuit reuse when the parameters and tool combinations are consistent.

[0071] This invention explicitly integrates multi-level consistency reuse judgments of problems, strategies, parameters, and results in the intelligent agent inference chain, reducing redundant tool call overhead from the architecture and execution process level, and realizing an overall solution with transferable strategies, normalizable parameters, directly reusable results, rollback cache, and controllable timeliness.

[0072] The technical solution provided by this invention includes the following steps: parsing each natural language question Q to generate a question signature; performing cache retrieval and writing in the question-result level Q-A Cache; matching the natural language question with the historical cache in the question-result level based on the question signature; if a match is found, the result is directly reused; if a match is not found, the process proceeds to the strategy planning and reuse level Strategy Cache, where historical tool strategies are executed according to the question category; if a match is found, the historical tool strategy is reused; if a match is not found, the agent re-plans and generates a new strategy; the agent obtains a tool list and a parameter list based on the historical tool strategy or the new strategy and the natural language question; through consistency matching of tool parameters, the results of historical tool calls are reused, and the execution result is obtained; and the three-stage cache is updated based on the execution result. This method achieves redundancy elimination of tool calls, strategy migration, and short-circuit reuse of results.

[0073] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A multi-level cache reuse method for an agent, characterized by, The method includes: Step 1: Parse each natural language question Q, generate a question signature, and perform cache retrieval and writing in the question-result level Q-A Cache; Step 2: Based on the question signature, match the natural language question and the historical cache at the question-result level. If a match is found, reuse the result directly. If no match is found, proceed to step 3. Step 3: Enter the Strategy Cache layer for strategy planning and reuse. Execute historical tool strategies according to the problem category. If a hit occurs, the historical tool strategy is reused. If a miss occurs, the agent re-plans and generates a new strategy. Step 4: Using an intelligent agent, obtain a tool list and parameter list based on historical tool strategies or new strategies and the natural language problem. By matching the consistency of tool parameters, reuse the results of historical tool calls and obtain the execution results. Step 5: Update the three-stage cache based on the execution results; The problem signature in step 1 consists of three parts: I. Semantic Representation q_vec: The natural language question Q is encoded into a fixed-dimensional vector q_vec(Q) by the semantic coding model; II. The question category q_class is generated by the large language model and is used to map parent categories and compatible categories. The category label is a higher-level abstraction of the task intent. III. Constraint context ctx includes session time, domain ID, permissions, and data version, which are used to limit whether the cache can be reliably reused; Serialize the constraint context (ctx) and perform deterministic hash calculation. As a stable index, when generating the issue signature, a unique primary key QID is generated by combining (q_vec, q_class, ctx_hash). The QID will be used as the primary key when retrieving and writing in the issue-result level cache, and will be used for subsequent multi-level cache retrieval, constraint and reuse judgment.

2. The method according to claim 1, characterized in that, In step 2, the question-result level is directly reused at the final answer level, and the process is as follows: The issue signature will enter the cache matching stage. First, all candidate q_class_i that are compatible with the current issue category q_class are retrieved from the cache. The semantic similarity between q_vec_i and q_vec of the corresponding entry in the candidate cache is calculated. If the similarity is greater than the threshold, the context consistency ctx_i is further checked. If the context does not conflict, reuse is allowed. If there are multiple candidates, the one with the latest execution time and the highest feedback score is selected as the result and returned.

3. The method of claim 2, wherein, Step 3 includes: When the cache at the problem-result level is not hit, the strategy planning phase begins. First, it attempts to reuse the previously successful tool strategy path. The strategy cache is organized by problem category `q_class` as the parent key, with multiple historical strategy entries maintained under each problem category. When a problem category identical to the natural language problem exists in the strategy planning cache, it compares a set of tool strategy schemes maintained under the current problem category. First, it checks the `status` and `scene_scope` fields to determine if the historical tool strategy is available and if the scene is compatible. Second, it performs tool version verification to ensure that the tools in the historical tool strategy are the same as those in the tool documentation. If all verifications pass, the historical tool strategy is reused; at this point, the agent does not need to replan the tool name list `tool_set` and the tool execution order template `Plan`. If the relevant record is not hit in the current strategy planning cache, the agent will plan and generate a new strategy based on the natural language problem and the tool documentation.

4. The method of claim 3, wherein, Step 4 includes: Receive the structured execution plan returned during the strategy planning phase, which includes: (a) a list of selected tool names tool_set; (b) a tool execution order template Plan; (c) the parameter fields required by each tool and the corresponding set of parameter values; when the cache is hit, read the historical tool execution result result from the cache and skip the actual call or network request process of the current historical tool.

5. The method of claim 4, wherein, Step 5 includes: After an agent completes a task, it enters the cache update phase based on the execution result, which includes problem-result level cache update, strategy planning cache update, and tool call level cache update. Question-result level cache update: First, calculate the unique primary key QID based on the semantic representation q_vec of the task input, the question category q_class, and the constraint context ctx, and write the final answer generated by the current agent into the question-result level cache; if the current task directly returns the result through a hit in the question-result level cache, only update the current write time timestamp and the system score or user feedback_score. Policy planning cache update: In the current task, when the tool invocation policy comes from the policy-level cache or is re-planned and generated by the agent, the system will update the policy cache based on the execution effect. If a historical tool policy is used and the execution effect is good, the score of the current historical tool policy will be increased and its most recent usage time will be updated. If a historical tool policy is used but the agent modifies its structure multiple times, the score of the current historical tool policy will be decreased, and its reuse priority will be reduced in subsequent tasks. If the current tool invocation policy is a new policy generated by the agent, the system will create a new policy entry according to the problem category q_class corresponding to the primary key QID and write it into the cache for quick reuse of similar problems in the future. Tool call-level cache update: After completing the tool call strategy planning, the agent enters the tool execution and parameter-level cache comparison stage; after obtaining the execution result result, in the current inference chain, the execution result result is input into the agent as the return value of the current tool call to continue to complete subsequent inferences or result fusion; after reading, the hit count field hit_count in the cache entry is immediately updated to hit_count + 1; at the same time, adjust the time-to-live TTL of the current cache entry: if it is a high-frequency call item, extend the validity period based on the original TTL; when the cache misses, trigger the real tool execution process, through the LangChain tool scheduling interface, call the target tool and pass in the parameters generated by the agent for execution; if the tool execution is successful, write the tool name, parameter key-value pair, tool execution result, call timestamp, and default TTL information corresponding to the question category of the current call as a new cache entry into the cache library; if <tool_name="exchange_rate_api", parameters are the same> is called again and it is still valid within the TTL, directly reuse the execution result result, skip the tool execution, and update hit_count.

Citation Information

Patent Citations

  • MPC cache updating method and system based on multiple agents

    CN116521584A

  • Intelligent agent-based big language model retrieval enhancement generation system and method

    CN120470088A