Intelligent agent and method for constructing intelligent agent

By employing a seven-layer collaborative architecture and knowledge distillation technology, the structured cognition and security controllability issues of intelligent agents in enterprise-level applications are resolved. This enables deep business understanding and stable response under high concurrency, ensuring the security and controllability of intelligent agents in enterprise-level applications.

CN122472079BActive Publication Date: 2026-08-25SUZHOU YIJI INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610937151.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-26
Publication Date
2026-08-25
Estimated Expiration
2046-06-26

AI Technical Summary

Technical Problem

Existing intelligent agents lack a structured knowledge layer in enterprise applications, have insufficient cognitive abilities, lack process control, pose serious security risks, and have imperfect memory management, making them unable to meet high-concurrency requirements.

Method used

It adopts a bottom-up seven-layer collaborative architecture, including a perception layer, knowledge layer, tool execution layer, model reasoning layer, dynamic adaptation layer, cognition layer and application layer. It combines knowledge distillation technology and hierarchical intelligent memory management to achieve structured cognition, dynamic adaptation and security control.

Benefits of technology

It enables intelligent agents to deeply understand business operations in enterprise applications, adapt to load changes and task priorities, ensure stable response under high concurrency, and ensure security and controllability through hierarchical permission verification and reflective verification mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122472079B_ABST
    Figure CN122472079B_ABST
Patent Text Reader

Abstract

The application provides an intelligent agent and an intelligent agent construction method, wherein the intelligent agent comprises a perception layer, a knowledge layer, a tool execution layer, a model reasoning layer, a dynamic adaptation layer, a cognition layer and an application layer which are sequentially arranged from bottom to top. The intelligent agent and the intelligent agent construction method realize the structured cognition, safe and controllable execution and efficient memory reuse of the intelligent agent in an enterprise-level scene through the seven-layer collaborative architecture and dynamic adaptation, and significantly improve the reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to an intelligent agent and a method for constructing an intelligent agent. Background Technology

[0002] The mainstream technical approaches for intelligent agents currently fall into two main categories: personal assistants and basic frameworks. Personal assistant-type intelligent agents employ a modular architecture of "gateway-core-memory-skills-scheduling-model adaptation," relying on a local file system to store memory data. They utilize plug-in skills as their core expansion capability, supporting multi-channel access and multi-model adaptation. However, they are primarily geared towards personal scenarios and lack enterprise-level knowledge management and security control mechanisms. Basic framework-type intelligent agents (such as LangGraph and CrewAI) are centered around a large language model, integrating task planning, memory management, and tool usage as three pillars to form a basic closed loop of "perception-decision-action." Some frameworks support multi-agent collaboration and plug-in tool integration.

[0003] However, existing technologies have significant shortcomings in enterprise-level applications: First, they lack a structured knowledge layer, making it impossible to build semantic models of the enterprise's real world. Relying solely on retrieval enhancement or local file caching results in insufficient cognitive capabilities, making it difficult to understand complex business logic. Second, process control is lacking. The purely prompt-driven model allows for excessive freedom in large models, leading to chaotic task flows, prone to infinite loops, and a lack of reflection mechanisms, resulting in the inability to automatically recover after tool execution anomalies. Third, skill plugins lack hierarchical access control, and high-risk tool calls lack circuit breaker mechanisms, posing serious security risks. Fourth, memory management is inadequate. The use of local file storage leads to low retrieval efficiency, lack of concurrency support, and no fault tolerance, failing to meet the high reliability and high concurrency requirements of enterprise-level applications. Therefore, existing technologies lack an intelligent agent and intelligent agent construction method that can achieve structured cognition, secure and controllable operation, efficient memory reuse, and adaptability to multiple enterprise scenarios. Summary of the Invention

[0004] Therefore, it is necessary to provide an intelligent agent and a method for constructing an intelligent agent to address the aforementioned technical problems.

[0005] In a first aspect, the present invention provides an intelligent agent, comprising: a bottom-up perception layer, a knowledge layer, a tool execution layer, a model reasoning layer, a dynamic adaptation layer, a cognitive layer, and an application layer; wherein...

[0006] The perception layer is used to receive multi-source data and preprocess it to obtain standardized data;

[0007] The knowledge layer is used to query the corresponding structured business data from the business system based on standardized data, and input the standardized data and structured business data into a pre-trained lightweight small model to output knowledge graph data.

[0008] The tool execution layer is used to perform permission level verification based on the tool call request output by the cognition layer. After the verification is passed, the corresponding tool is called to execute according to the tool call request and the call parameters output by the dynamic adaptation layer, and the execution result is recorded and the tool execution result is output.

[0009] The model inference layer is used to call the corresponding model for inference through the unified gateway based on the first running parameters and inference request, and output the model inference result.

[0010] The dynamic adaptation layer is used to collect scene data in real time and generate task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for the coordination tool execution layer, model inference layer and cognition layer based on the scene data.

[0011] The cognitive layer is used to generate a task execution plan based on standardized data, knowledge graph data and task complexity, and to generate tool call requests, inference requests and processing results based on the task execution plan. It also verifies the tool execution results based on the second running parameters and triggers the regeneration of the task execution plan when the verification is abnormal.

[0012] The application layer is used to receive the processing results output by the cognitive layer, and adapt the processing results to the corresponding format according to the configuration of the target business scenario, and output the target result adapted to the target business scenario.

[0013] Optionally, the cognitive layer is configured with a hierarchical intelligent memory management system, which includes at least a short-term memory layer, a medium-term memory layer, and a long-term memory layer; wherein,

[0014] The short-term memory layer is used to store the standardized data output by the perception layer and the processing results generated by the cognition layer;

[0015] The intermediate memory layer is used to store the tool execution results output by the tool execution layer and the task execution plan and tool call request generated by the cognitive layer;

[0016] The long-term memory layer is used to store the knowledge graph data output by the knowledge layer and the model reasoning results output by the model reasoning layer.

[0017] Optionally, the pre-trained lightweight small model in the knowledge layer is obtained through knowledge distillation; the knowledge distillation includes:

[0018] Collect training samples, wherein the training samples include user questions and / or business scenario questions;

[0019] Input the training samples into the large language model and obtain the answer output by the large language model as a soft label;

[0020] The soft tags are converted into structured soft tags according to a predefined structured template, wherein the structured template includes objects, events, relationships, constraints, and behaviors;

[0021] The training samples are paired with structured soft labels to form training data pairs;

[0022] The training data is used to train a lightweight student model, resulting in a pre-trained lightweight small model.

[0023] Optionally, the scenario data includes task data, system data, and environmental data; wherein, the task data includes the number of task steps, data volume, task type, and task priority; the system data includes the real-time load and response speed of each model in the model inference layer, the tool call status in the tool execution layer, the overall CPU utilization rate of the system, and the overall memory utilization rate of the system; and the environmental data includes the amount and type of multimodal data accessed by the perception layer.

[0024] The process of generating task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for the execution layer, model inference layer, and cognition layer of the coordination tool based on scenario data includes:

[0025] The task complexity is calculated based on the scenario data, wherein the task complexity is calculated using the following formula: ,in, The number of task steps. For data volume, , These are the first weighting coefficient and the second weighting coefficient, respectively.

[0026] Based on the task complexity and system data, the first running parameters are generated, which include model call weight, word limit and model switching threshold;

[0027] Based on task complexity and task priority, a second set of running parameters is generated, which includes state machine transition thresholds and memory recall strategies.

[0028] Based on the task complexity and the tool call status of the tool execution layer, call parameters are generated, including the tool call timeout and the number of retries.

[0029] Based on task data, system data, and environmental data, collaborative scheduling instructions are generated and output to the tool execution layer, model inference layer, and cognition layer. These collaborative scheduling instructions include task distribution instructions, exception collaborative handling instructions, and resource dynamic allocation instructions.

[0030] Optionally, the knowledge graph data output by the knowledge layer conforms to a predefined structured template, which includes five elements: objects, events, relationships, constraints, and behaviors. Among them, objects are used to represent enterprise business entities; events are used to represent business processes or system anomalies; relationships are used to represent the association between objects or the causal relationship between events; constraints are used to represent business rules or permission specifications; and behaviors are used to represent executable operations.

[0031] Optionally, generating a task execution plan based on standardized data, knowledge graph data, and task complexity includes:

[0032] Determine task objectives based on user needs identified in standardized data;

[0033] Based on knowledge graph data, acquire structured knowledge related to the task objectives;

[0034] Based on the task complexity output by the dynamic adaptation layer, determine the constraints for task execution;

[0035] The task's state set and state transition rules are defined by an explicit state machine. The state set includes at least the planning state, execution state, verification state, reflection state, and termination state.

