A cache-based agent function call acceleration method

CN122593879APending Publication Date: 2026-08-18QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611073172.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0003]现有缓存机制通常以函数调用结果为主要存储对象,部分系统虽会缓存检索过程中的中间信息,但整体上缺乏对不同请求类型的有效区分和组织,导致低复用价值数据占用存储空间,而高复用价值的历史信息未能得到充分利用,从而降低缓存利用率并增加函数检索开销

Benefits of technology

[0061]1、本发明通过对函数类别信息、候选函数集合、参数结构模板及函数调用结果进行分层缓存管理,并根据缓存层级执行差异化复用,使系统能够减少重复函数检索、参数构造及函数调用过程中的计算开销,提高函数调用响应速度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122593879A_ABST
    Figure CN122593879A_ABST
Patent Text Reader

Abstract

The application relates to a cache-based intelligent agent function call acceleration method, and belongs to the field of artificial intelligence, which comprises the following steps: analyzing and extracting the task intention and explicit features of a current request from a request content; performing task state association determination to obtain a state association confidence score; reading a cache entry related to the current request, and performing hierarchical cache reuse decision; performing cache write-in determination on a call result, and further determining whether the call result meets the cache write-in condition, and writing in when the condition is met; and dynamically updating, reevaluating and cleaning the cache entry. Through the construction of a hierarchical cache structure, the application performs hierarchical caching and reuse on the category information, candidate function set, parameter structure information and final call result in the function call process, and combines the request association determination, cache dynamic updating and cache cleaning mechanism to manage and schedule the cache content, so that the computing overhead caused by repeated function retrieval and function call is reduced, and the function call response efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a cache-based method for accelerating intelligent agent function calls, belonging to the field of artificial intelligence technology. Background Technology

[0002] With the widespread application of intelligent agent technology in areas such as government services, enterprise service consulting, and customer service, the scale of the function libraries accessed by intelligent agents is constantly expanding, and the function call process is becoming increasingly complex. In the scenario of intelligent assistants for government services, users typically initiate a series of related requests related to the same business matter, such as policy consultation, material inquiry, and processing progress inquiry. The intelligent agent needs to select the appropriate target function from a large number of external tool functions to complete the task processing. As the scale of the function library expands and the application scenarios become more complex, issues related to function retrieval efficiency and resource utilization are gradually emerging.

[0003] Existing caching mechanisms typically store function call results as the primary storage object. While some systems cache intermediate information during the retrieval process, they generally lack effective differentiation and organization of different request types. This results in low-reusability data occupying storage space, while high-reusability historical information is not fully utilized, thus reducing cache utilization and increasing function retrieval overhead. In multi-turn interaction scenarios, information generated during historical function calls is also difficult to reuse effectively, often requiring repeated execution of the retrieval process, further increasing computational overhead and impacting system response speed.

[0004] Furthermore, existing mechanisms still have shortcomings in adaptability as function libraries are updated and user request semantics change. When a function is added or deprecated, existing cached content may become out of sync with the actual usability of the current function library. When the function schema changes, existing mechanisms often lack effective consistency checks, leading to inconsistencies between existing cached content and the updated function schema, resulting in invalid retrieval, function call failures, or abnormal results. When user requests change, it is difficult to promptly identify changes in the relevance between the current request and historical cached content, potentially leading to function retrieval and matching based on historical caches, resulting in results deviating from current requirements. On the other hand, existing caching mechanisms do not adequately utilize the information generated during the retrieval process, making it difficult for relevant cached content to remain applicable after function updates or semantic changes, further reducing cache effectiveness.

[0005] Therefore, under the above application context, how to achieve efficient reuse of cached data and reduce the overhead of repeated calculations in the function retrieval process while ensuring the accuracy of function calls, thereby improving system response efficiency, has become an urgent technical problem to be solved. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a cache-based method for accelerating intelligent agent function calls. By constructing a hierarchical cache structure, the method caches and reuses category information, candidate function sets, parameter structure information, and final call results during the function call process. Combined with request association determination, dynamic cache update, and cache cleanup mechanisms, the method manages and schedules cached content, thereby reducing the computational overhead caused by repeated function retrieval and function calls, and improving function call response efficiency.

[0007] The present invention adopts the following technical solution:

[0008] A cache-based method for accelerating intelligent agent function calls includes the following steps:

[0009] S1, after the processor receives the function call request input by the user, it performs semantic and structural parsing on the instruction sequence of the request content, and extracts the task intent of the current request and explicit features representing the continuity of interaction.

[0010] S2, perform task status association determination between the current function call request and historical interaction records, including explicit feature determination and implicit feature matching, to obtain the status association confidence score;

[0011] S3, the processor reads the cache entry related to the current request and performs a hierarchical cache reuse decision: when the state association confidence score is higher than the preset threshold, the cache entry passes the version comparison and compatibility judgment and the cache is in a valid state, the corresponding cache entry is determined to meet the reuse conditions; otherwise, the reuse conditions are not met.

[0012] If the reuse condition is met, a cache hit occurs, and the corresponding cache level of the hierarchical cache structure is selected based on the current request and the results of historical calls to perform the reuse operation; if the reuse condition is not met, a cache miss occurs, and the original function retrieval and function call process is executed to obtain the call result.

[0013] S4, perform cache write judgment on the call result. If the function call is successful and the return result is valid, the processor further judges whether the call result meets the cache write condition. If it does, write the cache entry.

[0014] S5, the processor dynamically updates, re-evaluates, and cleans up cache entries.

