Task processing method, device and equipment of intelligent agent, and computer program product

By proactively discovering tools and structuring ReAct execution processes, agents can more accurately and quickly select and invoke external tools, solving the problems of blind tool selection and resource waste in existing technologies, and achieving efficient and reliable processing of complex tasks.

CN122174989APending Publication Date: 2026-06-09中国邮政储蓄银行股份有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
中国邮政储蓄银行股份有限公司
Filing Date
2026-03-05
Publication Date
2026-06-09

Smart Images

  • Figure CN122174989A_ABST
    Figure CN122174989A_ABST
Patent Text Reader

Abstract

This application discloses a task processing method, apparatus, and computer program product for an intelligent agent. The method includes: receiving a user's current query task and performing pre-analysis using a large language model to obtain pre-analysis results; when the pre-analysis results indicate that external tools need to be called, searching a tool knowledge base based on the pre-analysis results to obtain tool knowledge retrieval results; performing reasoning analysis using a large language model based on the current query task and the tool knowledge retrieval results to obtain reasoning analysis results, which include tool information to be called by the current query task; and calling external tools to execute the current query task based on the reasoning analysis results, outputting the final task execution result. This application combines proactive tool discovery with a structured ReAct execution process to achieve efficient and accurate processing of complex query tasks by an intelligent agent; the pre-analysis stage can quickly divert tasks requiring tool support, avoiding invalid retrieval and resource waste.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent agent technology, and in particular to a task processing method, apparatus and device for intelligent agents, and computer program products. Background Technology

[0002] With the rapid development of large language model technology, agents based on large language models have become a cutting-edge research direction in human-computer interaction and automated task processing. By endowing large language models with the ability to plan, reason, and invoke external tools (such as APIs, databases, and function libraries), agents greatly expand their application boundaries, enabling them to perform complex, multi-step real-world tasks such as querying the weather, booking flights, and analyzing data. Among these, the ReAct (Reasoning and Acting) framework, by interleaving reasoning and action, significantly improves the agent's capabilities in task decomposition, state tracking, and error correction, and has become one of the mainstream technical paradigms for building advanced agents.

[0003] However, existing agents based on large language models and the ReAct framework still face a series of technical bottlenecks in the discovery, selection, and invocation of tools, limiting their scalability and robustness in complex, dynamic, and large-scale tool environments. Specifically:

[0004] (1) Blindness and inefficiency in tool selection: When there are a large number of available tools, injecting all the description information of all tools into the model's context window will cause context redundancy, drowning out key information, and may exceed the model's context length limit. This not only increases the model's reasoning burden, but also easily leads to the model having "choice difficulty" or "illusion" among many tools, mistakenly choosing irrelevant tools, thereby reducing the success rate and efficiency of task execution.

[0005] (2) Insufficient planning and adaptability for complex tasks: For complex tasks that require chained calls to multiple tools or dynamic adjustment of the execution path based on intermediate results, existing agents often struggle to generate optimal execution plans due to a lack of deep understanding of the dependencies between tools and applicable scenarios. Furthermore, if a tool call fails or returns unexpected results during execution, the agent often lacks effective error correction and replanning mechanisms, leading to task interruption.

[0006] (3) Uncontrollable performance and cost: In tool discovery, RAG (Retrieval-Augmented Generation) recall and multiple iterations, redundant retrieval and invalid attempts cause significant token and time overhead, making it difficult to balance latency and resource cost while ensuring effectiveness. Summary of the Invention

[0007] This application provides a task processing method, apparatus, device, and computer program product for intelligent agents, in order to improve the automation level, accuracy, and system scalability of intelligent agents in handling complex tasks.

[0008] The embodiments of this application adopt the following technical solutions:

[0009] In a first aspect, embodiments of this application provide a task processing method for an intelligent agent, the task processing method for the intelligent agent comprising:

[0010] Receive the user's current query task;

[0011] Based on the current query task, a pre-analysis is performed using a large language model to obtain the pre-analysis results of the large language model;

[0012] If the pre-analysis result indicates that external tools need to be called, a search is performed in the pre-built tool knowledge base based on the pre-analysis result to obtain the tool knowledge retrieval result corresponding to the current query task;

[0013] Based on the current query task and the corresponding tool knowledge retrieval results, a large language model is used for reasoning analysis to obtain the reasoning analysis results of the large language model. The reasoning analysis results include the tool information to be called by the current query task.

[0014] Based on the reasoning and analysis results, an external tool is invoked to execute the current query task, and the final task execution result is output.

[0015] Optionally, the step of performing pre-analysis using a large language model based on the current query task to obtain the pre-analysis results of the large language model includes:

[0016] Based on the current query task, a suggestion term is constructed. The suggestion term includes system role and instruction definition, MCP service domain context description and original query statement.

[0017] Based on the prompt words, the large language model is used for pre-analysis to obtain the pre-analysis results of the large language model. The pre-analysis results are either without calling external tools or require calling external tools and the current task analysis content.

[0018] Optionally, the pre-analysis results include the analysis content of the current task, and the step of searching in a pre-built tool knowledge base based on the pre-analysis results to obtain the tool knowledge retrieval results corresponding to the current query task includes:

[0019] The tool knowledge in the pre-built tool knowledge base is converted into high-dimensional vectors using a text embedding model, resulting in a tool vector knowledge base.

[0020] The text embedding model is used to convert the current task analysis content into a high-dimensional vector to obtain the high-dimensional vector of the current task analysis content.

[0021] Based on RAG technology, the high-dimensional vector of the current task analysis content is used to search the tool vector knowledge base to obtain the tool knowledge retrieval results corresponding to the current query task.

[0022] Optionally, the tool knowledge retrieval results include documentation for multiple tools. The step of using a large language model for reasoning analysis based on the current query task and the corresponding tool knowledge retrieval results to obtain the reasoning analysis results of the large language model includes:

[0023] Obtain historical process records;

[0024] The current query task, the documentation for multiple tools, the historical process records, and the default prompt words are assembled and input into the large language model;

[0025] The target tool and its documentation are determined using the large language model.

[0026] Extract the parameter information required by the target tool from the current query task and the documentation of the corresponding multiple tools, and assemble them to obtain the assembled tool parameter information;

[0027] Based on the target tool and the parameter information of the assembled tool, a structured action instruction is output, which is used to indicate the tool information to be invoked by the current query task.

[0028] Optionally, the step of calling an external tool to execute the current query task based on the reasoning analysis result, and outputting the final task execution result, includes:

[0029] The reasoning analysis results are parsed to obtain the tool information to be invoked by the current query task;

[0030] Based on the tool information to be invoked by the current query task, a standardized tool invocation request is generated using the MCP protocol;

[0031] The standardized tool call request invokes an external tool to execute the current query task and outputs the final task execution result.

[0032] Optionally, the step of calling an external tool to execute the current query task based on the reasoning analysis result, and outputting the final task execution result, includes:

[0033] Based on the reasoning and analysis results, an external tool is invoked to execute the current query task, and the current execution result is obtained;

[0034] Determine whether the loop termination condition is triggered based on the current execution result, the final task objective, and the number of task loops.

[0035] If the termination loop condition is triggered, the final task execution result is output.

[0036] Otherwise, the current query task is executed repeatedly until the termination loop condition is triggered.

[0037] Optionally, the final task execution result output includes:

[0038] Retrieve the task execution records of the current query task throughout the entire loop execution process;

[0039] The large language model is used to summarize the task execution records of the current query task throughout the entire loop execution process, and the final task execution result is output to the user.

[0040] Secondly, embodiments of this application also provide a task processing device for an intelligent agent, the task processing device for the intelligent agent comprising:

[0041] The receiving unit is used to receive the user's current query task;

[0042] The pre-analysis unit is used to perform pre-analysis using a large language model based on the current query task, and obtain the pre-analysis results of the large language model.

[0043] The retrieval unit is used to retrieve the tool knowledge from a pre-built tool knowledge base based on the pre-analysis results when the pre-analysis results indicate that external tools need to be called, so as to obtain the tool knowledge retrieval results corresponding to the current query task.

[0044] The reasoning unit is used to perform reasoning analysis using a large language model based on the current query task and the corresponding tool knowledge retrieval results, and to obtain the reasoning analysis results of the large language model, which include the tool information to be called by the current query task.

[0045] The execution and output unit is used to call external tools to execute the current query task based on the reasoning analysis results, and to output the final task execution results.

[0046] Thirdly, embodiments of this application also provide an apparatus, comprising:

[0047] A processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to perform a task processing method of any of the aforementioned intelligent agents.

[0048] Fourthly, embodiments of this application also provide a computer program product, including a computer program / instructions, which, when executed by a processor, implements the task processing method of any of the aforementioned intelligent agents.

[0049] The above-mentioned technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: The task processing method of the intelligent agent in the embodiments of this application first receives the user's current query task; then, based on the current query task, it performs pre-analysis using a large language model to obtain the pre-analysis result of the large language model; then, if the pre-analysis result indicates that an external tool needs to be called, it searches in a pre-built tool knowledge base based on the pre-analysis result to obtain the tool knowledge retrieval result corresponding to the current query task; then, based on the current query task and the corresponding tool knowledge retrieval result, it performs reasoning analysis using a large language model to obtain the reasoning analysis result of the large language model, which includes the tool information to be called by the current query task; finally, based on the reasoning analysis result, it calls the external tool to execute the current query task and outputs the final task execution result. The embodiments of this application combine proactive tool discovery with a structured ReAct execution process to achieve efficient and accurate processing of complex query tasks by the intelligent agent. The pre-analysis stage quickly diverts tasks that require tool support, avoiding invalid retrieval and waste of computing resources, and reducing response latency; the deep integration of the structured tool knowledge base and model reasoning ensures the accuracy of tool calls and the automation of parameter filling. Overall, it enhances the ability of intelligent agents to handle multi-domain and multi-modal tasks, enabling them to flexibly respond to dynamically changing user needs. At the same time, it optimizes resource utilization and response speed, providing users with a more intelligent and reliable task execution experience. Attached Figure Description

[0050] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0051] Figure 1 This is a flowchart illustrating a task processing method for an intelligent agent according to an embodiment of this application;

[0052] Figure 2 This is a schematic diagram of the task processing flow of an intelligent agent in an embodiment of this application;

[0053] Figure 3 This is a schematic diagram of the structure of a task processing device for an intelligent agent according to an embodiment of this application;

[0054] Figure 4 This is a schematic diagram of the structure of a device according to an embodiment of this application. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0056] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0057] The technical terms used in this application mainly include:

[0058] (1) Model Context Protocol (MCP): An open protocol designed to standardize the interaction between large language models (LLMs) and external tools and data sources, enabling LLMs to seamlessly connect with various external tools (such as databases, APIs, and file systems) and services, and to realize dynamic calls to data and functions.

[0059] (2) ReAct (Reasoning and Acting): An AI agent framework that combines reasoning and acting, aiming to solve complex tasks and improve the interpretability of decisions by alternating between internal logical analysis and external tool invocation. Its core idea is to simulate the human "think-act-feedback" cycle, enabling the Large Language Model (LLM) to both plan steps using its internal reasoning ability and obtain real-time information or perform operations by invoking external tools.

[0060] (3) Vector knowledge base: A system specifically designed for storing, managing and retrieving high-dimensional vector data. It transforms unstructured data such as text, images and audio into vector representations to achieve efficient similarity search and complex data analysis.

[0061] (4) Prompt Engineering: A technique that enables large language models to accurately understand task requirements and generate expected results by structuring and optimizing input text (prompt words).

[0062] Existing technologies have made preliminary explorations in the field of intelligent agents based on the ReAct framework, aiming to achieve automated task processing through large language models. For example, Patent Document 1 (Application No.: 202510875086.0) discloses a ReAct implementation method applied to the field of business intelligence (BI), the core of which lies in guiding a large language model to perform cyclical reasoning and actions through a preset Prompt project to complete data query and analysis tasks. Patent Document 2 (Application No.: 202510653040.4) discloses an agent loop method applied to the field of operations and maintenance, characterized by iteratively determining and calling the target tool for the next stage based on the results of the completed stages.

[0063] Although the above solutions apply the ReAct framework to improve task automation in specific domains, they still share common and significant technical shortcomings in terms of system tool discovery mechanisms, operational efficiency, and architectural scalability, as detailed below:

[0064] (1) The lack of proactive and accurate tool discovery mechanisms leads to low reasoning efficiency and high costs.

[0065] Existing technologies typically employ a static or global approach to providing tool information. This means that before ReAct inference begins, the system needs to inject a relatively fixed and potentially large set of tools, describing all or part of the context into the model. As the number of available tools increases, this "full context injection" strategy raises a series of problems:

[0066] 1) Context pollution and inference interference: A large amount of irrelevant tool information will form noise, interfere with the model's attention, increase its cognitive burden when selecting the correct tool, and easily lead to "illusion" or wrong selection, thus reducing the success rate of the task.

[0067] 2) Huge computational and time overhead: The longer context directly leads to higher token consumption and longer response latency during reasoning in large language models. Each round of the "reasoning-action-observation" loop needs to process redundant information, resulting in unnecessary waste of computational resources and time costs, making it difficult to control the system's performance and cost.

[0068] 3) Scalability bottleneck: When the tool library grows on a large scale, this pattern will quickly reach the physical limit of the model context length, which fundamentally limits the system's ability to access more tools.

[0069] (2) The lack of task pre-analysis and diversion mechanism leads to unnecessary process overhead.

[0070] The aforementioned existing technical solutions generally adopt an "integrated" processing flow, meaning that all user inputs are assumed to trigger a complex ReAct loop. However, in practical applications, many user queries (such as simple greetings and common-sense questions) do not require invoking any external tools. Existing solutions lack a pre-emptive, lightweight intent classification and analysis mechanism, failing to effectively identify and route these non-tool-invoking tasks. This forces even the simplest queries into a resource-intensive ReAct process, resulting in significant computational waste, unnecessarily increasing the system's average response time, and negatively impacting user experience.

[0071] In view of the aforementioned deficiencies in existing technologies for agent implementations based on the ReAct framework, this application aims to solve the following core technical problems, with the technical objective of providing a more efficient, intelligent, and scalable proactive tool discovery scheme when dealing with large-scale, dynamic tool environments. Specifically, the technical problems this application seeks to solve include:

[0072] (1) To solve the problem of low reasoning efficiency and high cost caused by the lack of proactive and accurate tool discovery mechanisms.

[0073] To address the drawbacks of existing technologies that employ static or global toolsets, such as redundant model context, low inference efficiency, uncontrollable costs, and poor scalability, this application aims to establish an "on-demand, real-time" proactive tool discovery mechanism. Before ReAct inference, the user task is first classified into different domains, and Retrieval Augmentation (RAG) technology is used to dynamically recall a subset of tools highly relevant to the current task, thus constructing a concise and focused contextual environment for large language models.

[0074] Improve the accuracy of tool selection and inference efficiency: Eliminate interference from irrelevant tool information so that the model can select and use the correct tools more quickly and accurately, thereby improving the success rate of task execution.

[0075] Reduced operating costs and response latency: The significantly reduced context length of the input model directly reduces the token consumption and computational overhead of each round of inference, thereby significantly reducing the system's operating costs and response time.

[0076] Enhanced system scalability: It breaks the physical limitation of model context length on tool library size, enabling agents to discover and use tools from a large and dynamically updated knowledge base, thereby enabling them to manage and utilize massive amounts of tools.

[0077] (2) Solve the problem of system resource waste and process redundancy caused by the lack of task pre-analysis and diversion mechanism.

[0078] To address the shortcomings of existing technologies that indiscriminately feed all queries into a heavy ReAct loop, leading to overprocessing of simple tasks, this application aims to introduce a pre-analysis and intelligent routing mechanism for tasks. Upon receiving a user query, this mechanism first determines whether an external tool needs to be invoked.

[0079] Optimize system resource allocation: For queries that do not require calling tools (such as general Q&A and casual chat), a lightweight direct response path will be adopted, avoiding the need to start and execute the resource-intensive ReAct framework, thereby achieving rational and efficient utilization of computing resources.

[0080] Improve the overall user experience: By matching the optimal processing path for different types of tasks, the response latency of simple queries is significantly reduced, improving the overall operating efficiency of the system and the smoothness of user interaction.

[0081] Specifically, embodiments of this application provide a task processing method for an intelligent agent, such as... Figure 1 The diagram shows a flowchart of a task processing method for an intelligent agent according to an embodiment of this application. The task processing method for the intelligent agent includes the following steps S110 to S150:

[0082] Step S110: Receive the user's current query task.

[0083] Combination Figure 2 This application provides a schematic diagram of a task processing flow for an intelligent agent according to an embodiment. The intelligent agent receives query statements input by the user through a preset user interaction interface (such as an API, web interface, or mobile input box). The query statement can be text in natural language, covering needs such as problem solving, operation instructions, or information retrieval. The intelligent agent stores the original query statement as a string and marks it as the current task to be processed, ensuring that subsequent steps are based on the original input for complete analysis.

[0084] Step S120: Based on the current query task, perform pre-analysis using a large language model to obtain the pre-analysis results of the large language model.

[0085] The agent inputs the user's query into a pre-trained large language model. Through semantic understanding and task classification techniques, it quickly identifies the domain (e.g., mathematical calculation, weather query, database operation) and task type (e.g., fact-finding, tool invocation, logical reasoning). Based on the classification results, the model generates pre-analysis labels: if the task can be answered directly by the model's own capabilities (e.g., simple arithmetic), it is labeled "no tool required"; if it requires external tools (e.g., calling a weather API), it is labeled "tool required".

[0086] The above steps, by classifying and analyzing the user's input query, can quickly and accurately determine whether the user's query needs to be solved by calling external tools. This avoids invalid tool searches and ReAct loops for all inputs, thereby saving computing resources and reducing response latency.

[0087] Step S130: If the pre-analysis result indicates that an external tool needs to be called, a search is performed in the pre-built tool knowledge base based on the pre-analysis result to obtain the tool knowledge retrieval result corresponding to the current query task.

[0088] When the pre-analysis result indicates "tools need to be called," the agent performs a semantic search in a pre-built tool knowledge base based on the task analysis results from the preceding steps. This knowledge base stores all tool information that can be called via the MCP protocol in a structured format. Each tool document contains information such as the tool name, function description, input parameter list (parameter name, type, required, description), and document segment identifiers (\n\n,\n). During the search, the agent retrieves the tool documents most relevant to the query task from the knowledge base through keyword matching or vector similarity calculation, and sorts them by matching degree, prioritizing the return of tool information whose function descriptions highly match the task requirements.

[0089] Step S140: Based on the current query task and the corresponding tool knowledge retrieval results, use the large language model to perform reasoning analysis to obtain the reasoning analysis results of the large language model. The reasoning analysis results include the tool information to be called by the current query task.

[0090] The intelligent agent inputs the user's query and retrieved tool documents (such as tool names and parameter lists) into a large language model. The model then integrates multimodal information and uses logical reasoning to plan a specific tool invocation scheme. This step simulates the human "thinking" process, ensuring the accuracy of tool invocation and the rationality of parameter filling.