[0036] Within the framework of an explicit state machine, a task execution plan is generated based on the task objective, structured knowledge, and constraints, including a sequence of task steps, a tool invocation plan, and expected results.

[0037] Optionally, generating tool invocation requests, inference requests, and processing results according to the task execution plan includes:

[0038] When the current step in the task execution plan needs to call an external tool, a tool call request is generated, which includes the tool identifier, input parameters, and user identity.

[0039] When the current step in the task execution plan requires model inference, an inference request is generated. The inference request includes a description of the inference task and the context information necessary to perform this inference.

[0040] When the steps in the task execution plan are completed and no further action is required, a processing result is generated, which includes the task execution conclusion, the generated answer, or action instructions.

[0041] Optionally, the step of verifying the tool execution result according to the second running parameters, and triggering a regeneration of the task execution plan when a verification error occurs, includes:

[0042] Obtain the expected result set, wherein the expected result set includes at least one expected condition;

[0043] Based on the tool's execution results, obtain the actual execution result set, wherein the actual execution result set includes at least one actual execution result element;

[0044] Each actual execution result element in the actual execution result set is compared with the expected conditions in the expected result set one by one, and the number of elements that meet the expected conditions is counted.

[0045] According to the formula The validity of the calculation results, among which, For the validity of the results, Indicates the number of elements in the set;

[0046] when If the verification result is normal, proceed to the next task step in the task execution plan. The state machine transition threshold in the second operating parameter;

[0047] when If the verification result is found to be abnormal, the task execution plan will be regenerated and the abnormal information will be recorded.

[0048] Repeat the process until the task is completed or the preset maximum number of retries is reached;

[0049] If the verification result is still abnormal after the maximum number of retries has been reached, manual intervention will be triggered.

[0050] Optionally, the step of receiving multi-source data and preprocessing it to obtain standardized data includes:

[0051] Data from multiple sources is received through a unified interface across multiple channels, and the data from these sources is anonymized to obtain the anonymized data.

[0052] The anonymized data is standardized to output standardized data. For numerical anonymized data, the following formula is used for standardization: ,in, To standardize data, This is the anonymized data. The mean of the anonymized data. This represents the standard deviation of the anonymized data.

[0053] Secondly, this invention provides a method for constructing an intelligent agent, comprising: deploying a seven-layer collaborative architecture from bottom to top, consisting of a perception layer, a knowledge layer, a tool execution layer, a model reasoning layer, a dynamic adaptation layer, a cognition layer, and an application layer; and completing interface docking and parameter initialization between each layer to obtain a runnable intelligent agent; wherein,

[0054] The knowledge layer is used to query the corresponding structured business data from the business system based on standardized data, and input the standardized data and structured business data into a pre-trained lightweight small model to output knowledge graph data.

[0055] The tool execution layer is used to perform permission level verification based on the tool call request output by the cognition layer. After the verification is passed, the corresponding tool is called to execute according to the tool call request and the call parameters output by the dynamic adaptation layer, and the execution result is recorded and the tool execution result is output.

[0056] The model inference layer is used to call the corresponding model for inference through the unified gateway based on the first running parameters and inference request, and output the model inference result.

[0057] The dynamic adaptation layer is used to collect scene data in real time and generate task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for the coordination tool execution layer, model inference layer and cognition layer based on the scene data.

[0058] The cognitive layer is used to generate a task execution plan based on standardized data, knowledge graph data and task complexity, and to generate tool call requests, inference requests and processing results based on the task execution plan. It also verifies the tool execution results based on the second running parameters and triggers the regeneration of the task execution plan when the verification is abnormal.

[0059] The application layer is used to receive the processing results output by the cognitive layer, and adapt the processing results to the corresponding format according to the configuration of the target business scenario, and output the target result adapted to the target business scenario.

[0060] The intelligent agent and its construction method provided by this invention achieve an organic unity of structured cognition, dynamic adaptation, and secure control through a bottom-up seven-layer collaborative architecture. The knowledge layer integrates large models and knowledge distillation techniques, inputting structured and standardized data from business systems into lightweight small models and outputting knowledge graph data conforming to five key elements, thereby endowing the intelligent agent with deep business understanding capabilities. Simultaneously, the dynamic adaptation layer collects scenario data in real time, dynamically calculates task complexity, and generates first operating parameters, second operating parameters, calling parameters, and collaborative scheduling instructions, enabling the intelligent agent to adapt to load changes and task priorities, ensuring stable response under high concurrency. Furthermore, the cognition layer introduces an explicit state machine and a reflective verification mechanism, quantitatively evaluating the effectiveness of tool execution results based on the second operating parameters, thereby achieving a self-healing closed loop in the task process; and the tool execution layer sets hierarchical permission verification, calling thresholds, and behavior auditing to effectively control high-risk tool calls. The hierarchical intelligent memory management system adopts short-term, medium-term, and long-term three-level storage, solving the shortcomings of traditional local file storage such as slow retrieval, lack of concurrency, and lack of fault tolerance. The application layer supports rapid adaptation to multiple business scenarios, while the model inference layer enables dynamic switching between multiple models through a unified gateway. Attached Figure Description

[0061] Figure 1 This is a schematic diagram of the architecture of an intelligent agent provided in an embodiment of the present invention;

[0062] Figure 2 A schematic diagram of the module architecture of the intelligent agent provided in an embodiment of the present invention;

[0063] Figure 3 This is an internal structural diagram of a computer device according to one embodiment of the present invention. Detailed Implementation

[0064] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0065] like Figure 1 and Figure 2 As shown, this invention provides an intelligent agent, comprising: a perception layer 10, a knowledge layer 20, a tool execution layer 30, a model reasoning layer 40, a dynamic adaptation layer 50, a cognition layer 60, and an application layer 70, deployed sequentially from bottom to top; wherein,

[0066] The perception layer 10 is used to receive multi-source data and preprocess it to obtain standardized data;

[0067] Optionally, the step of receiving multi-source data and preprocessing it to obtain standardized data includes:

[0068] Data from multiple sources is received through a unified interface across multiple channels, and the data from these sources is anonymized to obtain the anonymized data.

[0069] The anonymized data is standardized to output standardized data. For numerical anonymized data, the following formula is used for standardization: ,in, To standardize data, This is the anonymized data. The mean of the anonymized data. This represents the standard deviation of the anonymized data.

[0070] The multi-source data received by the perception layer 10 includes, but is not limited to: natural language text and images input by users through WeChat, DingTalk, email, API interfaces, etc.; log data, performance indicators, and alarm information output in real time by the enterprise's business systems (such as enterprise resource planning systems, configuration management databases, monitoring systems, etc.); and structured or semi-structured data uploaded by IoT devices and sensors.

[0071] In this invention, the perception layer 10 receives the aforementioned data through a built-in multi-channel unified interface (supporting protocols such as WebSocket, HTTP, and MQTT). First, the data undergoes desensitization processing, removing or obfuscating sensitive information (such as user phone numbers, server IP addresses, and passwords). Then, it unifies the data format, units, and encoding according to preset standardization rules. For example, the Z-score standardization formula is used for desensitized numerical data. The data is transformed by performing word segmentation and vectorization preprocessing on the anonymized text data. The final output standardized data has a unified format and semantic representation, which is convenient for use by knowledge layer 20 and cognitive layer 60.

[0072] It should be understood that those skilled in the art can flexibly choose the specific implementation method for desensitization and standardization of multi-source data according to the actual business scenario and data characteristics, and this invention does not limit this. For example, desensitization can use existing methods such as replacement, masking, hashing, encryption, and generalization to remove or obfuscate sensitive information; standardization can use methods such as Z-score standardization, Min-Max normalization, or decimal scaling normalization.

[0073] Knowledge layer 20 is used to query the corresponding structured business data from the business system based on standardized data, and input the standardized data and structured business data into a pre-trained lightweight small model to output knowledge graph data;

[0074] Among them, business systems 80 refer to various business support systems operating within an enterprise or organization, including but not limited to: Enterprise Resource Planning (ERP) systems, Configuration Management Database (CMDB), Customer Relationship Management (CRM) systems, monitoring and alarm systems, log management systems, financial systems, supply chain management systems, and monitoring databases. These systems store a large amount of structured business data, such as server asset information, business process status, historical fault records, financial vouchers, and order information. Knowledge layer 20, by connecting to business systems 80, obtains the structured business data they output, serving as one of the core data sources for constructing the knowledge graph. This enables intelligent agents to understand the enterprise's business objects, events, relationships, constraints, and behaviors, thereby possessing cognitive capabilities oriented towards specific business scenarios. Those skilled in the art should understand that the specific type and number of business systems 80 can be flexibly configured according to actual application scenarios, and this invention does not limit this.