[0015] Preferably, in step S2, in a multi-round interaction scenario, the degree of association between the current function call request and the historical interaction record is judged by combining explicit feature judgment and implicit feature matching. Explicit features include pronouns, operation continuation expressions, and parameter inheritance information, such as continuous interaction expressions like "check again" and "change one". When an explicit feature is detected, it is determined that the current request depends on the previous round of interaction state, and the request is marked as a candidate associated request for subsequent association matching processing.

[0016] Preferably, in step S2, the implicit feature matching process is as follows:

[0017] Semantic encoding is performed on the current function call request and historical interaction records (semantic encoding can be performed by a large language model) to generate corresponding high-dimensional semantic feature vectors, and cosine similarity is calculated as follows:

[0018]

[0019] In the formula, Represents cosine similarity. This represents the semantic feature vector of the current function call request; A semantic feature vector representing historical interaction records; express The second norm; express The second norm;

[0020] State-related confidence score The calculation formula is as follows:

[0021] .

[0022] State-related confidence score for The interval is used to measure the semantic correlation between the current request and historical interaction records. When the state correlation confidence score is higher than a preset threshold (e.g., it can be set to 0.8), it is determined that the current request can reuse the historical call cache, and the cache read and reuse operation is triggered. At the same time, the score is written to memory as a control signal for subsequent cache expiration adjustment mechanism.

[0023] Preferably, to improve cache reuse efficiency and reduce redundant retrieval overhead, a hierarchical cache structure is constructed. This structure divides cached content into three levels, storing different types of function call information in each level to support cache reuse and management for different request scenarios. The three levels include:

[0024] L1 layer: Used to cache function categories, such as "service type" and "progress query type", as filtering conditions before function retrieval. During function calls, the category identifiers in the L1 layer cache can be used to narrow down the range of candidate functions, reducing the participation of irrelevant functions in the matching, thereby reducing the computational overhead of subsequent retrieval;

[0025] L2 layer: used to cache candidate functions and parameter structure templates. Candidate functions are a set of functions to be called formed during the historical function call process. The parameter structure template is a structured abstract representation of the parameters of historical function calls, containing fixed parameter items and variable parameter slots. It is used to quickly fill function call parameters in similar request scenarios and reduce the overhead of repeated function retrieval and parameter organization.

[0026] L3 layer: used to cache the final call information, including the function name, complete parameters and function call result. When the cache reuse condition is met, the call result can be directly read from the L3 layer cache and returned, thereby avoiding repeated execution of the function call process.

[0027] Preferably, in step S3, the preset threshold for the state association confidence score is 0.8;

[0028] Each cached entry records a corresponding function schema version identifier upon writing, used to identify the function parameter structure and return structure status that the cached entry depends on (e.g., v20260516.1). The version identifier is stored as an attribute field of the cached entry along with the cached data. During cached entry generation, the processor calls the large language model module to parse and structure the function call request and its execution result, generating a unified representation of the parameter structure and return structure, and storing it in association with the corresponding version identifier. When a function schema definition is added, deleted, or its parameter structure changes, the corresponding function schema version identifier is automatically updated. When accessing a cached entry, the version identifier in the cached entry is compared with the version identifier corresponding to the current function schema definition to identify cached entries with inconsistent versions, triggering compatibility checks or cache invalidation processing, thereby avoiding call anomalies or data errors caused by mismatched parameter or return structures.

[0029] Each cached entry also records management attributes such as version identifier, access hit count, and cache expiration period. When the function schema definition is updated, a compatibility check is performed on the cached entry, and it is categorized into three types: Valid (completely matched), Compatible (backward compatible), and Invalid (structural invalid). Valid (completely matched) indicates that the function schema definitions are completely identical. In this case, the processor reads the function schema definition corresponding to the cached entry and the current function schema definition, and performs validation by comparing the function name, parameter name, parameter type, parameter constraints, and return structure. If there are no differences in the above, the function schema definitions are considered completely identical. Compatible (backward compatible) indicates that the function schema definition has undergone non-destructive expansion (such as adding optional fields or expanding the return structure). Invalid (structural invalid) indicates that the parameter structure or return structure has undergone destructive changes (such as adding or deleting required parameters, changing type names, etc.). The compatibility check is based on the differences in the function schema definition, including changes in parameter definitions and return structures, as shown in Table 1.

[0030] Table 1. Compatibility Assessment Results (Illustrated)

[0031]

[0032] When a function structure definition changes, the processor updates the version identifier of the corresponding function structure definition. When the processor reads a cache entry, it performs a version comparison and compatibility check based on the version identifier bound to the cache entry and the version identifier of the current function structure definition. Based on the check result, it performs marking, invalidation, or migration operations on the cache entry to maintain the matching relationship between the cached data and the current function structure definition. At the same time, based on the compatibility check result, it performs consistency checks on cache access requests. For requests determined to be invalid, it triggers corresponding interception and cache invalidation processing, thereby reducing the risk of inconsistency in calls caused by changes in function structure and improving the stability of the system during operation.

[0033] The processor reads the function structure definition corresponding to the cache entry and the current function structure definition and compares them. When the function name, parameter name, parameter type, parameter constraints and return structure are all the same, it is determined to be a complete match. When the function structure only has non-destructive changes such as adding optional parameters or extending the return structure, it is determined to be backward compatible. Both complete match and backward compatibility are considered to have passed the compatibility test.

[0034] Furthermore, to address the impact of changes in function call requests and time-sensitive data on cache availability, the validity period and residency time of cache entries are dynamically managed based on task status-related confidence scores and cache content types. Here, the validity period of a cache entry represents the initially set time expiration range, and the residency time represents the actual retention duration of the cache entry.