[0091] Step S150: Based on the reasoning analysis results, call external tools to execute the current query task and output the final task execution result.

[0092] The agent generates a tool invocation request conforming to the MCP protocol based on the inference results and sends the request to the external tool service through a standardized interface (such as HTTP or gRPC). After the tool executes, the agent receives the raw response data, parses and formats it, and determines whether the task is complete. If the task is complete, the agent summarizes the processing information and generates a natural language response; if the task is not complete, it triggers a re-inference or error message process, forming a complete "inference-action-observation" closed loop.

[0093] This application's embodiments combine proactive tool discovery with a structured ReAct execution process to achieve efficient and accurate processing of complex query tasks by the intelligent agent. The pre-analysis stage quickly identifies tasks requiring tool support, avoiding invalid searches and wasted computing resources, and reducing response latency. The deep integration of a structured tool knowledge base and model inference ensures the accuracy of tool calls and the automation of parameter filling. Overall, this enhances the agent's ability to handle multi-domain, multi-modal tasks, enabling it to flexibly respond to dynamically changing user needs, while optimizing resource utilization and response speed, providing users with a more intelligent and reliable task execution experience.

[0094] In some embodiments of this application, the step of performing pre-analysis using a large language model based on the current query task to obtain the pre-analysis result of the large language model includes: constructing prompt words based on the current query task, wherein the prompt words include system role and instruction definitions, MCP service domain context descriptions, and the original query statement; and performing pre-analysis using the large language model based on the prompt words to obtain the pre-analysis result of the large language model, wherein the pre-analysis result is either without calling external tools or requires calling external tools and the current task analysis content.

[0095] Continue to refer to Figure 2 After receiving the user's original query (denoted as user_query), the agent first constructs a structured prompt, which mainly consists of three parts:

[0096] (1) System Role and Instruction Definition: The roles and task objectives of the large language model are clearly defined through natural language. For example: "You are an intelligent assistant responsible for analyzing user input and determining whether external tools need to be called to solve the problem. Only consider using tools when necessary." This part guides the model to focus on task pre-analysis through role constraints, avoiding the generation of irrelevant content.

[0097] (2) MCP service domain context description: Provides a domain overview description of the tools that the current MCP server can call, such as: "The current service supports three types of tools: weather query, calendar management, and mathematical calculation. Each tool provides functions through API, without requiring users to manually input parameters." This description summarizes the tool capability boundaries in concise non-technical language, helping the model quickly understand the scope of callable resources, rather than relying on lengthy API documentation.

[0098] (3) Original user query: append user_query to the end of the prompt word as is, for example: "User query: Will it rain in Beijing tomorrow?" This part preserves the complete semantics of the original input to ensure that the model analysis is not affected by information loss.

[0099] The final prompt example is: "You are an intelligent assistant... The current service supports weather queries, calendar management, mathematical calculations... User query: Will it rain in Beijing tomorrow?", providing a complete context for model inference.

[0100] The constructed prompt words are input into a large language model for inference. The model makes the following decisions based on semantic understanding and context matching:

[0101] (1) No need to call tools: If the model determines that the query can be answered directly by its own knowledge base (such as common sense questions and casual conversation), then a natural language response will be generated. This path skips the subsequent tool retrieval and calling process and directly responds to the user, ensuring the immediacy of simple queries.

[0102] (2) Requires calling tools: If the model's determination depends on external tools (such as a weather API), then the output should be a structured "task analysis content", which mainly includes:

[0103] 1) Task type: Clearly define the tool domain to be invoked;

[0104] 2) Intent Extraction: Extracting key information from the query;

[0105] 3) Parameter mapping: Convert natural language parameters into a format that the tool can recognize.

[0106] This structured output serves as an optimized query for subsequent knowledge base retrieval tools, significantly improving recall accuracy.

[0107] This application's embodiments achieve efficient classification and optimized resource allocation of user queries by the intelligent agent through a "task pre-analysis and decision-making diversion" mechanism. Utilizing structured prompts and MCP service domain context, the large language model can quickly distinguish between simple queries and complex tool call requests, directly diverting non-tool queries to the regular question-and-answer path, avoiding invalid tool retrieval and ReAct loops. This design significantly reduces the system's consumption of computing resources, especially in large-scale concurrent scenarios, by greatly shortening the average response time by reducing unnecessary tool call processes. Simultaneously, the structured task analysis content provides accurate query input for subsequent tool retrieval, improving the accuracy and execution efficiency of tool calls.

[0108] In some embodiments of this application, the pre-analysis result includes the analysis content of the current task. The step of retrieving the tool knowledge corresponding to the current query task from a pre-built tool knowledge base based on the pre-analysis result includes: converting the tool knowledge in the pre-built tool knowledge base into high-dimensional vectors using a text embedding model to obtain a tool vector knowledge base; converting the analysis content of the current task into high-dimensional vectors using the text embedding model to obtain a high-dimensional vector of the analysis content of the current task; and retrieving the tool knowledge corresponding to the current query task from the tool vector knowledge base using the high-dimensional vector of the analysis content of the current task based on RAG technology.

[0109] Continue to refer to Figure 2 In this embodiment of the application, the pre-built tool knowledge base is first subjected to structured processing and vectorization transformation. The specific steps are as follows:

[0110] (1) Document segmentation and standardization: Each tool document in the tool knowledge base (including tool name, function description, input parameter list, etc.) is segmented according to semantic integrity. The segmentation identifier is “\n\n,\n”, ensuring that each segment (chunk) contains independent and complete semantic units. For example, the document of a weather query tool may be segmented into multiple chunks such as “Tool name: Weather query API”, “Function description: Provides real-time weather data”, and “Parameter list: City (required), Date (optional)”.

[0111] (2) Vectorization of text embedding models: Each tool document chunk is converted into a high-dimensional vector using a pre-trained text embedding model (such as BERT, Sentence-BERT, etc.) to generate a "tool vector knowledge base". During the vectorization process, the model captures the semantic features of the document through a self-attention mechanism to ensure that semantically similar tool documents are close in the vector space. For example, tool documents with the function descriptions "query city temperature" and "get real-time weather" will be mapped to similar vector positions.

[0112] (3) Vectorization and retrieval of current task analysis content

[0113] Based on the "task analysis content" (structured or semi-structured text, including task type, intent extraction, parameter mapping, etc.) output by the large language model in the aforementioned embodiments, perform the following operations:

[0114] (1) Task content vectorization: Using the same text embedding model as the tool knowledge base, the task analysis content is converted into a high-dimensional vector. For example, if the task analysis content is "Task type: weather query; intent: get the weather in Beijing tomorrow; parameters: city=Beijing, date=XXXX-XX-XX", the model will extract key semantics (such as "weather query", "Beijing" and "tomorrow") and generate corresponding vectors.

[0115] (2) RAG-based similarity retrieval: Using RAG technology, the cosine similarity between the task analysis content vector and all document vectors in the tool vector knowledge base is calculated. The similarity is sorted from high to low, and the Top-K most relevant tool documents are selected as the retrieval results. For example, if the task involves "weather query", tool documents containing keywords such as "weather", "temperature" and "precipitation" in their function descriptions are retrieved first.

[0116] The retrieved Top-K tool documents are post-processed and organized into a structured context to optimize the input for subsequent ReAct inference.

[0117] This application's embodiments achieve efficient semantic retrieval and precise recall of tool knowledge bases by combining text embedding models with RAG retrieval technology. Vectorized representation maps tool documents and task analysis content to the same semantic space, directly matching the most relevant tools through similarity calculation, avoiding the semantic ambiguity problems of traditional keyword retrieval. Simultaneously, RAG technology significantly expands the agent's knowledge boundary by dynamically retrieving external knowledge, enabling it to handle tool invocation requests not pre-encoded in the model. Furthermore, structured task analysis content provides precise query input for retrieval, further enhancing the targeting of tool recall.

[0118] In some embodiments of this application, the tool knowledge retrieval results include documentation for multiple tools. The step of using a large language model for reasoning analysis based on the current query task and the corresponding tool knowledge retrieval results to obtain the reasoning analysis results of the large language model includes: acquiring historical process records; assembling the current query task, the documentation for multiple tools, the historical process records, and default prompts, and inputting them into the large language model; using the large language model to determine the target tool and its documentation; extracting and assembling the parameter information required by the target tool from the current query task and the documentation for the corresponding multiple tools to obtain assembled tool parameter information; and outputting structured action instructions based on the target tool and the assembled tool parameter information, wherein the action instructions are used to instruct the current query task to call the tool information.

[0119] Continue to refer to Figure 2In the ReAct inference process, the large language model integrates multi-dimensional information to complete tool selection and parameter assembly, as specifically implemented as follows:

[0120] (1) Input Information Assembly: The user's original query, multiple tool description documents retrieved (such as the "Tool Name-Function Description-Parameter List" of the Top-K tool), historical "Think-Action-Observation" records, and preset default prompts are structurally assembled. For example, the input format is: "User Query: [Content]; Tool Document: [Document 1]; History: [Previous Round of Actions and Observations]; Prompts: [System Roles and Task Definitions]". This assembly ensures that the model understands the full picture of the task in the complete context.

[0121] (2) Tool selection logic: The model selects the optimal solution from multiple tools based on the semantic matching degree between the task objective and the tool function description. For example, if the user query is "query the probability of precipitation in Beijing in the next three days", the model will compare the "function description" field of each tool document and give priority to the tool marked "supports multi-day weather forecast".

[0122] (3) Parameter extraction and assembly: Extract explicit parameters (such as "Beijing" and "three days") from user queries, and infer implicit parameters (such as "precipitation probability" corresponding to the tool parameter "precipitation_chance") by combining the "parameter requirements" field in the tool documentation. Assemble the parameters according to the format required by the tool (such as JSON) to ensure that the required parameters are complete and of the correct type.

[0123] (4) Action instruction generation: Output structured "Action" instructions, clearly specifying the tool name and parameter values. This instruction directly drives subsequent execution steps, forming a closed loop of "thinking-action-observation".

[0124] This application's embodiments achieve a high degree of automation and precision in tool selection and parameter assembly through the ReAct inference process. By integrating multi-source information such as user queries, tool documentation, and historical records, the large language model can simulate the human "thinking" process, dynamically planning the optimal tool invocation path in complex task scenarios, avoiding the tediousness and errors of manual configuration. Simultaneously, the structured action instructions and standardized design of the MCP protocol ensure the reliability of tool invocation and system scalability, enabling the intelligent agent to flexibly respond to multi-domain, multi-step task requirements.

[0125] In some embodiments of this application, the step of calling an external tool to execute the current query task based on the reasoning analysis result and outputting the final task execution result includes: parsing the reasoning analysis result to obtain the tool information to be called by the current query task; generating a standardized tool call request using the MCP protocol based on the tool information to be called by the current query task; calling an external tool to execute the current query task using the standardized tool call request and outputting the final task execution result.

[0126] Continue to refer to Figure 2 In the ReAct execution phase, a standardized protocol ensures reliable execution and result feedback of tool calls. Specifically, the structured "Action" instructions output by the large language model are first parsed to extract key fields (such as tool name and parameter information). According to the Model Context Protocol (MCP) specification, the parsed tool information is converted into a standardized call request. The MCP protocol defines the request format, parameter type validation rules, and error code system. The call request is relayed through the MCP tool server, achieving decoupling between the model and the tool service. The server routes the request to the corresponding service endpoint based on the tool name, executes the tool function (such as calling the HTTP interface of the weather API), and captures the raw response data. If the call fails, the server returns standardized error information.

[0127] The raw data or error messages returned by the tool are encapsulated into a unified format of task execution results, including fields such as tool name, execution status (success / failure), response data, and timestamp, for subsequent steps or user display.

[0128] The embodiments of this application construct an efficient and secure communication bridge between the model and tool services, providing a stable infrastructure for the multi-round execution of complex tasks. Through the MCP protocol, the standardization and decoupling of tool calls are realized, which significantly improves the reliability and flexibility of the interaction between the agent and external tools.

[0129] In some embodiments of this application, the step of calling an external tool to execute the current query task based on the reasoning analysis result and outputting the final task execution result includes: calling an external tool to execute the current query task based on the reasoning analysis result to obtain the current execution result; determining whether a termination loop condition is triggered based on the current execution result, the final task objective, and the number of task loops; if the termination loop condition is triggered, outputting the final task execution result; otherwise, executing the current query task repeatedly until the termination loop condition is triggered.

[0130] Continue to refer to Figure 2In the ReAct observation phase, the matching degree between the execution results and the task objectives is dynamically evaluated to achieve closed-loop control through multiple rounds of interaction.