[0075] In this invention, the knowledge layer 20 first parses the standardized data output by the perception layer 10 and extracts the key query conditions. The standardized data typically includes entity identifiers (such as server name, device ID, department name), indicator types (such as CPU load, memory usage), time ranges (such as the last hour, today), and status descriptions (such as too high, abnormal) from the user's requirements. Based on this information, the knowledge layer 20 constructs query statements (such as SQL queries, API call parameters) and initiates query requests to one or more business systems (such as CMDB, ERP, monitoring databases, etc.) to obtain structured business data directly related to the user's requirements.

[0076] For example, when standardized data includes the entity "Server A" and the metric "CPU load," Knowledge Layer 20 can query the CMDB for Server A's configuration information (such as its department and running process list), and simultaneously query the monitoring database for Server A's CPU load time-series data and its associated process names within a specified time range. After the query results are returned in structured form, Knowledge Layer 20 associates and merges data fields from different systems according to entity identifiers (such as server names), combining them into a complete, task-oriented structured business data record. This record, along with the standardized data, serves as input to a lightweight mini-model to generate knowledge graph data that conforms to the five key elements.

[0077] It should be noted that the structure of structured business data can be flexibly selected according to actual needs, and it can include objects, events, relationships, constraints, and behaviors; there are no restrictions here. The key is that it can be input into a pre-trained lightweight model along with standardized data and ultimately generate knowledge graph data that conforms to the five elements.

[0078] Optionally, the pre-trained lightweight mini-model in knowledge layer 20 is obtained through knowledge distillation; the knowledge distillation includes: collecting training samples, wherein the training samples include user questions and / or business scenario questions; inputting the training samples into a large language model to obtain the answers output by the large language model as soft labels; converting the soft labels into structured soft labels according to a predefined structured template, wherein the structured template includes objects, events, relationships, constraints, and behaviors; forming training data pairs with the training samples and structured soft labels; and using the training data pairs to train a lightweight student model to obtain the pre-trained lightweight mini-model.

[0079] For the large model and the lightweight student model, those skilled in the art can flexibly choose according to actual needs, and no limitation is made here. When processing plain text data, the existing Qwen3 can be used for the large model, and Qwen3-3B can be used for the lightweight student model.

[0080] For example, collect multiple training samples, each of which includes user questions and / or business scenario questions (e.g., "Server A's CPU load is consistently above 90%, what could be the cause? How to handle it?", "How to troubleshoot database connection pool leaks?", "What to do if the financial system is slow at the end of the month?", etc.).

[0081] Each training sample is input into the large language model (teacher model), and the natural language answer output by the large language model is used as a soft label (for example, for the first training sample above, the answer output by the large language model is: "The CPU spike may be caused by the infinite loop of the javaw.exe process. It is recommended to restart the javaw.exe service.").

[0082] Each soft tag is converted into a structured soft tag according to a predefined structured template containing five elements: object, event, relationship, constraint, and behavior. Taking the first training sample as an example, the converted structured soft tags are as follows:

[0083] Targets: Server A, javaw.exe process, CPU load metrics;

[0084] Event: CPU load is too high (trigger condition: CPU utilization > 85%)

[0085] Relationship: javaw.exe → causes → high CPU load;

[0086] Constraint: If CPU load > 85% and the abnormal process is javaw.exe, then perform a restart operation;

[0087] Action: Invoke the tool restart_service --name javaw.

[0088] Each training sample is paired with its corresponding structured soft label to form a training data pair;

[0089] A lightweight student model is trained using supervised learning with a large number of training data pairs: during forward propagation, the lightweight student model predicts the output based on the input training samples; the cross-entropy loss between the predicted output and the structured soft labels is calculated; during backpropagation, the parameters of the lightweight student model are updated based on the cross-entropy loss. This process is repeated iteratively until the loss converges.

[0090] It should be noted that for training lightweight student models, those skilled in the art can choose existing training methods according to actual needs, and no limitations are imposed here. For example, the open-source LLaMA-Factory framework can be used for training. LLaMA-Factory is a simple, easy-to-use, and efficient large language model training and fine-tuning platform that supports hundreds of mainstream open-source models such as LLaMA, Qwen, Mistral, and ChatGLM. It integrates various training methods such as supervised fine-tuning (SFT), reinforcement learning based on human feedback (RLHF), LoRA, and QLoRA, and can achieve zero-code or low-code model training and fine-tuning through a WebUI interface. In knowledge distillation scenarios, those skilled in the art can use LLaMA-Factory to use the soft labels output by the large language model (teacher model) as supervision signals to train a lightweight student model to mimic the behavior of the teacher model and achieve knowledge transfer. The above training tools and methods are all existing technologies, and those skilled in the art can flexibly choose them according to the actual deployment environment, without specific limitations imposed here.

[0091] After training, the lightweight student model can directly map any input (text concatenation of standardized data and structured business data) into knowledge graph data that conforms to the five elements.

[0092] Optionally, the knowledge graph data output by the knowledge layer 20 conforms to a predefined structured template, which includes five elements: objects, events, relationships, constraints, and behaviors. Among them, objects are used to represent enterprise business entities; events are used to represent business processes or system anomalies; relationships are used to represent the association between objects or the causal relationship between events; constraints are used to represent business rules or permission specifications; and behaviors are used to represent executable operations.

[0093] The tool execution layer 30 is used to perform permission level verification based on the tool call request output by the cognition layer 60. After the verification is passed, the corresponding tool is called to execute according to the tool call request and the call parameters output by the dynamic adaptation layer 50, and the execution result is recorded and the tool execution result is output.

[0094] The tool invocation request is sent from the cognitive layer 60 to the tool execution layer 30, and includes at least the following: tool identifier (indicating the specific tool name or ID to be invoked, such as "restart_server" to restart the service; "query_log" to query the log, etc.), input parameters (business parameters required to invoke the tool, such as server name, time range, query conditions, etc., such as: {"server":"A", "restart mode":"forced"}), user identity (identifying the user or role initiating this invocation, such as user ID, role name, etc.). Furthermore, depending on actual needs, the tool invocation request may also include extended fields such as task ID, request timestamp, and callback address.

[0095] Optionally, the permission-based hierarchical verification of tool call requests output by the cognitive layer 60 specifically includes: classifying tools into three categories according to risk level: high-risk tools, regular tools, and basic tools, and assigning corresponding call permissions and call thresholds to different users; when the cognitive layer 60 outputs a tool call request, the tool execution layer 30 extracts the user identity and tool identifier from the tool call request to determine the risk level of the tool; based on the user permission table and the risk level of the tool, it verifies whether the user has the right to call the tool; after determining that the user has the right to call, if the tool is a high-risk tool, it checks whether the number of calls in a day exceeds the call threshold: if the number of calls in a day is greater than the call threshold, the call to this type of tool is rejected and recorded in the audit log; if the number of calls in a day is less than or equal to the call threshold, the call to this type of tool is allowed, the number of calls in a day is incremented by 1, and it is also recorded in the audit log. For regular tools and basic tools, if the user has the right to call, the call to this type of tool is directly allowed and recorded in the audit log. This method ensures the security and controllability of intelligent agent tool calls.

[0096] In the tool execution layer 30, all callable tools are pre-classified into three categories according to their risk level: ① High-risk tools: Operations that may have a significant impact on the system or data, such as rm -rf (a forced recursive delete command in Linux / Unix systems, used to delete a specified directory and all its files and subdirectories without any confirmation prompts, which is an extremely high-risk operation and may cause permanent data loss), shutdown (system shutdown or power-off command, usually used to shut down the operating system or server), restart_server (the operation of restarting a service, which will cause the server to go offline briefly and then restart), drop database (the database delete command in database management, which will completely delete the entire database and all its data tables, indexes, constraints, etc., which cannot be recovered), etc.; ② Regular tools: Operations that require certain permissions but have controllable risks, such as querying logs, reading databases, sending notifications, etc.; ③ Basic tools: Low-risk operations, such as text processing, mathematical calculations, time acquisition, etc. It should be noted that those skilled in the art can flexibly classify the risk level of callable tools according to actual application scenarios and security policies, and this invention does not make specific limitations in this regard.

[0097] The user permission table records each user's access permissions and access thresholds for each type of tool. Those skilled in the art can flexibly set these permissions according to actual security policies and business needs; this invention does not impose specific limitations on them. For example, Table 1 provides an exemplary user permission table, but this example is for illustrative purposes only and does not constitute a limitation of this invention.

[0098] Table 1 User Permissions Table

[0099]