[0035] Cache entries are categorized into two types: data-based cache entries and structured cache entries, each employing differentiated expiration management methods. Data-based caches correspond to results returned by external data sources; their content expires over time and is related to the state of the external data source. This type of cache uses an independent update mechanism based on time expiration and does not participate in dynamic adjustment of residency time based on state-related confidence scores. The expiration time of data-based cache entries is set in tiers based on data update frequency and does not participate in dynamic adjustment based on state-related confidence scores. The validity period of the data is dynamically adjusted, still expiring according to its own validity period: for data with high update frequency and strong real-time requirements (such as the application material review status), the validity period is set to a short cycle; for data that remains stable within a certain time range but may still change, the validity period is set to a medium cycle; for historical data with low change frequency and strong stability, the validity period is set to a long cycle; the short cycle is in the minute range, such as 15 minutes, the medium cycle is in the hour range, such as 6 hours, and the long cycle is in the day range, such as 1 day (24 hours).

[0036] Structured cache entries correspond to intermediate decision results or structured information generated during task processing, including function selection results, candidate function sets, and parameter structures, and have high reusability. A "base validity period + dynamic adjustment" approach is used for residency management. The base validity period for structured cache entries is set as follows: 12 hours for determined target function information; 24 hours for structured information such as function categories and candidate function sets; and 48 hours for historical parameter structure information and parameter structure templates. When the conditions are met... When the validity period (i.e., the duration of stay) is extended to three times the basic validity period but not exceeding the preset validity period limit; when the conditions are met... When this occurs, a restricted validity period extension strategy is implemented, extending the validity period (i.e., residency period) to twice the base validity period, in order to improve reuse efficiency while controlling underlying storage overhead; when the conditions are met... If the validity period is not extended, the basic validity period will be used as the final validity period. The corresponding cached entries will maintain their original residency time and will be automatically cleared by the cache cleanup mechanism after expiration.

[0037] A cached entry is considered valid if it is within its validity period.

[0038] Preferably, in step S3, when the current request is consistent with the result of the historical call, it is preferentially entered into the L3 layer for reuse; when the current request is partially related to the result of the historical call, but the candidate function or parameter template still needs to be adjusted, the L1 layer or L2 layer is preferentially reused.

[0039] Preferably, in step S4, to avoid invalid cache occupying storage resources, the cache write condition is determined to be met when the following conditions are met simultaneously:

[0040] ① The cached content does not contain sensitive information or has been de-identified. Sensitive information refers to user identity information, account information, contact information, and other data that needs to be protected by law.

[0041] ② The cached content has reuse value. It is determined to have reuse value when the cached content meets at least one of the following criteria: stability, timeliness, or relevance.

[0042] Stability refers to cached content with definite results and low change frequency, such as mathematical calculations and service guide queries. The returned results can be reused and can be used as cached objects. Timeliness refers to cached content with results that change dynamically over time, such as application processing progress queries and government announcement queries. Its reuse value is constrained by the data update frequency and change cycle, and the cache validity period needs to be determined based on the data change characteristics. Relevance refers to cached content that depends on the current interaction state or historical session context, such as depending on previous query results or continuous operation instructions. Its reuse value depends on the continuity of the task state and needs to be determined as reusable when the relevance judgment condition is met.

[0043] Preferably, in step S4, when writing cache entries, the cache write and update operations of L1 layer and L2 layer are triggered first: the function category information is written to the L1 layer cache, the candidate function set and parameter structure template are written to the L2 layer cache, and based on the historical parameter structure template, only the changed parameter fields corresponding to the current request are partially updated, while the unchanged parameter fields are retained.

[0044] Partial parameter updates refer to updating only the changed parameter fields corresponding to the current request, while retaining the unchanged parameter fields, based on reusing the historical parameter structure template. For example, a historical request might be "Query Jinan Housing Provident Fund Loan Policy," with a corresponding parameter structure including {Business Type = Provident Fund Loan, Region = Jinan}. When the current request changes to "Query Qingdao Housing Provident Fund Loan Policy," only the parameter value of the "Region" field is updated from "Jinan" to "Qingdao," while "Business Type = Provident Fund Loan" remains unchanged.

[0045] By using the above writing and updating methods, subsequent similar requests can directly utilize the cached function category information, candidate function set, and parameter structure template, thereby reducing the overhead of repeated calculations in the function retrieval and parameter organization process.

[0046] Preferably, in step S5, to unify the sorting and scheduling process of cache entries, the overall cache priority is calculated based on the state association confidence score, access hit count, and time decay coefficient, as shown in the following formula:

[0047]

[0048] In the formula, Prioritize cache overall settings; This represents the number of times a corresponding cache entry is accessed within a preset time window; The time interval between the current time and the last time this cached entry was read; This is the time decay factor, used to control the decay rate of cache entries; , , These are the weighting coefficients for the state association confidence score, the number of visits, and the time interval, respectively, satisfying... ;coefficient The value range can be set to respectively. , and , The range of values ​​can be set to .

[0049] The processor prioritizes structured cache entries based on overall cache priority and performs access control, update scheduling, and invalidation operations. The cached content corresponding to each entry includes function call results, a set of candidate functions, and function category information. Each cache entry also records management attributes such as version identifier, access hit count, and cache expiration time. Specifically, during cache matching, higher-priority cache entries are selected first; during cache updates, high-priority entries are retained first; and lower-priority cache entries are invalidated or removed. For data-type cache entries, the relevant judgment results are only used to trigger cache updates or invalidation control and do not participate in the dynamic adjustment of residency time based on state-related confidence scores.

[0050] The processor performs a re-evaluation of cache entries in memory at a preset cycle. This includes recalculating the cache entry hit count, updating the time interval since the last access, and recalculating the overall cache priority based on the current recorded state and associated confidence score to reflect the actual reuse value of the cache entries in the current operating state. The processor reorders the cache entries based on the updated overall cache priority. During cache access, cache entries with higher overall cache priority are selected first; during cache cleanup, cache entries with lower overall cache priority are deleted first. The overall cache priority indicates the resident priority order of cache entries in the current operating state.