[0131] Specifically, the current execution result returned by external tools is structured and parsed to extract key information (such as data fields, error codes, and execution status). Combining the final task objective with the current execution result, it is determined whether a termination loop condition has been triggered. Termination conditions fall into two categories:

[0132] 1) Task completion conditions: The current results fully meet the task requirements (e.g., all required weather indicators have been obtained).

[0133] 2) Maximum iteration limit: If the number of iterations reaches a preset threshold (e.g., 5 times), the loop will be forcibly terminated to avoid infinite loop.

[0134] If the task is completed or the maximum number of iterations is reached, the final task execution result (such as integrating complete weather data returned by multiple rounds of tools) is directly output, and the process ends. If the task is not completed and the maximum number of iterations has not been reached, new context information is generated based on the current result (such as supplementing missing parameters and correcting query intent), and a new round of "reasoning-execution-observation" loop is triggered. In each loop, the current execution result, model decision logic, and context state are updated to the historical process record for reference in subsequent reasoning stages.

[0135] The embodiments of this application construct a closed-loop control mechanism of "observation-decision-execution", which enables the intelligent agent to gradually approach the task goal like a human. Through dynamic termination condition evaluation and multi-round interactive control, it realizes the adaptive execution of complex tasks and efficient utilization of resources.

[0136] In some embodiments of this application, the output of the final task execution result includes: obtaining the task execution record of the current query task during the entire loop execution process; summarizing the task execution record of the current query task during the entire loop execution process using the large language model, and outputting the final task execution result to the user.

[0137] In the information integration and natural language response stage, a large language model is used to perform semantic understanding and content extraction on multi-round interaction records to generate a final response that conforms to the user's cognitive habits.

[0138] Specifically, the system first extracts the complete execution trajectory of the current query task within the ReAct loop from historical records, including the user's original query, the results of each round of inference analysis (such as tool selection logic and parameter assembly basis), tool execution results (such as success / failure status and returned data), and intermediate state changes (such as parameter correction records). Then, the entire record is input into a large language model. Based on context learning, the model can understand the logical connections between each round (such as the causal relationship between failure reasons and subsequent corrections), extracting the core information of interest to the user from the integrated context (such as task goal achievement status and key data results), while hiding unnecessary technical details. Finally, based on the user's query language style (such as formal / colloquial) and task type (such as information query / operation guidance), a fluent, natural, and human-like message is organized to report the final result to the user.

[0139] The embodiments of this application build a bridge between "technical execution" and "user perception", enabling intelligent agents to maintain efficiency while providing a human-like interactive experience when handling complex tasks. Through semantic integration of multi-turn interaction records and natural language generation, the transparency and friendliness of the interaction between intelligent agents and users are significantly improved.

[0140] In summary, the key points of this application are mainly as follows:

[0141] (1) A pre-analysis and decision-making scheme for tasks: Before entering the complex tool retrieval and ReAct loop, an independent, lightweight task pre-analysis step is set up. This step constructs specific prompt words containing "MCP service domain context" to enable the large model to quickly determine whether the user query involves tool calls, thereby achieving immediate response to non-tool tasks and accurate routing of tool tasks.

[0142] (2) An optimization scheme that links task pre-analysis with RAG retrieval: When the pre-analysis step determines that a tool needs to be invoked, its output is not a simple "yes / no" signal, but generates a structured "task analysis content" (including task domain, intent, entity, etc.). This content is used as the core query input for subsequent RAG retrieval, which significantly improves the accuracy and relevance of retrieving the correct tool from the tool knowledge base.

[0143] (3) A system architecture that deeply integrates the MCP protocol with the ReAct agent framework: This application clearly defines a complete, end-to-end technical process. This process organically combines task pre-analysis, enhanced RAG retrieval, MCP-based standardized tool execution, and ReAct's reasoning-action-observation loop to form a closed-loop, iterative, and automated proactive tool invocation system.

[0144] (4) A step-by-step focused tool discovery mechanism from “domain” to “tool”: Unlike the traditional method of directly matching specific tools with the user’s original query, this application adopts a two-stage focused strategy. First, a coarse-grained “service domain” judgment is made through a pre-analysis step; then, the judgment result is used to guide RAG to perform fine-grained precise retrieval of “specific tools”, thereby improving the efficiency and accuracy of tool discovery.

[0145] Compared with the prior art, this application has achieved at least the following technical effects:

[0146] (1) Improved the accuracy of tool discovery and system operating efficiency, and solved the problems of inefficient reasoning and high cost caused by "full context injection".

[0147] Existing technologies tend to provide a relatively fixed "tool set" or a "preset prompt" to large models, which is a static and full-scale context injection approach. When the tool library is large, a large amount of irrelevant tool information will pollute the context and interfere with the model's judgment, leading to an increase in tool selection error rate, token consumption, and inference latency.

[0148] Unlike other methods, this application employs a "Pre-analysis-guided Dynamic Retrieval (RAG)" mechanism. Because this application first refines the user's fuzzy query into a clear "task domain" and "task analysis content" through pre-analysis, it can use this precise signal as the query input for RAG, retrieving the most relevant small number of tools from the tool knowledge base. Therefore, the context injected into the ReAct inference process is highly relevant, concise, and effective. This not only significantly reduces the cognitive burden on the model and improves the accuracy of tool selection, but also significantly reduces computational resource consumption and response time, fundamentally solving the bottleneck of scalable tool library expansion.

[0149] (2) An intelligent task diversion mechanism has been added to solve the problem of process overhead and resource waste caused by treating all queries "equally".

[0150] Existing technologies are designed with the assumption that all inputs require the initiation of a ReAct loop. Because they lack a pre-processing intent recognition step, even if the user only makes a simple greeting or asks a common-sense question, the system will still initiate the entire resource-intensive "reasoning-action" loop, resulting in unnecessary waste of computing power and delays.

[0151] Unlike other approaches, this application innovatively incorporates a "task pre-analysis and decision-making routing" step at the very beginning of the process. This step leverages a large model combined with the "MCP service domain context" to quickly determine whether a user query requires tool invocation. Therefore, it can directly route a large number of non-tool-related queries (such as casual conversation and common-sense questions) to the regular question-and-answer path, bypassing the subsequent complex tool discovery and execution processes. Thus, this application avoids overcomplicated processes for simple queries, significantly conserves system resources, and substantially reduces the system's average response time, thereby macroscopically improving the system's throughput and user experience.

[0152] This application embodiment also provides a task processing device 300 for an intelligent agent, such as... Figure 3 The diagram shows a structural schematic of a task processing device for an intelligent agent according to an embodiment of this application. The task processing device 300 for the intelligent agent includes:

[0153] The receiving unit 310 is used to receive the user's current query task;

[0154] The pre-analysis unit 320 is used to perform pre-analysis using a large language model based on the current query task, and obtain the pre-analysis result of the large language model;

[0155] The retrieval unit 330 is used to retrieve the tool knowledge base in a pre-built tool knowledge base based on the pre-analysis result when the pre-analysis result indicates that an external tool needs to be called, so as to obtain the tool knowledge retrieval result corresponding to the current query task.

[0156] The reasoning unit 340 is used to perform reasoning analysis using a large language model based on the current query task and the corresponding tool knowledge retrieval results, and to obtain the reasoning analysis results of the large language model, wherein the reasoning analysis results include the tool information to be called by the current query task.

[0157] The execution and output unit 350 is used to call external tools to execute the current query task based on the reasoning analysis results, and to output the final task execution results.

[0158] In some embodiments of this application, the pre-analysis unit 320 is specifically used to: construct prompt words based on the current query task, the prompt words including system roles and instruction definitions, MCP service domain context descriptions and original query statements; perform pre-analysis using the large language model based on the prompt words to obtain the pre-analysis results of the large language model, the pre-analysis results being either without calling external tools or requiring the calling of external tools and the analysis content of the current task.

[0159] In some embodiments of this application, the pre-analysis result includes the analysis content of the current task, and the retrieval unit 330 is specifically used to: convert the tool knowledge in the pre-built tool knowledge base into a high-dimensional vector using a text embedding model to obtain a tool vector knowledge base; convert the analysis content of the current task into a high-dimensional vector using the text embedding model to obtain a high-dimensional vector of the analysis content of the current task; and, based on RAG technology, perform a retrieval in the tool vector knowledge base using the high-dimensional vector of the analysis content of the current task to obtain the tool knowledge retrieval result corresponding to the current query task.

[0160] In some embodiments of this application, the tool knowledge retrieval results include descriptions of multiple tools. The reasoning unit 340 is specifically used for: acquiring historical process records; assembling the current query task, the descriptions of multiple tools, the historical process records, and default prompts, and inputting them into the large language model; using the large language model to determine the target tool and its description; extracting and assembling the parameter information required by the target tool from the current query task and the corresponding descriptions of multiple tools to obtain assembled tool parameter information; and outputting structured action instructions based on the target tool and the assembled tool parameter information, wherein the action instructions are used to instruct the tool information to be invoked by the current query task.

[0161] In some embodiments of this application, the execution and output unit 350 is specifically used to: parse the reasoning analysis result to obtain the tool information to be called by the current query task; generate a standardized tool call request using the MCP protocol based on the tool information to be called by the current query task; call an external tool to execute the current query task using the standardized tool call request; and output the final task execution result.

[0162] In some embodiments of this application, the execution and output unit 350 is specifically used to: call an external tool to execute the current query task based on the reasoning analysis result, and obtain the current execution result; determine whether the current termination loop condition is triggered based on the current execution result, the final task objective, and the number of task loops; if the termination loop condition is triggered, output the final task execution result; otherwise, execute the current query task in a loop until the termination loop condition is triggered.

[0163] In some embodiments of this application, the execution and output unit 350 is specifically used to: obtain the task execution records of the current query task throughout the entire loop execution process; summarize the task execution records of the current query task throughout the entire loop execution process using the large language model, and output the final task execution result to the user.

[0164] It is understood that the task processing device of the above-mentioned intelligent agent can implement each step of the task processing method of the intelligent agent provided in the foregoing embodiments. The relevant explanations of the task processing method of the intelligent agent are applicable to the task processing device of the intelligent agent, and will not be repeated here.

[0165] Figure 4 This is a schematic diagram of the structure of a device according to an embodiment of this application. For example... Figure 4 As shown, the device includes one or more processors (or processing units), and may also include one or more memories coupled to the processors, and may also include a communication module coupled to the processors.

[0166] A communication module can be used to communicate with other devices or apparatuses, such as sending or receiving data and / or signals. A communication module may have at least one communication module for communication. A communication module may include any interface necessary for communicating with other devices. Exemplarily, a communication module may be a transceiver, circuit, bus, module, or other type of communication module.

[0167] The processor may include, but is not limited to, one or more of the following: a general-purpose computer, a special-purpose computer, a microcontroller, a digital signal processor (DSP), or a controller-based multi-core controller architecture. The device may have multiple processors, such as application-specific integrated circuit (ASIC) chips, which are time-dependent on a clock synchronized with the main processor.

[0168] The memory may include one or more non-volatile memories and one or more volatile memories. Examples of non-volatile memories include, but are not limited to, at least one of the following: read-only memory (ROM), electrically programmable read-only memory (EPROM), flash memory, hard disk, compact disc (CD), digital video disc (DVD), or other magnetic and / or optical storage. Examples of volatile memories include, but are not limited to, at least one of the following: random access memory (RAM), or other volatile memories that do not persist during the duration of a power outage.

[0169] A computer program consists of computer-executable instructions that are executed by an associated processor. Programs can be stored in ROM. A processor can perform any appropriate action and processing by loading the program into RAM.

[0170] Possible implementations of this application can be achieved through a program, enabling the communication device to execute any of the processes discussed in the foregoing embodiments. Possible implementations of this application can also be achieved through hardware or a combination of software and hardware.

[0171] In some implementations, the program may be tangibly contained in a computer-readable storage medium, which may include in a device (such as in memory) or other storage device accessible by the device. The program may be loaded from the computer-readable storage medium into RAM for execution. The computer-readable storage medium may include any type of tangible non-volatile memory, such as ROM, EPROM, flash memory, hard disk, CD, DVD, etc.

[0172] This application also provides a computer-readable storage medium storing computer instructions or program code thereon, which, when executed by a processor, causes the processor to perform the methods and functions involved in any of the above embodiments. A computer-readable medium can be any tangible medium that contains or stores a program for or relating to an instruction execution system, apparatus, or device. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. More detailed examples of computer-readable storage media include electrical connections with one or more wires, magnetic media (e.g., disks, floppy disks, hard disks, magnetic tapes, magnetic storage devices), optical media (e.g., optical storage devices, DVDs), semiconductor media (e.g., solid-state drives), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), or any suitable combination thereof.