[0100] It should be understood that the user permission table shown in Table 1 is only an example, in which only the call threshold is set for high-risk tools; for regular tools and basic tools, those skilled in the art can also flexibly set the corresponding call threshold according to actual needs, and the present invention does not limit this.

[0101] In this invention, the tool execution layer 30 records the behavior of each tool call (i.e., writes it to the audit log). The audit log includes at least the following information: call time; user identity; tool name; input parameters; verification result (pass / reject); if the verification result is rejection, the reason for failure is recorded (such as "insufficient permissions", "exceeded daily call threshold", "tool does not exist", etc.); if the verification result is pass and the tool is executed, the tool execution result (including returned data or status) is recorded; execution time; if an exception occurs during the execution process, exception information is recorded (such as "network timeout", "service unavailable", etc.). This audit log is stored independently in the log system and does not participate in the agent's real-time task decision-making. It is mainly used for post-event security review, anomaly tracing, and compliance auditing. The tool execution result is also output to the cognition layer 60 in real time while being written to the audit log for subsequent reflection verification and task processing.

[0102] In this invention, the calling parameters output by the dynamic adaptation layer 50 are key configurations for controlling the execution behavior of the tool, and include at least the following two core parameters:

[0103] ① Tool call timeout: The maximum waiting time limit set for this tool execution (e.g., 30 seconds). If the tool does not return an execution result within the timeout period, the tool execution layer 30 will actively interrupt this call and trigger timeout exception handling to prevent the overall task flow from being affected by the tool being blocked for a long time;

[0104] ② Number of retryes: The maximum number of times (e.g., 3) the tool can be automatically retried when it fails (e.g., returns an error) or times out. This limited number of retries effectively addresses occasional failures such as network jitter and momentary resource shortages, improving the fault tolerance and success rate of task execution.

[0105] The timeout and retry count for the aforementioned tool call are essential parameters for ensuring the stability of the tool call. They are dynamically calculated and generated by the dynamic adaptation layer 50 based on the real-time collected scenario data, enabling the tool execution layer 30 to adapt to different operating environments while balancing efficiency and reliability.

[0106] In addition, depending on the actual business scenario and system status, the dynamic adaptation layer 50 can also generate other extended call parameters, such as call priority (for queuing and scheduling), circuit breaker threshold (how many consecutive failures will temporarily disable the tool), and degradation strategy (returning cached results or default values ​​when timeout or failure occurs).

[0107] The model inference layer 40 is used to call the corresponding model for inference through the unified gateway based on the first running parameters and inference request, and output the model inference result;