[0051] When the total number of cache entries in the cache storage area exceeds a preset capacity threshold Time (e.g.) (Can be set to 10000) to trigger the cleanup process, deleting at a preset ratio. (For example, it can be set to 0.1).

[0052] To minimize the impact of deletion operations on high-priority cache entries, a layered cleanup approach is adopted: first, L3 layer cache entries are deleted from lowest to highest overall cache priority; if L3 layer cleanup still fails to meet capacity constraints, L2 layer cache entries are then deleted; if L2 layer cleanup still fails to meet capacity constraints, L1 layer cache entries are further deleted. Cache entries at each layer maintain only logical relationships, without establishing strong dependencies; when a lower-level cache entry is deleted, the corresponding upper-level cache entry can be updated or invalidated during subsequent accesses through version verification or consistency checks to avoid reusing invalid cache entries.

[0053] Cache entries at each level are stored in a unified storage space, without independent capacity quotas. Cache entries are sorted and deleted based on cache priority to ensure that the total cache size does not exceed the capacity threshold. The cleanup process can be repeated until the total cache size meets the capacity threshold constraint.

[0054] Preferably, for the most recent time window For frequently accessed cache entries, the processor can dynamically enhance the cache priority based on the number of access hits, thereby increasing the resident priority of the corresponding cache entries and reducing the probability of them being evicted. When a cache entry is within a preset time window... The number of access hits within the scope reached the threshold. Time (e.g., configurable) Hour, (times), in the current overall cache priority Adding a gain term on top of the existing terms The updated cache overall priority is obtained. :

[0055]

[0056] Among them, the gain term For configurable parameters (e.g., can be set to) This is used to reflect the short-term access activity level of cached entries; This indicates the upper limit of the overall cache priority, which can be configured according to actual needs (for example, it can be set to 1.0).

[0057] This mechanism performs local priority enhancement on frequently accessed entries without changing the original priority calculation structure, thereby improving cache reuse efficiency and optimizing cache cleanup strategies.

[0058] The above capacity threshold Time window Threshold for the number of access hits Gain Term Cache overall priority limit The relevant weight parameters can be written to the parameter configuration area in memory by the processor during the initialization phase or during operation, and called during cache management to participate in the calculation and judgment of the corresponding control logic. The above parameters can be adjusted according to the storage capacity, function call scale, and read / write load to adapt to the cache management needs of different scenarios.

[0059] For any details not covered in this invention, please refer to the prior art.

[0060] The beneficial effects of this invention are as follows:

[0061] 1. This invention manages function category information, candidate function sets, parameter structure templates, and function call results through hierarchical caching, and performs differentiated reuse according to the cache level. This enables the system to reduce the computational overhead of repeated function retrieval, parameter construction, and function call processes, thereby improving the function call response speed.

[0062] 2. This invention introduces a task status association determination mechanism. By analyzing the association between the current request and historical interaction records, it realizes dynamic reuse of associated cached content and local parameter updates, reduces repetitive processing in similar request scenarios, and improves the execution efficiency of continuous interaction tasks.

[0063] 3. This invention employs a reuse value determination, priority evaluation, and dynamic cleanup mechanism to selectively write, retain, and evict cached data, prioritizing storage resources for high-value content and improving storage space utilization. Simultaneously, by filtering reuse value before writing, it reduces low-value cache, lowers the risk of cache pollution, reduces invalid matches and storage access overhead, and decreases the amount of data maintained by the cache, reducing computational load and improving cache retrieval efficiency and system response speed.

[0064] 4. This invention achieves synchronous management of cached content and function structure definition through version binding and compatibility judgment mechanism of cached entry function structure definition, reducing the risk of cache failure, call anomalies and erroneous reuse caused by adding, deleting or changing functions or schema.

[0065] 5. This invention adopts differentiated retention and invalidation strategies for different types of cached content, which improves the cache hit rate while ensuring the validity and accuracy of cached data, thereby enhancing the overall stability of the system.

[0066] 6. This invention incorporates a sensitive information filtering mechanism during the cache writing stage, which prevents the caching of data that needs to be protected by law, such as identity information, account information, and contact information, or desensitizes the data before processing. This improves cache reuse efficiency while reducing the risks associated with the long-term retention of sensitive information, thereby enhancing the system's operational reliability and application applicability in highly constrained scenarios such as government services. Attached Figure Description

[0067] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.

[0068] Figure 1 This is an overall architecture diagram of the cache-based intelligent agent function call acceleration method of the present invention. Detailed Implementation

[0069] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. However, this is not the only description; all aspects not described in detail herein are based on conventional techniques in the art.

[0070] Example 1

[0071] A cache-based method for accelerating intelligent agent function calls, such as... Figure 1 As shown, it includes the following steps:

[0072] S1, after the processor receives the function call request input by the user, it performs semantic and structural parsing on the instruction sequence of the request content, and extracts the task intent of the current request and explicit features representing the continuity of interaction.

[0073] S2, perform task status association determination between the current function call request and historical interaction records, including explicit feature determination and implicit feature matching, to obtain the status association confidence score;

[0074] S3, the processor reads the cache entry related to the current request and performs a hierarchical cache reuse decision: when the state association confidence score is higher than the preset threshold, the cache entry passes the version comparison and compatibility judgment and the cache is in a valid state, the corresponding cache entry is determined to meet the reuse conditions; otherwise, the reuse conditions are not met.

[0075] If the reuse condition is met, a cache hit occurs, and the corresponding cache level of the hierarchical cache structure is selected based on the current request and the results of historical calls to perform the reuse operation; if the reuse condition is not met, a cache miss occurs, and the original function retrieval and function call process is executed to obtain the call result.