[0173] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. Embodiments of this application also provide at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. This computer program product includes one or more computer-executable instructions, such as instructions included in a program module, which execute in a device on a target real or virtual processor to perform the processes, methods, and functions involved in any of the above embodiments. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0174] This application also proposes a computer program product, including a computer program or instructions that, when run on a computer, cause the computer to perform the processes, methods, and functions described in the above embodiments. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., that perform specific tasks or implement specific abstract data types. In various embodiments, the functionality of program modules can be combined or divided as needed. The machine-executable instructions for the program modules can be executed locally or in a distributed device. In a distributed device, the program modules can reside in both local and remote storage media.

[0175] Generally, the various embodiments of this application can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects can be implemented in hardware, while others can be implemented in firmware or software, which can be executed by a controller, microprocessor, or other computing device. Although various aspects of the embodiments of this disclosure are shown and described as block diagrams, flowcharts, or represented using some other illustration, it should be understood that the blocks, apparatuses, systems, techniques, or methods described herein can be implemented as, as non-limiting examples, in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.

[0176] It should be noted that although embodiments of this application have been described above with reference to the accompanying drawings, these embodiments are not independent of each other, and they can be combined to obtain other embodiments. The methods, situations, categories, and classifications of embodiments in this application are only for the convenience of description and should not constitute a special limitation. Various methods, categories, situations, and features in embodiments can be combined with each other if logically consistent. The various embodiments of this application can be arbitrarily combined to achieve different technical effects. The embodiments of this application will not list various combinations.

[0177] Furthermore, although the operation of the methods of this disclosure is described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. Rather, the steps depicted in the flowcharts may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps. It should also be noted that the features and functions of two or more devices according to this disclosure may be embodied in one device. Conversely, the features and functions of one device described above may be further divided and embodied by multiple devices.

[0178] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0179] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A task processing method for an intelligent agent, characterized in that, The task processing method of the intelligent agent includes: Receive the user's current query task; Based on the current query task, a pre-analysis is performed using a large language model to obtain the pre-analysis results of the large language model; If the pre-analysis result indicates that external tools need to be called, a search is performed in the pre-built tool knowledge base based on the pre-analysis result to obtain the tool knowledge retrieval result corresponding to the current query task; Based on the current query task and the corresponding tool knowledge retrieval results, a large language model is used for reasoning analysis to obtain the reasoning analysis results of the large language model. The reasoning analysis results include the tool information to be called by the current query task. Based on the reasoning and analysis results, an external tool is invoked to execute the current query task, and the final task execution result is output.

2. The task processing method for an intelligent agent according to claim 1, characterized in that, The step of performing pre-analysis using a large language model based on the current query task, and obtaining the pre-analysis results of the large language model, includes: Based on the current query task, a suggestion term is constructed. The suggestion term includes system role and instruction definition, MCP service domain context description and original query statement. Based on the prompt words, the large language model is used for pre-analysis to obtain the pre-analysis results of the large language model. The pre-analysis results are either without calling external tools or require calling external tools and the current task analysis content.

3. The task processing method for an intelligent agent according to claim 1, characterized in that, The pre-analysis results include the analysis content of the current task. The step of retrieving the tool knowledge from a pre-built tool knowledge base based on the pre-analysis results to obtain the tool knowledge retrieval results corresponding to the current query task includes: The tool knowledge in the pre-built tool knowledge base is converted into high-dimensional vectors using a text embedding model, resulting in a tool vector knowledge base. The text embedding model is used to convert the current task analysis content into a high-dimensional vector to obtain the high-dimensional vector of the current task analysis content. Based on RAG technology, the high-dimensional vector of the current task analysis content is used to search the tool vector knowledge base to obtain the tool knowledge retrieval results corresponding to the current query task.

4. The task processing method for an intelligent agent according to claim 1, characterized in that, The tool knowledge retrieval results include documentation for multiple tools. The reasoning analysis using a large language model, based on the current query task and the corresponding tool knowledge retrieval results, yields the following results: Obtain historical process records; The current query task, the documentation for multiple tools, the historical process records, and the default prompt words are assembled and input into the large language model; The target tool and its documentation are determined using the large language model. Extract the parameter information required by the target tool from the current query task and the documentation of the corresponding multiple tools, and assemble them to obtain the assembled tool parameter information; Based on the target tool and the parameter information of the assembled tool, a structured action instruction is output, which is used to indicate the tool information to be invoked by the current query task.

5. The task processing method for an intelligent agent according to claim 1, characterized in that, The step of calling external tools to execute the current query task based on the reasoning analysis results, and outputting the final task execution results, includes: The reasoning analysis results are parsed to obtain the tool information to be invoked by the current query task; Based on the tool information to be invoked by the current query task, a standardized tool invocation request is generated using the MCP protocol; The standardized tool call request invokes an external tool to execute the current query task and outputs the final task execution result.

6. The task processing method for an intelligent agent according to claim 1, characterized in that, The step of calling external tools to execute the current query task based on the reasoning analysis results, and outputting the final task execution results, includes: Based on the reasoning and analysis results, an external tool is invoked to execute the current query task, and the current execution result is obtained; Determine whether the loop termination condition is triggered based on the current execution result, the final task objective, and the number of task loops. If the termination loop condition is triggered, the final task execution result is output. Otherwise, the current query task is executed repeatedly until the termination loop condition is triggered.

7. The task processing method for an intelligent agent according to claim 6, characterized in that, The final task execution result output includes: Retrieve the task execution records of the current query task throughout the entire loop execution process; The large language model is used to summarize the task execution records of the current query task throughout the entire loop execution process, and the final task execution result is output to the user.

8. A task processing device for an intelligent agent, characterized in that, The task processing device for the intelligent agent includes: The receiving unit is used to receive the user's current query task; The pre-analysis unit is used to perform pre-analysis using a large language model based on the current query task, and obtain the pre-analysis results of the large language model. The retrieval unit is used to retrieve the tool knowledge from a pre-built tool knowledge base based on the pre-analysis results when the pre-analysis results indicate that external tools need to be called, so as to obtain the tool knowledge retrieval results corresponding to the current query task. The reasoning unit is used to perform reasoning analysis using a large language model based on the current query task and the corresponding tool knowledge retrieval results, and to obtain the reasoning analysis results of the large language model, which include the tool information to be called by the current query task. The execution and output unit is used to call external tools to execute the current query task based on the reasoning analysis results, and to output the final task execution results.

9. An apparatus comprising: processor; And a memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the task processing method of the agent according to any one of claims 1 to 7.

10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the task processing method of the intelligent agent according to any one of claims 1 to 7.