[0108] The first set of operating parameters are model invocation control parameters dynamically generated by the dynamic adaptation layer 50 based on the current scenario data. These parameters include at least: model invocation weight (used to distribute inference requests among multiple models according to their invocation weights to achieve dynamic load balancing), a lexical limit (limiting the maximum number of lexical units consumed in a single inference attempt), and a model switching threshold (e.g., automatically switching to a backup model when a model's response latency exceeds 500ms). The inference request is a pending problem or instruction generated by the cognition layer 60, which includes at least: a description of the inference task (e.g., "Analyze the CPU load data of server A to determine the cause of the anomaly") and the necessary contextual information for executing this inference (e.g., relevant log fragments, knowledge graph data query results, etc.).

[0109] In this invention, the unified gateway is the core component of the model inference layer 40, used to receive the first operating parameters output by the dynamic adaptation layer 50 and the inference requests output by the cognitive layer 60. The unified gateway dynamically routes the inference requests to the most suitable model (local or cloud) according to the model call weight to achieve load balancing; it limits the number of words consumed in a single inference based on the word limit; and it automatically performs failover and switches to a backup model when a model call fails or the response time exceeds the model switching threshold.

[0110] The dynamic adaptation layer 50 is used to collect scene data 90 in real time, and generate task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for coordination tool execution layer 30, model inference layer 40 and cognition layer 60 based on the scene data.

[0111] Optionally, the scenario data includes task data, system data, and environmental data; wherein, the task data includes the number of task steps, data volume, task type, and task priority; the system data includes the real-time load and response speed of each model in the model inference layer, the tool call status in the tool execution layer, the overall CPU utilization rate of the system, and the overall memory utilization rate of the system; and the environmental data includes the amount and type of multimodal data accessed by the perception layer 10.

[0112] It should be understood that task data in the scene data can be directly provided by the cognitive layer, system data can be reported in real time by the tool execution layer and model inference layer through the built-in monitoring interface, and environmental data can be synchronously acquired by the perception layer through the data acquisition interface. Those skilled in the art can use existing data acquisition and monitoring methods to achieve real-time acquisition of the above data, and this invention does not specifically limit this.

[0113] Optionally, the step of generating task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for the coordination tool execution layer 30, model inference layer 40, and cognition layer 60 based on scenario data includes:

[0114] The task complexity is calculated based on the scenario data, wherein the task complexity is calculated using the following formula: ,in, The number of task steps. For data volume, , These are the first weighting coefficient and the second weighting coefficient, respectively.

[0115] Based on the task complexity and system data, the first running parameters are generated, which include model call weight, word limit and model switching threshold;

[0116] Based on task complexity and task priority, a second set of running parameters is generated, which includes state machine transition thresholds and memory recall strategies.

[0117] Based on the task complexity and the tool call status of the tool execution layer, call parameters are generated, including the tool call timeout and the number of retries.

[0118] Based on task data, system data, and environmental data, collaborative scheduling instructions are generated and output to the tool execution layer 30, model inference layer 40, and cognitive layer 60. The collaborative scheduling instructions include task distribution instructions, exception collaborative handling instructions, and resource dynamic allocation instructions.

[0119] The specific values ​​of the first and second weighting coefficients can be preset by those skilled in the art based on the actual application scenario. For example, in application scenarios that emphasize the number of interactions, the values ​​can be... Set it to a larger value (e.g.) , In data-intensive application scenarios, it can be Set it to a larger value (e.g.) , Under normal circumstances, it is advisable to take... This indicates that the number of task steps and the amount of data each contribute equally to the complexity of the task.

[0120] The process by which the dynamic adaptation layer 50 generates the model call weights in the first running parameters is as follows:

[0121] First, based on task complexity Assign basic weights to each model in model inference layer 40. The basic weight assignment rule can be: if <100, that is <The first complexity threshold, the base weight of the local lightweight model (parameters ≤ 3B) is 100% (first weight); if 100 ≤ <500, i.e., the first complexity threshold ≤ <The second complexity threshold, the base weight for local medium-sized models (7B~14B parameters) is 70% (second weight), and the base weight for cloud-based large models is 30% (third weight); if ≥500, that is For models with a complexity threshold greater than or equal to the second threshold, the base weight for large cloud models is 80% (fourth weight), and the base weight for medium-sized local models is 20% (fifth weight).

[0122] Then, the base weights are fine-tuned based on the real-time load L of each model (ranging from 0 to 100%) to obtain the fine-tuned base weights. Specifically, when L > 80% for any model, i.e., L > the first load threshold, the base weight of that model is reduced by 10% (sixth weight), and the reduced weight is evenly distributed to other available models; if the reduced base weight is negative, the base weight is reset to 0.

[0123] Finally, the base weights are fine-tuned a second time based on the overall system CPU utilization rate U to obtain the model call weights. Specifically, if U > 70%, that is, U > the first CPU utilization rate threshold, the base weights of all models (models with more than 10B parameters) are multiplied by the adjustment coefficient 1 - (U - 0.7) × 0.5. That is, for every percentage point that the overall system CPU utilization rate exceeds 70%, the base weight of the model is reduced by 0.5%, up to a maximum of 50% of the original base weight. All the reduced weights are transferred to the local lightweight model.

[0124] It should be noted that the first complexity threshold, the second complexity threshold, the first to sixth weights, the first load threshold, the first CPU utilization threshold, and the adjustment coefficient can be flexibly set by those skilled in the art according to actual needs, and are not limited here.

[0125] For example, when When the CPU utilization is 600, the base weight of the large cloud model is 80%, and the base weight of the local medium model is 20%. If the real-time load of the large cloud model is 85%, the base weight of the large cloud model is reduced by 10% to 70%, and the base weight of the local medium model is increased to 30%. If the overall CPU utilization of the system is 75% at this time, the base weight of the large cloud model after fine-tuning is multiplied by the adjustment coefficient 1-(0.75-0.7)×0.5=0.975, and the final base weight of the large cloud model is approximately 70%×0.975=68.25%, and the base weight of the local model is adjusted accordingly to 100%-68.25%=31.75%.

[0126] Through the above steps, the dynamic adaptation layer 50 realizes the dynamic calculation of model call weights, taking into account the task complexity, the real-time load of each model in the model inference layer 40, and the overall CPU utilization of the system.

[0127] The process by which the dynamic adaptation layer 50 generates the upper limit of the word tokens in the first running parameter is as follows:

[0128] First, based on task complexity Calculate the upper limit of the basic word units. Specifically, use formula T. base =min(4096,max(512,floor( ×10))), where T base The upper limit of basic word class, floor( ×10) represents the... The result of the calculation ×10 is rounded down.

[0129] Then, based on the overall system memory usage U mem The upper limit of the basic word units is adjusted to obtain the adjusted upper limit of the basic word units. Specifically, if U mem >70%, that is U mem >Memory usage threshold, adjustment factor f mem =1-(U mem -0.7)×0.5 and adjustment factor f mem Greater than or equal to 0.5 (adjustment factor threshold), otherwise f mem =1, Adjusted basic word limit T mem =T base ×f mem .

[0130] Finally, the adjusted basic lexical upper limit is corrected based on the amount of multimodal data (e.g., the number of images) in the environmental data to obtain the final lexical upper limit. If the amount of multimodal data exceeds a data volume threshold (e.g., 10 images), the final lexical upper limit T is determined. final =T mem ×0.7, i.e., T final =T mem × First coefficient, otherwise T final =T mem .

[0131] It should be noted that the memory occupancy threshold, adjustment factor threshold, data volume threshold, and first coefficient can be flexibly set by those skilled in the art according to actual needs, and are not limited here.

[0132] The process by which the dynamic adaptation layer 50 generates the model switching threshold in the first running parameters is as follows:

[0133] First, obtain the average historical response rate R of the current model from the system data. avg (milliseconds), and calculate the first basic threshold S based on it. base =max(300,min(5000,Ravg ×2.5)).

[0134] Then, the first basic threshold is adjusted according to the task priority to obtain the corrected basic threshold. Specifically, if the task priority is high, the corrected basic threshold S... prio =S base ×0.8, i.e., S prio =S base × First correction threshold; if the task priority is low, the corrected base threshold S prio =S base ×1.2, i.e., S prio =S base ×Second correction threshold; otherwise, remain unchanged.

[0135] Finally, the model switching threshold is obtained based on the base threshold corrected for the model's real-time load L. Specifically, if L > 80%, i.e., L > the second load threshold, the model switching threshold S is... final =S prio ×1.3, i.e., S final =S prio ×Third correction threshold, otherwise S final =S prio .

[0136] It should be noted that the first basic threshold, the first to third correction thresholds and the second load threshold can be flexibly set by those skilled in the art according to actual needs, and are not limited here.

[0137] The process by which the dynamic adaptation layer 50 generates the state machine transition threshold in the second operating parameter is as follows:

[0138] First, set the second basic threshold to 0.8.

[0139] Then, based on task complexity The second basic threshold is adjusted to obtain the adjusted second basic threshold. Specifically, if... (Simple task), that is If the third complexity threshold is less than 100, the second basic threshold is reduced to 0.75 (the first target threshold) to enhance reflective sensitivity; if 100 ≤ <500, i.e., the third complexity threshold ≤ <The fourth complexity threshold is not met, so the second basic threshold remains at 0.8; if ≥500 (complex tasks), i.e. If the fourth complexity threshold is reached, the second basic threshold is increased to 0.85 (the second target threshold) to reduce the false positive rate.

[0140] Next, the adjusted second basic threshold is corrected according to the task priority to obtain the corrected second basic threshold. Specifically, if the task priority is high, the adjusted second basic threshold increases by 0.05 (first threshold); if the task priority is low, the adjusted second basic threshold decreases by 0.05 (second threshold).

[0141] Finally, the modified second basic threshold is fine-tuned based on the overall system CPU utilization U to obtain the state machine transition threshold. Specifically, if U > 80%, i.e., U > the second CPU utilization threshold, the modified second basic threshold is reduced by 0.05 (the third threshold) to reduce computational overhead under high load. The range of the state machine transition threshold is controlled within [0.7, 0.9].

[0142] It should be noted that the second basic threshold, the third complexity threshold, the fourth complexity threshold, the first target threshold, the second target threshold, the second CPU utilization threshold, the first threshold, the second threshold, and the third threshold can be flexibly set by those skilled in the art according to actual needs, and are not limited here.

[0143] The generation rule for the memory recall strategy in the second running parameters generated by the dynamic adaptation layer 50 is as follows:

[0144] First, determine the default strategy based on the task type. Specifically, simple dialogues or real-time question answering prioritize short-term memory, data analysis, fault diagnosis, or complex reasoning prioritize long-term memory, and other types prioritize medium-term memory.

[0145] Then, based on task complexity Adjust the default policy to obtain the adjusted default policy. Specifically, if... <100, that is <The fifth complexity threshold, the adjusted default strategy is: force the use of short-term memory; if ≥500, that is For complexity thresholds ≥ 6, the adjusted default strategy is: force the use of long-term memory and add "simultaneous retrieval of intermediate memory as a supplement".

[0146] Finally, the adjusted default strategy is modified based on the multimodal data types in the environmental data to obtain the memory retrieval strategy. Specifically, if the multimodal data type is a non-text data type such as image or audio, the memory retrieval strategy is: the adjusted default strategy is supplemented with "combining knowledge graph data in long-term memory for cross-modal retrieval". The final output memory retrieval strategy is a clear instruction, such as "prioritize the use of long-term memory, and combine it with medium-term memory when necessary".

[0147] The process by which the dynamic adaptation layer 50 generates the tool call timeout in the call parameters is as follows:

[0148] First, based on task complexity Determine the base timeout period. Specifically, if... <100, that is <Seventh complexity threshold, base timeout set to 10 seconds (first time threshold); if 100≤ <500, i.e., the seventh complexity threshold ≤ <Eighth complexity threshold, base timeout set to 30 seconds (second time threshold); if ≥500, that is ≥Eighth complexity threshold, base timeout set to 60 seconds (third time threshold).

[0149] Then, the base timeout is adjusted based on the tool invocation status of the tool execution layer 30 to obtain the tool invocation timeout. Specifically, if the tool invocation status is busy (e.g., queue length > 5), the base timeout is increased by 50% (fourth threshold); if the tool invocation status is idle, the base timeout remains unchanged; if the tool invocation status is unavailable, it is directly marked as uncallable and exception handling is triggered.

[0150] In addition, if the task priority is high, the base timeout is reduced by 20% (fifth threshold) to speed up the response; if it is low, the base timeout can be extended by 20% (sixth threshold). Tool call timeout is limited to a minimum of 5 seconds and a maximum of 120 seconds.

[0151] It should be noted that the basic timeout time, the seventh complexity threshold, the eighth complexity threshold, the first time threshold, the second time threshold, the third time threshold, the fourth threshold, the fifth threshold, and the sixth threshold can be flexibly set by those skilled in the art according to actual needs, and are not limited here.

[0152] The process by which the dynamic adaptation layer 50 generates the number of retries in the call parameters is as follows:

[0153] First, set the initial number of retries based on the task complexity. Specifically, if... <100, that is < Ninth complexity threshold, initial retries are set to 0 (no retries for simple tasks); if 100 ≤ <500, i.e., the ninth complexity threshold ≤ <10th complexity threshold, initial retries set to 2; if ≥500, that is ≥10th complexity threshold, initial retries set to 3.

[0154] Then, the initial retry count is adjusted based on the tool's invocation status to obtain the adjusted initial retry count. Specifically, if the tool's invocation status is busy, the initial retry count is increased by 1 (first threshold); if the tool's invocation status is unstable (e.g., there are failure records within the past minute), the initial retry count is increased by 2 (second threshold); if the tool's invocation status is idle, the initial retry count remains unchanged. Simultaneously, if the task priority is high, the initial retry count is halved (retry ratio threshold) to avoid excessive waiting; if the priority is low, the initial retry count can be increased by 1 (third threshold). The final retry count does not exceed 5 (fourth threshold).

[0155] It should be noted that the initial number of retries, the ninth complexity threshold, the tenth complexity threshold, the first number threshold, the second number threshold, the third number threshold, the fourth number threshold, and the number of retries ratio threshold can be flexibly set by those skilled in the art according to actual needs, and are not limited here.

[0156] The collaborative scheduling instructions are generated by the dynamic adaptation layer 50 based on task data, system data, and environment data. Specifically, they include task distribution instructions, exception handling instructions, and dynamic resource allocation instructions, and their generation rules are as follows:

[0157] The task distribution instruction determines how sub-steps in the task execution plan are allocated to lower layers (parallel, serial, or conditional execution). This instruction is generated by the dynamic adaptation layer and applies to both the cognitive and tool execution layers. Specifically, firstly, it determines whether the sub-steps can be executed in parallel based on the task type and complexity in the task data: if the task type is "data query" and there is no data dependency between sub-steps (such as querying CPU and logs simultaneously), a "parallel execution" instruction is generated; if the task type is "process approval" or the sub-steps have sequential dependencies, a "serial execution" instruction is generated. Secondly, the parallel / serial decision is adjusted based on the tool invocation status of the tool execution layer 30 and the overall system CPU utilization: if the overall system CPU utilization U>70%, even if it is determined to be parallel, it is changed to "serial execution" to avoid resource contention; if the tool invocation status shows that the target tools are all idle, parallelism is prioritized. After receiving the instruction, the cognitive layer breaks down the task steps into parallel or serial sequences as required by the instruction; after receiving the instruction, the tool execution layer calls the corresponding tools concurrently or serially as required by the instruction. Final instruction example: "Execute query_cpu and query_log in parallel", which means execute query CPU and query log in parallel.

[0158] The exception handling instruction defines how each layer should coordinate its response when an exception occurs during a tool call or model inference. This instruction is generated by the dynamic adaptation layer and applies to the cognitive layer, model inference layer, and tool execution layer. Specifically, firstly, exception triggering conditions and corresponding handling strategies are preset based on the tool call status of the tool execution layer 30 and the response speed of each model in the model inference layer 40: for example, if the failure rate of a tool in the past 5 minutes (under the tool call status) is >10%, a "circuit breaker" instruction is generated; if the model's response speed is greater than 1.5 times the model switching threshold, an "immediately switch to a backup model" instruction is generated. Secondly, the handling strategy is adjusted according to task priority: high-priority tasks generate a "fast failure and retry" instruction (reducing the retry interval by 50%), and low-priority tasks generate a "degradation" instruction (returning cached results or default values). Upon receiving the instruction, the cognitive layer triggers a reflection mechanism and replans the task when an exception occurs; upon receiving the instruction, the model inference layer performs model switching or rate limiting as needed; upon receiving the instruction, the tool execution layer performs circuit breaker, retry, or degradation operations. Example of final instructions: "If any tool fails, notify the cognitive layer to reflect; if the model times out, switch to a backup model; and quickly retry high-priority tasks."

[0159] The resource dynamic allocation instruction is used to dynamically adjust the resource allocation weights of CPU, memory, network, and other resources across different tasks or layers. This instruction is generated by the dynamic adaptation layer and is applicable to the cognitive layer, model inference layer, and tool execution layer. Specifically, it adjusts the resource allocation weights based on the overall system CPU utilization U and the overall system memory utilization U. mem And task priority determines the resource allocation weight of the current task (default value is 50%): if U>80% and U mem If the resource allocation weight is >70%, a "Resource Restriction" instruction is generated, reducing the resource allocation weight of the current task by 30%; if the task priority is high, a "Priority Guarantee" instruction is generated, increasing the resource allocation weight to 70%; if both high priority and low system load (U≤60% and U) are met, a "Priority Guarantee" instruction is generated. mem If the CPU resource allocation weight is ≤60%, the resource allocation weight can be increased to 90%, generating a "high quota" instruction. Furthermore, if the environmental data contains a large amount of data (e.g., more than 100 images), an additional 20% of cache resources will be allocated, generating an "expanded cache" instruction. Upon receiving this instruction, the cognitive layer controls the number of concurrently active sub-steps based on the resource allocation weight (serialization occurs when the weight is low); upon receiving the instruction, the model inference layer limits the number of concurrent inference requests and batch processing size based on the weight; upon receiving the instruction, the tool execution layer adjusts the maximum number of concurrent connections for tool calls and the queuing strategy based on the weight. Final instruction example: "Increase CPU resource allocation weight to 70%, relax memory limit by 20%".

[0160] All the above instructions are output in a structured data format (such as JSON) to the cognitive layer 60, the model inference layer 40, and the tool execution layer 30. Each layer adjusts its own behavior according to the coordinated scheduling instructions. It should be noted that the coordinated scheduling instruction is an instruction package. In actual output, different instruction contents can be sent to each layer according to its needs, or it can be sent to each layer in the form of a unified message body, and each layer will parse and execute its own part.

[0161] The cognitive layer 60 is used to generate a task execution plan based on standardized data, knowledge graph data and task complexity, and to generate tool call requests, inference requests and processing results based on the task execution plan. It also verifies the tool execution results based on the second running parameters and triggers the regeneration of the task execution plan when the verification is abnormal.

[0162] Optionally, generating a task execution plan based on standardized data, knowledge graph data, and task complexity includes:

[0163] Determine task objectives based on user needs identified in standardized data;

[0164] Based on knowledge graph data, acquire structured knowledge related to the task objectives;

[0165] Based on the task complexity output by the dynamic adaptation layer, determine the constraints for task execution;

[0166] The task's state set and state transition rules are defined by an explicit state machine. The state set includes at least the planning state, execution state, verification state, reflection state, and termination state.

[0167] Within the framework of an explicit state machine, a task execution plan is generated based on the task objective, structured knowledge, and constraints, including a sequence of task steps, a tool invocation plan, and expected results.

[0168] In this context, the task objective refers to the specific business purpose or problem to be solved that needs to be accomplished by the intelligent agent, extracted from user needs in standardized data. For example, if a user asks, "Server A's CPU load is high, please help me find the reason," then the task objective would be "Diagnose the reason why Server A's CPU load is too high."

[0169] In the explicit state machine of cognitive layer 60, state transition rules are pre-coded or configured based on the general logic of task execution, rather than being dynamically generated by a large model. These state transition rules define the legal transition paths between different states of the task, ensuring the controllability and predictability of the task flow. For example, the task's state set includes at least the planning state, execution state, verification state, reflection state, and termination state. The state transition rules are as follows: when the task execution plan is generated, the process transitions from the planning state to the execution state; when the current task step (tool call or model inference) is completed and returns the execution result, the process transitions from the execution state to the verification state; in the verification state, if the verification result of the current task step is normal (result validity ≥ state machine transition threshold) and all task steps have been executed, the process transitions to the termination state, and the task ends; if the verification result is abnormal (validity < threshold), the process transitions to the reflection state; in the reflection state, cognitive layer 60 records the abnormal information and adjusts the strategy, then automatically transitions back to the planning state, triggering the regeneration of the task execution plan. These rules are fixed and predefined, and do not depend on the output of a large model. The agent can only move along the allowed paths, thus avoiding the problems of chaotic task flow, infinite loops or uncontrollability in the traditional pure prompt-driven mode.

[0170] Optionally, generating tool call requests, inference requests, and processing results according to the task execution plan includes: generating a tool call request when the current step in the task execution plan requires calling an external tool, wherein the tool call request includes a tool identifier, input parameters, and user identity; generating an inference request when the current step in the task execution plan requires model inference, wherein the inference request includes a description of the inference task and the context information necessary to perform this inference; and generating a processing result when the steps in the task execution plan are completed and no further operation is required, wherein the processing result includes a task execution conclusion, a generated answer, or an action instruction.

[0171] Optionally, the tool execution result is validated based on the second running parameters, and a task execution plan is regenerated if a validation error occurs, including:

[0172] Obtain the expected result set, wherein the expected result set includes at least one expected condition;

[0173] Based on the tool's execution results, obtain the actual execution result set, wherein the actual execution result set includes at least one actual execution result element;

[0174] Each actual execution result element in the actual execution result set is compared with the expected conditions in the expected result set one by one, and the number of elements that meet the expected conditions is counted.

[0175] According to the formula The validity of the calculation results, among which, For the validity of the results, Indicates the number of elements in the set;

[0176] when If the verification result is normal, proceed to the next task step in the task execution plan. The state machine transition threshold in the second operating parameter;

[0177] when If the verification result is found to be abnormal, the task execution plan will be regenerated and the abnormal information will be recorded.

[0178] Repeat the process until the task is completed or the preset maximum number of retries is reached;

[0179] If the verification result is still abnormal after the maximum number of retries has been reached, manual intervention will be triggered.

[0180] The expected result set originates from the task execution plan generated by the cognitive layer 60. Specifically, when the cognitive layer 60 generates the task execution plan through an explicit state machine, it pre-defines an expected result field for each task step (such as tool invocation or model inference). This field describes the characteristics of the result that should be returned after the task step is successfully executed (for example, for a CPU query tool, the expected result could be set to {CPU load:>85%}). In subsequent reflection and verification steps, the cognitive layer 60 directly reads the expected result set corresponding to that task step from the task execution plan.

[0181] The maximum number of retries can be flexibly selected by those skilled in the art according to actual needs, and is not limited here. Preferably, the maximum number of retries is 3.

[0182] In a specific reflection and verification process of this invention, the cognitive layer 60 first obtains the expected result set preset for the current task step in the task execution plan. This expected result set includes three expected conditions: CPU load greater than 85%, response status code equal to 200, and returned data not empty. The tool execution layer 30 returns the execution result: CPU load of 92%, response status code of 500, and actual data content. The cognitive layer 60 obtains the actual execution result set based on these execution results, which includes a CPU load value of 92%, a response status code equal to 500, and actual data content. Then, each actual execution result element in the actual execution result set is compared with the expected conditions one by one: a CPU load of 92% satisfies the condition that CPU load is greater than 85%, a response status code equal to 500 does not satisfy the condition that response status code equal to 200, and actual data content satisfies the condition that returned data is not empty. The number of elements that satisfy the expected conditions is found to be 2. Since the number of elements (expected conditions) in the expected result set is 3, the validity is Validity = 2 / 3 ≈ 0.667. Assume that the state machine transition threshold in the second running parameter is... Since 0.667 < 0.8, the verification result is deemed abnormal, triggering the regeneration of the task execution plan and recording the abnormal information "Response Status Code Abnormal". Subsequently, the cognitive layer 60 regenerates the task execution plan and retrys this step, repeating the above process. If the verification result is still abnormal after the maximum number of retries (e.g., 3 times), manual intervention is triggered.

[0183] Optionally, the cognitive layer is configured with a hierarchical intelligent memory management system, which includes at least a short-term memory layer, a medium-term memory layer, and a long-term memory layer. The short-term memory layer stores standardized data output by the perception layer and processing results generated by the cognitive layer. The medium-term memory layer stores tool execution results output by the tool execution layer and task execution plans and tool call requests generated by the cognitive layer. The long-term memory layer stores knowledge graph data output by the knowledge layer and model inference results output by the model inference layer.

[0184] The application layer 70 is used to receive the processing results output by the cognitive layer 60, and adapt the processing results to the corresponding format according to the configuration of the target business scenario, and output the target result adapted to the target business scenario.

[0185] Application layer 70 is the output adaptation layer for the intelligent agent facing external target business scenarios. It is used to receive the processing results (such as task execution conclusions, generated answers, or action instructions) output by cognition layer 60, and convert the processing results into a final format that meets the requirements of the current target business scenario according to the configuration of the current target business scenario (such as output format, communication channels, permission requirements, etc.), and output the target result adapted to the target business scenario.

[0186] For example, if the target business scenario is a WeChat Work robot, the application layer 70 will adapt the processing result to a Markdown message format and send it to the user via the WeChat Work API. If the target business scenario is an API service, the application layer 70 will encapsulate the processing result into a JSON structure and attach a standard HTTP response header.

[0187] Through the adaptation of application layer 70, the intelligent agent can quickly access different target business scenarios without modifying its core logic, achieving the reusability of "one-time cognition, multiple outputs". Those skilled in the art can flexibly configure the target business scenario template according to actual needs, and this invention does not limit this.

[0188] The intelligent agent provided by this invention achieves an organic unity of structured cognition, dynamic adaptation, and secure control through a bottom-up seven-layer collaborative architecture. The knowledge layer integrates large models and knowledge distillation technology, inputting structured and standardized data from business systems into lightweight small models, and outputting knowledge graph data conforming to five key elements, thereby endowing the intelligent agent with deep business understanding capabilities. Simultaneously, the dynamic adaptation layer collects scene data in real time, dynamically calculates task complexity, and generates first operating parameters, second operating parameters, calling parameters, and collaborative scheduling instructions, enabling the intelligent agent to adapt to load changes and task priorities, ensuring stable response under high concurrency. Furthermore, the cognition layer introduces an explicit state machine and a reflective verification mechanism, quantitatively evaluating the effectiveness of tool execution results based on the second operating parameters, thereby achieving a self-healing closed loop in the task process; and the tool execution layer sets hierarchical permission verification, calling thresholds, and behavior auditing to effectively control high-risk tool calls. The hierarchical intelligent memory management system adopts short-term, medium-term, and long-term three-level storage, solving the shortcomings of traditional local file storage such as slow retrieval, lack of concurrency, and lack of fault tolerance. The application layer supports rapid adaptation to multiple business scenarios, while the model inference layer enables dynamic switching between multiple models through a unified gateway.

[0189] like Figure 2 As shown, the present invention provides a method for constructing an intelligent agent, comprising:

[0190] A seven-layer collaborative architecture is deployed from bottom to top: perception layer, knowledge layer, tool execution layer, model inference layer, dynamic adaptation layer, cognition layer, and application layer. Interface connections and parameter initialization between each layer are completed to obtain a runnable intelligent agent.

[0191] The knowledge layer is used to query the corresponding structured business data from the business system based on standardized data, and input the standardized data and structured business data into a pre-trained lightweight small model to output knowledge graph data.

[0192] The tool execution layer is used to perform permission level verification based on the tool call request output by the cognition layer. After the verification is passed, the corresponding tool is called to execute according to the tool call request and the call parameters output by the dynamic adaptation layer, and the execution result is recorded and the tool execution result is output.

[0193] The model inference layer is used to call the corresponding model for inference through the unified gateway based on the first running parameters and inference request, and output the model inference result.

[0194] The dynamic adaptation layer is used to collect scene data in real time and generate task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for the coordination tool execution layer, model inference layer and cognition layer based on the scene data.

[0195] The cognitive layer is used to generate a task execution plan based on standardized data, knowledge graph data and task complexity, and to generate tool call requests, inference requests and processing results based on the task execution plan. It also verifies the tool execution results based on the second running parameters and triggers the regeneration of the task execution plan when the verification is abnormal.

[0196] The application layer is used to receive the processing results output by the cognitive layer, and adapt the processing results to the corresponding format according to the configuration of the target business scenario, and output the target result adapted to the target business scenario.

[0197] For completing the interface integration and parameter initialization between layers, those skilled in the art can adopt mature microservice architectures or modular communication mechanisms from existing technologies. For example, data interaction between layers can be achieved through clearly defined RESTful APIs, gRPC interfaces, or message queues (such as Kafka and RabbitMQ). The interface contracts can be described using OpenAPI or Protobuf to ensure decoupling and scalability of calls between layers. Parameter initialization can be uniformly managed using a configuration center (such as Apollo or Nacos) or local configuration files (such as YAML or JSON), and loaded and injected into each layer module when the agent starts.

[0198] The intelligent agent construction method provided by this invention achieves an organic unity of structured cognition, dynamic adaptation, and secure control through a bottom-up seven-layer collaborative architecture. The knowledge layer integrates large models and knowledge distillation techniques, inputting structured and standardized data from business systems into lightweight small models, and outputting knowledge graph data conforming to five key elements, thereby endowing the intelligent agent with deep business understanding capabilities. Simultaneously, the dynamic adaptation layer collects scene data in real time, dynamically calculates task complexity, and generates first operating parameters, second operating parameters, calling parameters, and collaborative scheduling instructions, enabling the intelligent agent to adapt to load changes and task priorities, ensuring stable response under high concurrency. Furthermore, the cognition layer introduces an explicit state machine and a reflective verification mechanism, quantitatively evaluating the effectiveness of tool execution results based on the second operating parameters, thereby achieving a self-healing closed loop in the task process; and the tool execution layer sets hierarchical permission verification, calling thresholds, and behavior auditing to effectively control high-risk tool calls. The hierarchical intelligent memory management system adopts short-term, medium-term, and long-term three-level storage, solving the shortcomings of traditional local file storage such as slow retrieval, lack of concurrency, and lack of fault tolerance. The application layer supports rapid adaptation to multiple business scenarios, while the model inference layer enables dynamic switching between multiple models through a unified gateway.

[0199] It should be noted that "multiple" in this invention includes two or more.

[0200] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0201] Each module in the devices of this invention can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0202] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data required or generated by the aforementioned intelligent agent. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an intelligent agent.