[0076] S4, perform cache write judgment on the call result. If the function call is successful and the return result is valid, the processor further judges whether the call result meets the cache write condition. If it does, write the cache entry.

[0077] S5, the processor dynamically updates, re-evaluates, and cleans up cache entries.

[0078] Example 2

[0079] A cache-based method for accelerating intelligent agent function calls, as described in Example 1, differs in that, in step S2, in a multi-round interaction scenario, the degree of association between the current function call request and historical interaction records is determined by combining explicit feature judgment and implicit feature matching. Explicit features include pronouns, operation continuation expressions, and parameter inheritance information, such as continuous interaction expressions like "check again" and "change one". When an explicit feature is detected, it is determined that the current request depends on the previous round of interaction state, and the request is marked as a candidate associated request for subsequent association matching processing.

[0080] The process of implicit feature matching is as follows:

[0081] Semantic encoding is performed on the current function call request and historical interaction records (semantic encoding can be performed by a large language model) to generate corresponding high-dimensional semantic feature vectors, and cosine similarity is calculated as follows:

[0082]

[0083] In the formula, Represents cosine similarity. This represents the semantic feature vector of the current function call request; A semantic feature vector representing historical interaction records; express The second norm; express The second norm;

[0084] State-related confidence score The calculation formula is as follows:

[0085] .

[0086] State-related confidence score for The interval is used to measure the semantic correlation between the current request and historical interaction records. When the state correlation confidence score is higher than a preset threshold (e.g., it can be set to 0.8), it is determined that the current request can reuse the historical call cache, and the cache read and reuse operation is triggered. At the same time, the score is written to memory as a control signal for subsequent cache expiration adjustment mechanism.

[0087] Example 3

[0088] A cache-based method for accelerating intelligent agent function calls, as described in Example 2, differs in that, to improve cache reuse efficiency and reduce redundant retrieval overhead, a hierarchical cache structure is constructed. This hierarchical cache structure divides cached content into three levels, storing different types of function call information in each level to support cache reuse and management for different request scenarios. The three levels include:

[0089] L1 layer: Used to cache function categories, such as "service type" and "progress query type", as filtering conditions before function retrieval. During function calls, the category identifiers in the L1 layer cache can be used to narrow down the range of candidate functions, reducing the participation of irrelevant functions in the matching, thereby reducing the computational overhead of subsequent retrieval;

[0090] L2 layer: used to cache candidate functions and parameter structure templates. Candidate functions are a set of functions to be called formed during the historical function call process. The parameter structure template is a structured abstract representation of the parameters of historical function calls, containing fixed parameter items and variable parameter slots. It is used to quickly fill function call parameters in similar request scenarios and reduce the overhead of repeated function retrieval and parameter organization.

[0091] L3 layer: used to cache the final call information, including the function name, complete parameters and function call result. When the cache reuse condition is met, the call result can be directly read from the L3 layer cache and returned, thereby avoiding repeated execution of the function call process.

[0092] In step S3, the preset threshold for the state association confidence score is 0.8;

[0093] Each cached entry records the version identifier of its corresponding function schema upon writing, used to identify the function parameter structure and return structure status that the cached entry depends on (e.g., v20260516.1). The version identifier is stored as an attribute field of the cached entry along with the cached data. During cached entry generation, the processor calls the large language model module to parse and structure the function call request and its execution result, generating a unified representation of the parameter structure and return structure, and storing it in association with the corresponding version identifier. When a function schema definition is added, deleted, or its parameter structure changes, the version identifier of the corresponding function schema definition is automatically updated. When accessing a cached entry, the version identifier in the cached entry is compared with the version identifier corresponding to the current function schema definition to identify cached entries with inconsistent versions, triggering compatibility checks or cache invalidation processing, thereby avoiding call anomalies or data errors caused by mismatched parameter or return structures.

[0094] Each cached entry also records management attributes such as version identifier, access hit count, and cache expiration period. When the function schema definition is updated, a compatibility check is performed on the cached entry, and it is categorized into three types: Valid (completely matched), Compatible (backward compatible), and Invalid (structural invalid). Valid (completely matched) indicates that the function schema definitions are completely identical. In this case, the processor reads the function schema definition corresponding to the cached entry and the current function schema definition, and performs validation by comparing the function name, parameter name, parameter type, parameter constraints, and return structure. If there are no differences in the above, the function schema definitions are considered completely identical. Compatible (backward compatible) indicates that the function schema definition has undergone non-destructive expansion (such as adding optional fields or expanding the return structure). Invalid (structural invalid) indicates that the parameter structure or return structure has undergone destructive changes (such as adding or deleting required parameters, changing type names, etc.). The compatibility check is based on the differences in the function schema definition, including changes in parameter definitions and return structures, as shown in Table 1.

[0095] Table 1. Compatibility Assessment Results (Illustrated)

[0096]

[0097] When a function structure definition changes, the processor updates the version identifier of the corresponding function structure definition. When the processor reads a cache entry, it performs a version comparison and compatibility check based on the version identifier bound to the cache entry and the version identifier of the current function structure definition. Based on the check result, it performs marking, invalidation, or migration operations on the cache entry to maintain the matching relationship between the cached data and the current function structure definition. At the same time, based on the compatibility check result, it performs consistency checks on cache access requests. For requests determined to be invalid, it triggers corresponding interception and cache invalidation processing, thereby reducing the risk of inconsistency in calls caused by changes in function structure and improving the stability of the system during operation.