[0203] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an intelligent agent. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0204] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0205] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0206] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0207] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0208] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this invention are all information and data authorized by the user or fully authorized by all parties.

[0209] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided by this invention may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided by this invention may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0210] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0211] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.

Claims

1. An intelligent agent system, characterized in that, include: The layers, from bottom to top, are: perception layer, knowledge layer, tool execution layer, model reasoning layer, dynamic adaptation layer, cognition layer, and application layer; among them... The perception layer is used to receive multi-source data and preprocess it to obtain standardized data; The knowledge layer is used to query the corresponding structured business data from the business system based on standardized data, and input the standardized data and structured business data into a pre-trained lightweight small model to output knowledge graph data. The tool execution layer is used to perform permission level verification based on the tool call request output by the cognition layer. After the verification is passed, the corresponding tool is called to execute according to the tool call request and the call parameters output by the dynamic adaptation layer, and the execution result is recorded and the tool execution result is output. The model inference layer is used to call the corresponding model for inference through the unified gateway based on the first running parameters and inference request, and output the model inference result. The dynamic adaptation layer is used to collect scene data in real time and generate task complexity, first running parameters, second running parameters, calling parameters, and coordinated scheduling instructions for the tool execution layer, model inference layer, and cognition layer based on the scene data. The scene data includes task data, system data, and environmental data. The task data includes the number of task steps, data volume, task type, and task priority. The system data includes the real-time load and response speed of each model in the model inference layer, the tool calling status of the tool execution layer, the overall system CPU utilization, and the overall system memory utilization. The environmental data includes the amount and type of multimodal data accessed by the perception layer. The cognitive layer is used to generate a task execution plan based on standardized data, knowledge graph data and task complexity, and to generate tool call requests, inference requests and processing results based on the task execution plan. It also verifies the tool execution results based on the second running parameters and triggers the regeneration of the task execution plan when the verification is abnormal. The application layer is used to receive the processing results output by the cognitive layer, and adapt the processing results to the corresponding format according to the configuration of the target business scenario, and output the target result adapted to the target business scenario.