[0098] The processor reads the function structure definition corresponding to the cache entry and the current function structure definition and compares them. When the function name, parameter name, parameter type, parameter constraints and return structure are all the same, it is determined to be a complete match. When the function structure only has non-destructive changes such as adding optional parameters or extending the return structure, it is determined to be backward compatible. Both complete match and backward compatibility are considered to have passed the compatibility test.

[0099] Example 4

[0100] A cache-based method for accelerating intelligent agent function calls, as described in Example 3, differs in that, to address the impact of changes in function call requests and time-sensitive data on cache availability, the validity period and residency time of cache entries are dynamically managed based on task state-related confidence scores and cache content types. Here, the validity period of a cache entry represents the initially set time expiration range, and the residency time represents the actual retention duration of the cache entry.

[0101] Cache entries are categorized into two types: data-based cache entries and structured cache entries, each employing differentiated expiration management methods. Data-based caches correspond to results returned by external data sources; their content expires over time and is related to the state of the external data source. This type of cache uses an independent update mechanism based on time expiration and does not participate in dynamic adjustment of residency time based on state-related confidence scores. The expiration time of data-based cache entries is set in tiers based on data update frequency and does not participate in dynamic adjustment based on state-related confidence scores. The validity period of the data is dynamically adjusted, still expiring according to its own validity period: for data with high update frequency and strong real-time requirements (such as the application material review status), the validity period is set to a short cycle; for data that remains stable within a certain time range but may still change, the validity period is set to a medium cycle; for historical data with low change frequency and strong stability, the validity period is set to a long cycle; the short cycle is in the minute range, such as 15 minutes, the medium cycle is in the hour range, such as 6 hours, and the long cycle is in the day range, such as 1 day (24 hours).

[0102] Structured cache entries correspond to intermediate decision results or structured information generated during task processing, including function selection results, candidate function sets, and parameter structures, and have high reusability. A "base validity period + dynamic adjustment" approach is used for residency management. The base validity period for structured cache entries is set as follows: 12 hours for determined target function information; 24 hours for structured information such as function categories and candidate function sets; and 48 hours for historical parameter structure information and parameter structure templates. When the conditions are met... When the validity period (i.e., the duration of stay) is extended to three times the basic validity period but not exceeding the preset validity period limit; when the conditions are met... When this occurs, a restricted validity period extension strategy is implemented, extending the validity period (i.e., residency period) to twice the base validity period, in order to improve reuse efficiency while controlling underlying storage overhead; when the conditions are met... If the validity period is not extended, the basic validity period will be used as the final validity period, the corresponding cached entries will maintain their original residency time, and the cache cleanup mechanism will automatically clear them after they expire.

[0103] A cached entry is considered valid if it is within its validity period.

[0104] In step S3, if the current request is consistent with the result of the historical call, it will be reused in the L3 layer first; if the current request is partially related to the result of the historical call, but the candidate function or parameter template still needs to be adjusted, the L1 or L2 layer will be reused first.

[0105] Example 5

[0106] A cache-based method for accelerating intelligent agent function calls, as described in Example 4, differs in that, in step S4, to avoid invalid cache occupying storage resources, the cache write condition is determined to be met when the following conditions are simultaneously satisfied:

[0107] ① The cached content does not contain sensitive information or has been de-identified. Sensitive information refers to user identity information, account information, contact information, and other data that needs to be protected by law.

[0108] ② The cached content has reuse value. It is determined to have reuse value when the cached content meets at least one of the following criteria: stability, timeliness, or relevance.

[0109] Stability refers to cached content with definite results and low change frequency, such as mathematical calculations and service guide queries. The returned results can be reused and can be used as cached objects. Timeliness refers to cached content with results that change dynamically over time, such as application processing progress queries and government announcement queries. Its reuse value is constrained by the data update frequency and change cycle, and the cache validity period needs to be determined based on the data change characteristics. Relevance refers to cached content that depends on the current interaction state or historical session context, such as depending on previous query results or continuous operation instructions. Its reuse value depends on the continuity of the task state and needs to be determined as reusable when the relevance judgment condition is met.

[0110] Example 6

[0111] A cache-based method for accelerating intelligent agent function calls, as described in Example 5, differs in that, in step S4, when writing cache entries, the cache write and update operations of L1 and L2 layers are triggered first: the function category information is written to the L1 layer cache, the candidate function set and parameter structure template are written to the L2 layer cache, and based on the historical parameter structure template, only the changed parameter fields corresponding to the current request are partially updated, while the unchanged parameter fields are retained.

[0112] Partial parameter updates refer to updating only the changed parameter fields corresponding to the current request, while retaining the unchanged parameter fields, based on reusing the historical parameter structure template. For example, a historical request might be "Query Jinan Housing Provident Fund Loan Policy," with a corresponding parameter structure including {Business Type = Provident Fund Loan, Region = Jinan}. When the current request changes to "Query Qingdao Housing Provident Fund Loan Policy," only the parameter value of the "Region" field is updated from "Jinan" to "Qingdao," while "Business Type = Provident Fund Loan" remains unchanged.

[0113] By using the above writing and updating methods, subsequent similar requests can directly utilize the cached function category information, candidate function set, and parameter structure template, thereby reducing the overhead of repeated calculations in the function retrieval and parameter organization process.

[0114] Example 7

[0115] A cache-based method for accelerating intelligent agent function calls, as described in Example 6, differs in that, in step S5, to unify the sorting and scheduling process of cache entries, a comprehensive cache priority is calculated based on state association confidence score, access hit count, and time decay coefficient, as shown in the following formula:

[0116]

[0117] In the formula, Prioritize cache overall settings; This represents the number of times a corresponding cache entry is accessed within a preset time window; The time interval between the current time and the last time this cached entry was read; This is the time decay factor, used to control the decay rate of cache entries; , , These are the weighting coefficients for the state association confidence score, the number of visits, and the time interval, respectively, satisfying... ;

[0118] In this embodiment, The values ​​are 0.5, 0.3, and 0.2 respectively. The value is 0.1.

[0119] The processor prioritizes structured cache entries based on overall cache priority and performs access control, update scheduling, and invalidation operations. The cached content corresponding to each entry includes function call results, a set of candidate functions, and function category information. Each cache entry also records management attributes such as version identifier, access hit count, and cache expiration time. Specifically, during cache matching, higher-priority cache entries are selected first; during cache updates, high-priority entries are retained first; and lower-priority cache entries are invalidated or removed. For data-type cache entries, the relevant judgment results are only used to trigger cache updates or invalidation control and do not participate in the dynamic adjustment of residency time based on state-related confidence scores.

[0120] The processor performs a re-evaluation of cache entries in memory according to a preset cycle. This includes recalculating the cache entry hit count, updating the time interval since the last access, and recalculating the overall cache priority based on the currently recorded state-related confidence score to reflect the actual reuse value of the cache entry in the current running state. The processor reorders the cache entries based on the updated overall cache priority. During cache access, cache entries with higher overall cache priority are selected first; during cache cleanup, cache entries with lower overall cache priority are deleted first. The overall cache priority represents the resident priority of cache entries in the current running state, and its calculation is based on the state-related confidence score, cache hit count, and time decay factor. Specifically, a hit in a function call result cache entry indicates that the corresponding call result is directly reused; a hit in a candidate function set or function category cache entry indicates that the corresponding cache entry was accessed and participated in the calculation during function retrieval or matching. The sorting result is used to determine the deletion order during cache access control, cache updates, and cache cleanup.

[0121] When the total number of cache entries in the cache storage area exceeds a preset capacity threshold Time (e.g.) (Can be set to 10000) to trigger the cleanup process, deleting at a preset ratio. (For example, it can be set to 0.1).

[0122] To minimize the impact of deletion operations on high-priority cache entries, a layered cleanup approach is adopted: first, L3 layer cache entries are deleted from lowest to highest overall cache priority; if L3 layer cleanup still fails to meet capacity constraints, L2 layer cache entries are then deleted; if L2 layer cleanup still fails to meet capacity constraints, L1 layer cache entries are further deleted. Cache entries at each layer maintain only logical relationships, without establishing strong dependencies; when a lower-level cache entry is deleted, the corresponding upper-level cache entry can be updated or invalidated during subsequent accesses through version verification or consistency checks to avoid reusing invalid cache entries.

[0123] Cache entries at each level are stored in a unified storage space, without independent capacity quotas. Cache entries are sorted and deleted based on cache priority to ensure that the total cache size does not exceed the capacity threshold. The cleanup process can be repeated until the total cache size meets the capacity threshold constraint.

[0124] Example 8

[0125] A cache-based method for accelerating intelligent agent function calls, as described in Example 7, differs in that it addresses the issue of calls occurring within the most recent time window. For frequently accessed cache entries, the processor can dynamically enhance the cache priority based on the number of access hits, thereby increasing the resident priority of the corresponding cache entries and reducing the probability of them being evicted. When a cache entry is within a preset time window... The number of access hits within the scope reached the threshold. Time (e.g., configurable) Hour, (times), in the current overall cache priority Adding a gain term on top of the existing terms The updated cache overall priority is obtained. :

[0126]

[0127] Among them, the gain term For configurable parameters (e.g., can be set to) This is used to reflect the short-term access activity level of cached entries; This indicates the upper limit of the overall cache priority, which can be configured according to actual needs (for example, it can be set to 1.0).

[0128] This mechanism performs local priority enhancement on frequently accessed entries without changing the original priority calculation structure, thereby improving cache reuse efficiency and optimizing cache cleanup strategies.

[0129] The above capacity threshold Time window Threshold for the number of access hits Gain Term Cache overall priority limit The relevant weight parameters can be written to the parameter configuration area in memory by the processor during the initialization phase or during operation, and called during cache management to participate in the calculation and judgment of the corresponding control logic. The above parameters can be adjusted according to the storage capacity, function call scale, and read / write load to adapt to the cache management needs of different scenarios.

[0130] Example 9

[0131] A computer-readable storage medium includes a stored program, wherein, when the program is running, it controls the device where the computer-readable storage medium is located to execute the cache-based intelligent agent function call acceleration method described in any of embodiments 1-8.

[0132] Example 10

[0133] An electronic device includes: one or more processors; a memory; and one or more computer programs, the one or more computer programs being stored in the memory, the one or more computer programs including instructions that, when executed by the device, cause the device to perform the cache-based intelligent agent function call acceleration method described in any of embodiments 1-8.

[0134] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for accelerating intelligent agent function calls based on caching, characterized in that, Includes the following steps: S1, after receiving the function call request input by the user, the processor performs semantic and structural parsing on the request content to extract the task intent and explicit features of the current request; S2, perform task status association determination between the current function call request and historical interaction records, including explicit feature determination and implicit feature matching, to obtain the status association confidence score; S3, the processor reads the cache entry related to the current request and performs a hierarchical cache reuse decision: when the state association confidence score is higher than the preset threshold, the cache entry passes the version comparison and compatibility judgment and the cache is in a valid state, the corresponding cache entry is determined to meet the reuse conditions; Otherwise, the reuse condition is not met; If the reuse condition is met, a cache hit occurs, and the corresponding cache level of the hierarchical cache structure is selected based on the current request and the results of historical calls to perform the reuse operation; if the reuse condition is not met, a cache miss occurs, and the original function retrieval and function call process is executed to obtain the call result. S4, perform cache write judgment on the call result. If the function call is successful and the return result is valid, the processor further judges whether the call result meets the cache write condition. If it does, write the cache entry. S5, the processor dynamically updates, re-evaluates, and cleans up cache entries.