2. The intelligent agent system according to claim 1, characterized in that, The cognitive layer is equipped with a hierarchical intelligent memory management system, which includes at least a short-term memory layer, a medium-term memory layer, and a long-term memory layer; wherein... The short-term memory layer is used to store the standardized data output by the perception layer and the processing results generated by the cognition layer; The intermediate memory layer is used to store the tool execution results output by the tool execution layer and the task execution plan and tool call request generated by the cognitive layer; The long-term memory layer is used to store the knowledge graph data output by the knowledge layer and the model reasoning results output by the model reasoning layer.

3. The intelligent agent system according to claim 1, characterized in that, The pre-trained lightweight mini-models in the knowledge layer are obtained through knowledge distillation; the knowledge distillation includes: Collect training samples, wherein the training samples include user questions and / or business scenario questions; Input the training samples into the large language model and obtain the answer output by the large language model as a soft label; The soft tags are converted into structured soft tags according to a predefined structured template, wherein the structured template includes objects, events, relationships, constraints, and behaviors; The training samples are paired with structured soft labels to form training data pairs; The training data is used to train a lightweight student model, resulting in a pre-trained lightweight small model.

4. The intelligent agent system according to claim 1, characterized in that, The process of generating task complexity, first running parameters, second running parameters, calling parameters, and collaborative scheduling instructions for the execution layer, model inference layer, and cognition layer of the coordination tool based on scenario data includes: The task complexity is calculated based on the scenario data, using the following formula: ,in, The number of task steps. For data volume, , These are the first weighting coefficient and the second weighting coefficient, respectively. Based on the task complexity and system data, the first running parameters are generated, which include model call weight, word limit and model switching threshold; Based on task complexity and task priority, a second set of running parameters is generated, which includes state machine transition thresholds and memory recall strategies. Based on the task complexity and the tool call status of the tool execution layer, call parameters are generated, including the tool call timeout and the number of retries. Based on task data, system data, and environmental data, collaborative scheduling instructions are generated and output to the tool execution layer, model inference layer, and cognition layer. These collaborative scheduling instructions include task distribution instructions, exception collaborative handling instructions, and resource dynamic allocation instructions.

5. The intelligent agent system according to claim 1, characterized in that, The knowledge graph data output by the knowledge layer conforms to a predefined structured template, which includes five elements: objects, events, relationships, constraints, and behaviors. Among them, objects are used to represent enterprise business entities; events are used to represent business processes or system anomalies; relationships are used to represent the association between objects or the causal relationship between events; constraints are used to represent business rules or permission specifications; and behaviors are used to represent executable operations.

6. The intelligent agent system according to claim 1, characterized in that, The process of generating a task execution plan based on standardized data, knowledge graph data, and task complexity includes: Determine task objectives based on user needs identified in standardized data; Based on knowledge graph data, acquire structured knowledge related to the task objectives; Based on the task complexity output by the dynamic adaptation layer, determine the constraints for task execution; The task's state set and state transition rules are defined by an explicit state machine. The state set includes at least the planning state, execution state, verification state, reflection state, and termination state. Within the framework of an explicit state machine, a task execution plan is generated based on the task objective, structured knowledge, and constraints, including a sequence of task steps, a tool invocation plan, and expected results.

7. The intelligent agent system according to claim 1, characterized in that, The process of generating tool invocation requests, inference requests, and processing results based on the task execution plan includes: When the current step in the task execution plan needs to call an external tool, a tool call request is generated, which includes the tool identifier, input parameters, and user identity. When the current step in the task execution plan requires model inference, an inference request is generated. The inference request includes a description of the inference task and the context information necessary to perform this inference. When the steps in the task execution plan are completed and no further action is required, a processing result is generated, which includes the task execution conclusion, the generated answer, or action instructions.

8. The intelligent agent system according to claim 4, characterized in that, The step of verifying the tool execution result based on the second running parameters and triggering a regeneration of the task execution plan when an error occurs includes: Obtain the expected result set, wherein the expected result set includes at least one expected condition; Based on the tool's execution results, obtain the actual execution result set, wherein the actual execution result set includes at least one actual execution result element; Each actual execution result element in the actual execution result set is compared with the expected conditions in the expected result set one by one, and the number of elements that meet the expected conditions is counted. According to the formula The validity of the calculation results, among which, For the validity of the results, Indicates the number of elements in the set; when If the verification result is normal, proceed to the next task step in the task execution plan. This refers to the state machine transition threshold in the second operating parameter; when If the verification result is found to be abnormal, the task execution plan will be regenerated and the abnormal information will be recorded. Repeat the process until the task is completed or the preset maximum number of retries is reached; If the verification result is still abnormal after the maximum number of retries has been reached, manual intervention will be triggered.

9. The intelligent agent system according to claim 1, characterized in that, The process of receiving multi-source data and preprocessing it to obtain standardized data includes: Data from multiple sources is received through a unified interface across multiple channels, and the data from these sources is anonymized to obtain the anonymized data. The anonymized data is standardized to output standardized data. For numerical anonymized data, the following formula is used for standardization: ,in, To standardize data, This is the anonymized data. The mean of the anonymized data. This represents the standard deviation of the anonymized data.

10. A method for constructing an intelligent agent system according to any one of claims 1 to 9, characterized in that, include: A seven-layer collaborative architecture is deployed from bottom to top: perception layer, knowledge layer, tool execution layer, model inference layer, dynamic adaptation layer, cognition layer, and application layer. Interface connections and parameter initialization between each layer are completed to obtain a runnable intelligent agent. The knowledge layer is used to query the corresponding structured business data from the business system based on standardized data, and input the standardized data and structured business data into a pre-trained lightweight small model to output knowledge graph data. The tool execution layer is used to perform permission level verification based on the tool call request output by the cognition layer. After the verification is passed, the corresponding tool is called to execute according to the tool call request and the call parameters output by the dynamic adaptation layer, and the execution result is recorded and the tool execution result is output. The model inference layer is used to call the corresponding model for inference through the unified gateway based on the first running parameters and inference request, and output the model inference result. The dynamic adaptation layer is used to collect scene data in real time and generate task complexity, first running parameters, second running parameters, calling parameters, and coordinated scheduling instructions for the tool execution layer, model inference layer, and cognition layer based on the scene data. The scene data includes task data, system data, and environmental data. The task data includes the number of task steps, data volume, task type, and task priority. The system data includes the real-time load and response speed of each model in the model inference layer, the tool calling status of the tool execution layer, the overall system CPU utilization, and the overall system memory utilization. The environmental data includes the amount and type of multimodal data accessed by the perception layer. The cognitive layer is used to generate a task execution plan based on standardized data, knowledge graph data and task complexity, and to generate tool call requests, inference requests and processing results based on the task execution plan. It also verifies the tool execution results based on the second running parameters and triggers the regeneration of the task execution plan when the verification is abnormal. The application layer is used to receive the processing results output by the cognitive layer, and adapt the processing results to the corresponding format according to the configuration of the target business scenario, and output the target result adapted to the target business scenario.

Citation Information

Patent Citations

  • Knowledge graph construction method, device and equipment and readable storage medium

    CN118152591A

  • Intelligent agent automatic generation and scheduling system based on artificial intelligence large language model

    CN119690536A