2. The method for accelerating intelligent agent function calls based on caching according to claim 1, characterized in that, In step S2, explicit features include pronouns, operation continuation expressions, and parameter inheritance information. When explicit features are detected, it is determined that the current request depends on the previous round of interaction state, which is used for subsequent association matching processing.

3. The method for accelerating intelligent agent function calls based on caching according to claim 2, characterized in that, The implicit feature matching process in step S2 is as follows: Semantic encoding is performed on the current function call request and historical interaction records to generate corresponding semantic feature vectors, and cosine similarity is calculated as follows: In the formula, Represents cosine similarity. This represents the semantic feature vector of the current function call request; A semantic feature vector representing historical interaction records; express The second norm; express The second norm; State-related confidence score The calculation formula is as follows: 。 4. The method for accelerating intelligent agent function calls based on caching according to claim 3, characterized in that, In step S3, the hierarchical caching structure divides the cached content into three levels: L1, L2, and L3. L1 is used to cache function categories, L2 is used to cache candidate functions and parameter structure templates, and L3 is used to cache the final call information.

5. The method for accelerating intelligent agent function calls based on caching according to claim 4, characterized in that, In step S3, the preset threshold for the state association confidence score is 0.8; When a function structure definition is added, deleted, or its parameter structure changes, the corresponding function structure definition version identifier is automatically updated. When reading cached entries, the version identifier of the function structure definition bound to the cached entry is compared with the version identifier of the current function structure definition. If the version identifiers are inconsistent, a compatibility check is performed. The compatibility check categorizes the results into three types: complete match, backward compatibility, and structure failure. The processor reads and compares the function structure definition corresponding to the cached entry with the current function structure definition. When the function name, parameter name, parameter type, parameter constraints, and return structure are all the same, it is considered a complete match. When the function structure only has non-destructive changes such as adding optional parameters or extending the return structure, it is considered backward compatible. Both complete match and backward compatibility are considered as passing the compatibility check. Cache entries are divided into two categories: data-type cache entries and structure-type cache entries. Each category employs a different validity period management method. The validity period of data-type cache entries is set in stages based on the data update frequency: for data with high update frequency and strong real-time requirements, the validity period is set to a short period; for data that remains stable within a certain time range but may still change, the validity period is set to a medium period; and for historical data with low change frequency and strong stability, the validity period is set to a long period. The short period is in the minute range, the medium period is in the hour range, and the long period is in the day range. Structured cache entries are managed using a "base validity period + dynamic adjustment" approach. The base validity period for structured cache entries is set as follows: 12 hours for defined target function information; 24 hours for function categories and candidate function sets; and 48 hours for historical parameter structure information and parameter structure templates. When the conditions are met... When the validity period is extended to three times the basic validity period; when the following conditions are met... When the conditions are met, the validity period is extended to twice the basic validity period; when the conditions are met... In such cases, the validity period will not be extended, and the basic validity period will be used as the final validity period. A cached entry is considered valid if it is within its validity period.

6. The method for accelerating intelligent agent function calls based on caching according to claim 5, characterized in that, In step S3, if the current request is consistent with the result of the historical call, it will be reused in the L3 layer first; if the current request is partially related to the result of the historical call, but the candidate function or parameter template still needs to be adjusted, the L1 or L2 layer will be reused first.

7. The method for accelerating intelligent agent function calls based on caching according to claim 6, characterized in that, In step S4, the cache write condition is determined to be met when the following conditions are met simultaneously: ① The cached content does not contain sensitive information or has been de-identified; ② The cached content has reuse value. It is determined to have reuse value when the cached content meets at least one of the following criteria: stability, timeliness, or relevance. Stability refers to cached content with definite results and low frequency of change; timeliness refers to cached content with results that change dynamically over time. Relevance refers to the content to be cached that depends on the current interaction state or the context of the historical session.

8. The method for accelerating intelligent agent function calls based on caching according to claim 7, characterized in that, In step S4, when writing cache entries, cache write and update operations of L1 and L2 layers are triggered first.

9. The method for accelerating intelligent agent function calls based on caching according to claim 8, characterized in that, In step S5, to unify the sorting and scheduling process of cache entries, the overall cache priority is calculated based on the state association confidence score, access hit count, and time decay coefficient, as shown in the following formula: In the formula, Prioritize cache overall settings; This represents the number of times a corresponding cache entry is accessed within a preset time window; The time interval between the current time and the last time this cached entry was read; This is the time decay factor, used to control the decay rate of cache entries; , , These are the weighting coefficients for the state association confidence score, the number of visits, and the time interval, respectively, satisfying... ; The processor performs a re-evaluation operation on the cache entries in memory according to a preset cycle, including re-counting the number of access hits of the cache entries, updating the time interval since the last access of the cache entries, and recalculating the overall cache priority by combining the current recorded state with the confidence score. When the total number of cache entries in the cache storage area exceeds a preset capacity threshold When the cache is cleared, the cleanup process is triggered. First, L3 cache entries are deleted from low to high according to the overall cache priority. If the L3 cache still cannot meet the capacity constraints after cleanup, L2 cache entries are then deleted. If the L2 cache still cannot meet the capacity constraints after cleanup, L1 cache entries are then deleted.

10. The method for accelerating intelligent agent function calls based on caching according to claim 9, characterized in that, When a cache entry is in a preset time window The number of access hits within the scope reached the threshold. At that time, under the current overall cache priority Adding a gain term on top of the existing terms The updated cache overall priority is obtained. : Among them, the gain term Used to reflect the short-term access activity of cached entries; This indicates the upper limit of the overall cache priority.