Artificial intelligence agent method, apparatus, electronic device, storage medium, and computer program product

By introducing an environmental observer and planner into the artificial intelligence agent, decomposing tasks into sub-tasks and calling tools for processing, and combining environmental information update strategies, the adaptability problem of multi-agent systems in complex environments is solved, and the flexibility and reliability of task execution are achieved.

CN122173230APending Publication Date: 2026-06-09CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
Filing Date
2026-03-03
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing AI agents struggle to cope effectively with complex environmental changes, leading to uncertainty and randomness in task execution results. This is especially true in multi-agent systems, where pre-configured tools cannot be automatically replaced or upgraded, making it difficult to adapt to environmental changes.

Method used

By introducing an environmental observer to collect initial environmental information, the planner generates execution strategies, decomposes tasks into sub-tasks and calls tools to process them, and combines the tool execution results and environmental information to update the strategies, thereby enhancing the agent's adaptability.

Benefits of technology

It improves the adaptability of AI agents in complex environments, enabling them to dynamically adjust task execution strategies and enhance the reliability and flexibility of task completion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173230A_ABST
    Figure CN122173230A_ABST
Patent Text Reader

Abstract

The application provides an artificial intelligence agent method and device, electronic equipment, a storage medium and a computer program product, wherein the method comprises: generating an execution strategy of a first task according to a user request; and sequentially executing a plurality of subtasks according to the execution strategy; wherein in the process of executing the plurality of subtasks, the method further comprises: for each subtask in one or more subtasks, calling a corresponding tool to process the subtask to obtain a corresponding tool execution result; collecting first environment information related to the task in response to the tool execution result; and updating the execution strategy based on the first environment information and the tool execution result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to an artificial intelligence agent method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0002] Currently, AI agents execute tasks according to pre-planned workflows. However, the execution environment during task execution is subject to uncertainty and randomness. At present, multi-agent AI agents, built on fixed workflows, struggle to cope with complex environmental changes, thus affecting the execution results of AI agent tasks. Summary of the Invention

[0003] This application provides an artificial intelligence agent method, apparatus, electronic device, storage medium, and computer program product.

[0004] The proxy method of this application includes: Based on the user request, an execution strategy for the first task is generated, wherein the user request is used to request the execution of the first task, and the execution strategy includes multiple sub-tasks obtained by decomposing the first task and the tools that need to be invoked to execute one or more of the sub-tasks respectively; The plurality of subtasks are executed sequentially according to the execution strategy; wherein... In the process of executing the plurality of subtasks, the method further includes: For each of the one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the execution result of the tool, first environmental information related to the task is collected; Based on the first environment information and the execution result of the tool, the execution strategy is updated.

[0005] In the above scheme, generating the execution strategy for the first task based on the user request includes: In response to the user request, collect second environmental information related to the first task; Based on the second environmental information, an execution strategy for the first task is generated.

[0006] In the above scheme, the step of calling the corresponding tool to process the subtask includes: The system searches the database for the tools required for the subtask and obtains the search results. The database stores multiple first vectors, each representing the description information of a tool among multiple tools. Based on the search results, the corresponding tool is invoked to process the subtask.

[0007] In the above scheme, the step of searching the set database for the tools required by the subtask and obtaining the search results includes: Determine the second vector, which is obtained by transforming the description information of the tools to be called by the subtask; The search results are obtained by searching the database for a predetermined number of first vectors that match the second vector.

[0008] In the above scheme, the search results include a predetermined number of first vectors; correspondingly, the step of calling the corresponding tool to process the subtask based on the search results includes: The first language model is invoked to process the first and second information, or the first language model is invoked to process the first, second, and third information, and the first tool and the first parameter configuration of the first tool are output. Based on the first parameter configuration, the first tool is invoked to process the subtask; wherein... The first large language model is used to select a first tool from the tools corresponding to the set number of first vectors. The first information represents the set number of first vectors, the second information represents the description information of the tool to be called by the subtask, and the third information represents the relevant information of the first tool that has been selected by the first large language model and whose execution result represents the execution failure.

[0009] In the above scheme, the step of calling the corresponding tool to process the subtask based on the search results further includes: If the first condition is met, the invocation of the first large language model is terminated; wherein... The first condition includes: the corresponding tool execution result indicates successful execution; or, the tools corresponding to the set number of first vectors have all been selected by the first large language model; or, the number of times the tool is called for the subtask exceeds the set number.

[0010] This application also provides an artificial intelligence agent device, comprising: The generation unit is configured to generate an execution strategy for a first task based on a user request, wherein the user request is for requesting the execution of the first task, and the execution strategy includes multiple sub-tasks obtained by decomposing the first task and tools that need to be invoked to execute one or more of the sub-tasks respectively. An execution unit is configured to sequentially execute the plurality of subtasks according to the execution strategy; wherein, During the execution of the plurality of subtasks, the execution unit is further configured to: For each of the one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the execution result of the tool, first environmental information related to the task is collected; Based on the first environment information and the execution result of the tool, the execution strategy is updated.

[0011] The electronic device of this application includes a memory and a processor, the memory storing a computer program, and the processor executing the artificial intelligence proxy method as described above when running the computer program.

[0012] The storage medium of this application stores a computer program that, when executed by one or more processors, implements the artificial intelligence proxy method described above.

[0013] The computer program product of this application includes a computer program that, when executed by one or more processors, implements the artificial intelligence agent method described above.

[0014] The artificial intelligence agent method, apparatus, electronic device, storage medium, and computer program product provided in this application first determine the first task that the artificial intelligence agent needs to complete based on a user request, and generate an execution strategy for the first task. The execution strategy includes multiple sub-tasks obtained by decomposing the relatively complex first task, and the tools that need to be invoked to execute one or more sub-tasks respectively. After generating the execution strategy for the first task, multiple sub-tasks are executed sequentially according to the execution strategy. This includes invoking the corresponding tool to process each sub-task in the one or more sub-tasks, obtaining the corresponding tool execution result, and, after obtaining the tool execution result, collecting first environmental information related to the task completion status in response to the tool execution result. Finally, based on the first environmental information and the tool execution result, the one or more sub-tasks in the execution strategy of the first task, as well as the tools that need to be invoked, are updated to complete the construction of the artificial intelligence agent. In the above scheme, user requests are used as the basis for planning the execution strategy of the first task. A relatively complex first task is decomposed into multiple sub-tasks and the tools that need to be called to execute them. During the process of calling the tools to execute the sub-tasks of the first task, the first environment information is obtained. Then, combined with the execution results of the tools, it is determined whether the execution strategy of the task needs to be modified, which enhances the adaptability of the artificial intelligence agent to complex environments. Attached Figure Description

[0015] The above and / or additional aspects and advantages of this application will become apparent and readily understood through the description of the embodiments in conjunction with the following drawings, wherein: Figure 1This is a schematic diagram of the structure of the artificial intelligence agent related to the technology in this application; Figure 2 This is one of the flowcharts illustrating the artificial intelligence proxy method according to an embodiment of this application; Figure 3 This is a schematic diagram of the structure of the artificial intelligence agent in an embodiment of this application; Figure 4 This is a schematic diagram of the development architecture of the artificial intelligence agent according to an embodiment of this application; Figure 5 This is a second schematic flowchart of the artificial intelligence proxy method according to an embodiment of this application; Figure 6 This is the third flowchart illustrating the artificial intelligence proxy method according to an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an artificial intelligence agent device according to an embodiment of this application; Figure 8 This is a schematic diagram of the electronic device structure according to an embodiment of this application. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] With the rapid development of large-scale language models, significant progress has been made in building AI agents based on these models. Utilizing the natural language understanding and generation capabilities provided by large language models (LLMs, Launcher Loader Modules) or other AI technologies, combined with diverse external tools, AI agents can be constructed, enabling them to become autonomous entities capable of perceiving their environment and making decisions to achieve specific goals. AI agents are mainly divided into single-agent and multi-agent systems. Due to the limitations of single agents in handling complex tasks, current research has shifted towards multi-agent systems with greater collaborative and scalable capabilities.

[0018] There are two main methods for constructing multi-agent systems: autonomous collaboration and workflow. In autonomous collaboration, planners, summarizers, and tool invokers typically assume different responsibilities, collaborating to complete tasks. For example... Figure 1As shown, a typical multi-agent AI agent includes a tool invoker and its invoked tools, memory (including long-term and short-term memory), a planner, and a summarizer. The planner is responsible for overall task planning and decomposition, controlling the task execution flow. When needed, the planner plans the invocation of tools, which is completed by the tool invoker. The summarizer, based on the task planned by the planner and the execution results of the tools invoked by the tool invoker, summarizes the task execution results and sends feedback to the user. Here, although the tool invocation is completed by the tool invoker, the planner determines which tool to select. However, due to the limitations of the large language model in the planner, it is difficult to cope with complex environmental changes and handle complex tasks. For workflow-based multi-agent construction methods, such as Dify and LangChain, nodes with different functions configured on the multi-agent are linked together to form a workflow. Node types include model nodes and tool invocation nodes. After the user sends a request to the agent, the multi-agent executes the nodes sequentially and finally feeds back the results to the user. These methods not only require users to have strong domain knowledge to configure each node in a fine-grained manner, but the configured tools cannot be automatically replaced or upgraded. If changes are needed, the nodes need to be re-planned and configured, making it difficult to cope with complex environmental changes.

[0019] Based on this, the artificial intelligence agent method, apparatus, electronic device, storage medium, and computer program product provided in this application first determine the first task that the artificial intelligence agent needs to complete according to the user request, and generate an execution strategy for the first task. The execution strategy includes multiple sub-tasks obtained by decomposing the relatively complex first task and the tools that need to be invoked to execute one or more sub-tasks respectively. After generating the execution strategy for the first task, multiple sub-tasks are executed sequentially according to the execution strategy. This includes invoking the corresponding tool to process each sub-task in the one or more sub-tasks, obtaining the corresponding tool execution result, and, after obtaining the tool execution result, collecting first environmental information related to the task completion status in response to the tool execution result. Finally, based on the first environmental information and the tool execution result, the one or more sub-tasks in the execution strategy of the first task, as well as the tools that need to be invoked, are updated to complete the construction of the artificial intelligence agent. In the above scheme, user requests are used as the basis for planning the execution strategy of the first task. A relatively complex first task is decomposed into multiple sub-tasks and the tools that need to be called to execute them. During the process of calling the tools to execute the sub-tasks of the first task, the first environment information is obtained. Then, combined with the execution results of the tools, it is determined whether the execution strategy of the task needs to be modified, which enhances the adaptability of the artificial intelligence agent to complex environments.

[0020] This application provides an artificial intelligence agent method, please refer to the embodiments described herein. Figure 2 The method includes: Step 201: Generate the execution strategy for the first task based on the user request; Here, a user request refers to the request to initiate a session for the AI ​​agent to execute a task, specifically to request the execution of the first task. The first task refers to the task that the AI ​​agent needs to complete, extracted directly from the user request by the large language model based on its existing knowledge base and contextual understanding of the user request's semantics. In real-world scenarios, the first task is usually impossible to achieve through a single, simple step; therefore, the AI ​​agent will formulate an execution strategy for such complex first tasks. This execution strategy includes decomposing the first task into multiple sub-tasks and identifying the tools that need to be invoked to execute one or more sub-tasks.

[0021] Here, the process of decomposing the first task into multiple subtasks is completed by the planner in the AI ​​agent. As one of the most important core components of the AI ​​agent, the planner's most crucial task is to synthesize various information and decompose and plan the task. For example... Figure 3 As shown, this application presents the structural composition of its AI agent, which is optimized compared to the typical structure by adding an environment observer. In addition to receiving tool execution results, domain knowledge injected into the knowledge base, and user requests, the planner in this application can also receive the first environmental data collected by the environment observer. After synthesizing the information from all these categories, the first task is decomposed and planned. If the large language model determines that more information is needed, but the large language model itself lacks the capability to perform this operation, a tool invocation will be initiated. In this case, a detailed description of the tool to be invoked is passed to the tool invoker, which invokes the tool based on the description information to assist in completing the first task.

[0022] To illustrate the abstract relationship between the primary task, subtasks, and tools mentioned above, let's first use an analogy. When the "primary task" is "cleaning the air conditioner," given the actual situation of the "air conditioner" as the execution object, it cannot be cleaned directly. Instead, the "primary task" of "cleaning the air conditioner" needs to be divided into several "subtasks"—such as "opening the air conditioner casing," "removing the built-in filter," "cleaning and drying the filter," and "installing the filter and air conditioner casing." Among these, to ensure the key step of "cleaning and drying the filter" achieves better results, the "tool" of "cleaning agent" is needed.

[0023] Furthermore, the first task, subtasks, and tools in this application will be illustrated with examples based on a large language model. Specifically, in one embodiment, after the AI ​​agent receives the user request "What to wear in Shanghai tomorrow," it performs semantic understanding on the user request and obtains that the first task could be "Recommend suitable clothing for Shanghai tomorrow." This first task is planned by the planner and decomposed into two subtasks: 1. Query weather information: requiring parameters such as city and date; 2. Comprehensive reasoning and suggestions: generating clothing suggestions based on weather data. Here, subtask 1 cannot be achieved by the AI ​​agent based on a large language model, so it is necessary to call an external tool. At this time, the tool caller will select a suitable tool from the existing tool pool and generate a call request in a format compatible with that tool, querying the weather in Shanghai tomorrow on an external weather website based on the keywords "Shanghai" and "tomorrow." After obtaining the weather forecast for Shanghai for tomorrow, the summarizer integrates the tool call results and ultimately generates natural language feedback to the user: "Although the temperature is comfortable at noon, it will be quite cool in the evening and at night. We suggest you bring a light jacket just in case." In this embodiment, the AI ​​agent cannot directly obtain weather information, so the task of obtaining weather information is delegated to the tool caller. By calling external tools, the AI ​​agent can overcome the functional limitations of "chatting only."

[0024] To make the execution strategy of the generated first task more feasible, in one embodiment, step 201 includes: In response to a user request, collect secondary environmental information related to the first task; Based on the second environment information, the execution strategy for the first task is generated.

[0025] like Figure 3 As shown, the AI ​​agent in this application has been optimized in terms of its composition structure by adding an environmental observer.

[0026] One function of the environmental observer is to collect second observation information. In this application, the second observation information represents the environmental information observed by the environmental observer at the moment of responding to the user request, which can be referred to as the initial environmental information. Here, environmental information refers to all external data, states, and contexts that serve as the basis for decision-making by the AI ​​agent when performing tasks. Environmental information includes digital environmental information, physical environmental information, simulated environmental information, and historical session information (including context). Environmental information, within a certain range, can determine the applicable scenarios for the AI ​​agent. Specifically, environmental observers employ different environmental observation methods to obtain different categories of environmental data in different environments. For example, environmental information in an autonomous scientific research data analysis scenario includes digital environmental information such as various academic databases and research report documents; while environmental information in a warehouse inventory scenario includes physical environmental information such as warehouse map information and shelf label information.

[0027] Furthermore, after the environmental observer completes its collection of environmental information, it provides the collected second environmental information to the planner. Based on this second environmental information, the planner generates the execution strategy for the first task. The planner is one of the most crucial core components of the AI ​​agent. Upon receiving the second environmental information, the planner first loads knowledge related to that domain and, in conjunction with the user request, utilizes a planning function. The first task is broken down into one or more subtasks, and the tools required to execute each of these subtasks. Here, the one or more subtasks and the tools required to execute each subtask constitute the execution strategy in step 201. If the next subtask requires a tool, the planner outputs a detailed description of the required tool and sends it to the tool invoker. When all subtasks are completed, the planner considers all subtasks derived from the first task to be resolved and outputs information containing the completion status of the first task to the summarizer.

[0028] Thus, this application introduces an environment observer to collect initial environmental information of the first task while responding to user requests, thereby constraining the applicable scenarios for the planner to generate the execution strategy of the first task, making the services of the artificial intelligence agent more targeted.

[0029] exist Figure 3 On this basis, Figure 4 This application demonstrates the development architecture of the AI ​​agent based on a large language model, which, from bottom to top, comprises four levels: large language model management, knowledge base management, tool pool management, and agent management. The agent management level is presented in this application as an AI agent, including an environment observer, planner, tool invoker, and summarizer.

[0030] The large language model management layer provides a unified way to access AI agents, manage authentication and access permissions for various large language models. It also encapsulates calls to multiple large language models into a unified API (Application Programming Interface) for use by other upper layers.

[0031] The knowledge base management hierarchy provides functions such as data import, data cleaning, data retrieval, vector extraction, and vector storage. The knowledge base requires a large vector model. It primarily serves the planner and summarizer. In this application, the knowledge base is mainly used to store vectorized tools from the tool pool.

[0032] The tool pool management level is used for tool import and search during the AI ​​agent process. When importing a tool, the detailed tool description is first regenerated, and then vectors are generated using a large vector model and stored in a vector database or knowledge base. The reason for using the large tool model in the tool pool management level to regenerate the detailed tool description is that different description styles from different sources can interfere with the tool import process.

[0033] In one embodiment, an example of a prompt word for building a large model of the tool is as follows: "Your task is to create a concise and practical description of the tool, and to use the tool documentation." For reference only. Highlight the tool's functionality, excluding any irrelevant details. Among them, tool documents It contains a detailed description of the callable tools in the tool pool.

[0034] Furthermore, the tool pool management level is also used for tool searching, which can search for multiple similar tools based on the regenerated tool description, making it convenient to call them when executing one or more subtasks included in the first task of this application.

[0035] In addition, the tool pool also provides a tool testing function. When the planner needs to call a tool, it only needs to provide a description of the required tool to the tool caller. The tool caller will then call the large vector model configured in the tool pool to generate vectors, perform a coarse screening in the vector database, and provide the filtered tools to the tool caller's large model for use. Because a vector database is used instead of plain text, the upper limit of the number of supported tools theoretically depends on the size of the vector database, and the search speed and search range of tools are greatly optimized.

[0036] like Figure 4As shown in the diagram, the development architecture also includes a session management layer. Here, a session refers to a collection of multi-turn dialogues between the user and the AI ​​agent regarding multiple primary tasks. Each dialogue begins with a user request and ends with the AI ​​agent's response to that request. The response to the user request includes feedback on the execution result of the primary task. The session management layer includes the session ID, session context, session history, session state, and the execution strategy for the current primary task.

[0037] After generating the execution strategy for the first task, please refer to Figure 2 The method of this application also includes: Step 202: Execute multiple subtasks sequentially according to the execution strategy; The method also includes the following when executing multiple subtasks: For each subtask in one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the tool's execution results, collect the first environmental information related to the task; The execution strategy is updated based on the initial environment information and the tool's execution results.

[0038] In this application, the environmental observer's function, besides collecting second environmental information, namely initial environmental information (…), is to collect other environmental information. In addition, when the AI ​​agent uses tools to perform actions on the environment, it can also collect data in real time related to the primary task. The first environmental information at any given moment, also known as the current environmental information ( The environmental observer will combine the initial environmental information with... The execution result of the first task at any given time is fed back to the planner. Therefore, the environment observer will provide a comprehensive dataset containing current environmental information and the execution result of the first task at the current time. Since the data formats of the environment observer and the planner may differ, the environment observer... The environmental observer continuously collects initial environmental information and the execution results of the initial task, filters them, and outputs comprehensive data in a fixed format to the planner for processing. In simple terms, the environmental observer continuously monitors environmental changes during the implementation of each subtask of the initial task, forming a feedback mechanism with the planner. This allows the planner to continuously adjust its execution strategy to ultimately complete the initial task. In summary, the environmental observer plays a significant role in uncertain and incompletely observed scenarios.

[0039] Here, to better plan tasks, the planner's prompts are designed using a chain-of-thought approach, simulating the step-by-step thinking process of the human brain. The large language model within the planner processes the service trajectory of an AI agent; therefore, The planning function of the time planner can be expressed by the following formula 1: (1) in, To plan the function notation for the large model, The prompt word "Prompt" is used to plan the large model. yes The output of the large language model in the time planner, For is The service trajectory of AI agent in real time For user requests.

[0040] Here, for In terms of time, the service trajectory of the human agent ,in, yes Secondary environmental information collected in real time It is based on The execution action of the first task or its sub-tasks is, that is, if Time planning function If you need to invoke the action tool, then This refers to the execution action of the tool call, which is easily obtained from formula (1). satisfy .

[0041] In particular, if If the summarizer needs to be called, then This is the output of the summarizer.

[0042] To better address the problem, in one embodiment, the prompt for building a large-scale planning model is as follows: The chat log is: You need to determine your next course of action based on the historical dialogue, state your next steps, and decide whether to invoke a tool or terminate the task. If you need to invoke a tool, please provide a detailed description of the tool required, following this format: Invoking a tool, tool description: If you need to end the task, use the following format: End Task. Let's solve the problem step by step through reasoning. In one embodiment, for the prompt word "Prompt" in the planning large model, the corresponding tool is invoked to process each subtask in one or more subtasks, including: Search the database for the tools required by the subtask and obtain the search results; Based on the search results, the corresponding tool is invoked to process the subtask.

[0043] The database stores multiple first vectors, each representing a description of a tool used by the AI ​​agent to perform a task. For example, the tool description included in the prompt word "Prompt" is: Here, each first vector is obtained by vectorizing the description information of a tool in the tool pool. The tool description information includes... Other instances may include detailed textual descriptions of the tools in the Prompt. All first vectors corresponding to all tools conforming to the current execution strategy are stored in a database based on the tool pool settings.

[0044] In one embodiment, after determining the first vector, a second vector is further determined, and a predetermined number of first vectors that match the second vector are searched in a predetermined database to obtain the search results.

[0045] The second vector is obtained by transforming the description information of the tools required by the subtask. Here, the transformation of the second vector refers to vectorizing the description information of the tools required by the subtask. Therefore, a predetermined number of first vectors that match the second vector are searched in the set database, and the results are all the tools that may have the ability to execute the subtask.

[0046] For example, based on the subtask that needs to be performed, multiple first vectors are sorted in a set database. For one or more subtasks contained in the first task, the search results obtained are a set of tools consisting of the TOP K tools that may have the ability to perform the subtask.

[0047] In one embodiment, based on the above search results, the corresponding tool is invoked to process the subtask, including: The first language model is invoked to process the first and second information, or the first language model is invoked to process the first, second, and third information, and the first tool and the first parameter configuration of the first tool are output. In one embodiment, based on the first parameter configuration, a first tool is invoked to process the subtask; The first language model is used to select the first tool from the tools corresponding to a set number of first vectors. The first information represents the set number of first vectors. The second information represents the description information of the tool to be called by the subtask. The third information represents the relevant information of the first tool that has been selected by the first language model and whose execution result represents the execution failure.

[0048] Here, the first large language model refers to the large language model in the tool invoker of the AI ​​agent. The first information representation of the first vector specifically corresponds to a toolset consisting of the TOP K tools that may have the capability to execute the subtask. The second information, representing the descriptive information of the tools that the subtask needs to invoke, is provided by the planner. The third information specifically refers to the information of the first tool and its first parameter configuration that was searched by the first large language model but failed to be invoked within the toolset consisting of the TOP K tools.

[0049] Under normal circumstances, the first tool used to execute the subtask and the first parameter configuration used when calling the first tool can be output based on the first and second information. Specifically, after one or more failed calls, it is necessary to exclude the failed tools and their corresponding parameter information. That is, failure can be due to the entire first tool being unable to be called, or it can be due to the first tool being successfully called but the first parameter configuration not meeting the requirements of the current subtask. To improve the efficiency of subsequent tool invocations, the third information excludes previously failed tools and parameter configurations, allowing invocation within the remaining tools, or discontinuing the use of parameter configurations that failed to execute the subtask.

[0050] For example, the functional expression of the large model in the tool caller can be represented by the following formula (2): (2) in, This is the function symbol of the first major language model, which is also the tool caller's major language model. The prompt word "Prompt" for the large language model of the tool invoker. yes A toolset comprised of tools for the top K moments. This is the description information provided by the planner regarding the tools that this subtask needs to call. yes The time-based tool invokes the large language model and selects and configures the parameters. Therefore... Working at all times yes The execution result. The system prompt for the large language model initiator, used to build the tool, is shown below: You have access to the following tools: According to the tool description: Choose the most suitable tool from the available tools and configure its parameters accordingly. Please configure the tool in the following format: Tool Name The name of the tool to be called in this step, from Make a selection; Tool Input : Parameter configuration required for tool invocation. Here, the output is... Tool Name The content itself is the primary tool. Tool Input The content is the first parameter configuration.

[0051] In another embodiment, if the tool fails to execute, a tool failure process needs to be executed, the failure information is resent to the tool invoker, the tool is re-determined, the parameters are reconfigured, and execution is repeated until success is achieved or a specified threshold is reached. Therefore, the function of the large model in the tool invoker at this time can be represented by the following formula (3): (3) in, This is an execution failure message, generated only when the tool fails to execute. The third piece of information includes the first tool and its first parameter configuration that the first major language model searched but failed to invoke. An example of the prompt word used by the tool to invoke the major model at this point is: You have access to the following tools: According to the tool description: Choose the most suitable tool from the tools list and configure the appropriate parameters. You have already failed once; the tool selected during that failure is as follows: Error description: Please use the tool in the following format: Tool Name The name of the tool to be called in this step, from Make a selection; Tool Input : Parameter configuration required for tool invocation. Here, the output is... Tool Name Content remains the primary tool. Tool Input The content is still the first parameter configuration. Unlike the previous embodiment, the first tool and the first parameter configuration in this embodiment are combined with third information.

[0052] In one embodiment, based on the search results, invoking the corresponding tool to process the subtask further includes: If the first condition is met, the invocation of the first major language model will be terminated; The first condition includes: the corresponding tool execution result indicates successful execution; or, the tools corresponding to the set number of first vectors have all been selected by the first large language model; or, the number of times the tool is called for this subtask exceeds the set number.

[0053] Here, the first condition includes three different scenarios, all of which are used to determine when to terminate the call to the first major language model, but they produce very different technical effects. The following examples will describe these three different scenarios in detail.

[0054] In one embodiment, please refer to Figure 5 The first condition includes the corresponding tool execution result indicating successful execution. That is, when the tool invoker successfully invokes the first tool and first parameter configuration required by all subtasks in the first task, and the first task is successfully executed, the tool invoker no longer needs to invoke the first large language model or initiate the tool invocation process for the first task to be implemented in this session. The result of the successful execution of the first task can be sent to the environment observer, which will then re-observe the environment, wait for the user to request the start of the next session, and then send the latest observed environment information and the execution result of the first task to the planner.

[0055] Here, after the first task is successfully executed, in order to alleviate the pressure on the planner of repeatedly receiving new environmental information during the execution of the first task, such as... Figure 4 The AI ​​agent architecture shown also includes a summarizer. For example... Figure 5 The flowchart shows that after receiving the planner's request, the summarizer integrates the user request and task context, outputs the task result to the user, and waits for the user's next input. The functional expression of the summarizer's big model can be represented by the following formula (4): (4) in, To summarize the functional form of the large model, The prompt word is "Prompt," which summarizes the overall model. yes The trajectory of time, It's a user request. An example of building a prompt word to summarize the large model is as follows: The question is: The historical execution log is as follows: This conclusion is drawn based on the history of the dialogue. In one embodiment, the summary large model prompt above, Prompt, is also output to a scorer for compliance checking.

[0056] In another embodiment, please refer to Figure 6The first condition includes that all tools corresponding to a set number of first vectors have been selected by the first largest language model. When the first tools found by the first largest language model but failed to be called, contained in the third information, exclude all tools within the tool set consisting of the TOP K tools, and the information on the selected first parameter configurations also excludes all corresponding available parameter configurations, the tool caller has no more tools to call, declares the tool call failure, and the tool caller no longer needs to call the first largest language model.

[0057] In particular, Figure 6 The flowchart also illustrates the first condition, which includes the situation where the number of tool calls to this subtask exceeds a set number. If the number of failed tool calls does not exceed the set number, the tool call is retried. If the number of failed tool calls exceeds the set number, the execution and output of the first task are terminated, and a failure alert is sent to the user.

[0058] It should be noted that, Figure 6 The middle dashed line part is Figure 5 The first condition, represented by dashed and solid lines, is used only to distinguish that sending an alert to the user and providing feedback on the output task results to the user are different paths in the embodiments of this application.

[0059] To implement the artificial intelligence proxy method of this application, please refer to [link / reference]. Figure 7 This application embodiment also provides an artificial intelligence agent device 700, which includes: The generation unit 701 is used to generate an execution strategy for the first task according to the user request, wherein the user request is used to request the execution of the first task, and the execution strategy includes multiple sub-tasks obtained by decomposing the first task and the tools that need to be called to execute one or more sub-tasks respectively. Execution unit 702 is used to execute multiple subtasks sequentially according to an execution strategy; wherein, During the execution of multiple subtasks, execution unit 702 is also used for: For each subtask in one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the tool's execution results, collect the first environmental information related to the task; The execution strategy is updated based on the initial environment information and the tool's execution results.

[0060] In one embodiment, the generation unit 701 is used for: In response to a user request, collect secondary environmental information related to the first task; Based on the second environment information, the execution strategy for the first task is generated.

[0061] In one embodiment, the execution unit 702 is used to: The system searches the database for the tools required by the subtask and obtains the search results. The database stores multiple first vectors, which represent the description information of each tool among the multiple tools. Based on the search results, the corresponding tool is invoked to process the subtask.

[0062] In one embodiment, the execution unit 702 is configured to: determine a second vector, which is obtained by converting the description information of the tool to be invoked by the subtask; Search the database for a set number of first vectors that match the second vector to obtain the search results.

[0063] In one embodiment, the search results include a predetermined number of first vectors; correspondingly, the execution unit 702 is specifically used for: The first language model is invoked to process the first and second information, or the first language model is invoked to process the first, second, and third information, and the first tool and the first parameter configuration of the first tool are output. Based on the first parameter configuration, the first tool is invoked to process the subtask; whereby... The first large language model is used to select the first tool from the tools corresponding to a set number of first vectors. The first information represents the set number of first vectors, the second information represents the description information of the tool to be called by the subtask, and the third information represents the relevant information of the first tool that has been selected by the first large language model and whose execution result represents the execution failure.

[0064] In one embodiment, the tool invoker 702 is used for: If the first condition is met, the invocation of the first major language model will be terminated; where... The first conditions include: the corresponding tool execution result indicates successful execution; or, the tools corresponding to the set number of first vectors have all been selected by the first large language model; or, the number of times the tool is called for this subtask exceeds the set number.

[0065] In practical applications, the planner 701, tool invoker 702, summarizer 703, and environment observer 704 can be implemented by the processor in the artificial intelligence agent system 700.

[0066] It should be noted that the above embodiments of the artificial intelligence agent device 700, when performing artificial intelligence agency functions, are only illustrated by the division of the above-described program modules. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. Furthermore, the artificial intelligence agent device 700 and the embodiments of the artificial intelligence agent method belong to the same concept, and their specific implementation process is detailed in the method implementation method, which will not be repeated here.

[0067] Based on the hardware implementation of the above program modules, and in order to implement the method for measuring electronic devices in this embodiment, this application also provides an electronic device 800, such as... Figure 8 As shown, the electronic device 800 includes: The communication interface 801 enables information exchange with other devices or network nodes.

[0068] The processor 802 is connected to the communication interface 801 to enable information interaction with other devices or network nodes, and when running a computer program, executes the methods provided in one or more embodiments of the above-described electronic device.

[0069] Memory 803 is used to store computer programs that can run on processor 802.

[0070] Specifically, processor 802 is used for: Based on the user request, an execution strategy for the first task is generated. The user request is used to request the execution of the first task. The execution strategy includes multiple subtasks obtained by decomposing the first task and the tools that need to be called to execute one or more subtasks respectively. Multiple subtasks are executed sequentially according to the execution strategy; for each subtask in one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the tool's execution results, collect the first environmental information related to the task; The execution strategy is updated based on the initial environment information and the tool's execution results.

[0071] In one embodiment, the processor 802 is used to: In response to a user request, collect secondary environmental information related to the first task; Based on the second environment information, the execution strategy for the first task is generated.

[0072] In one embodiment, the processor 802 is used to: The system searches the database for the tools required by the subtask and obtains the search results. The database stores multiple first vectors, which represent the description information of each tool among the multiple tools. Based on the search results, the corresponding tool is invoked to process the subtask.

[0073] In one embodiment, the processor 802 is configured to: determine a second vector, the second vector being converted based on the description information of the tool to be invoked by the subtask; Search the database for a set number of first vectors that match the second vector to obtain the search results.

[0074] In one embodiment, the search results include a predetermined number of first vectors; correspondingly, the processor 802 is specifically used for: The first language model is invoked to process the first and second information, or the first language model is invoked to process the first, second, and third information, and the first tool and the first parameter configuration of the first tool are output. Based on the first parameter configuration, the first tool is invoked to process the subtask; whereby... The first large language model is used to select the first tool from the tools corresponding to a set number of first vectors. The first information represents the set number of first vectors, the second information represents the description information of the tool to be called by the subtask, and the third information represents the relevant information of the first tool that has been selected by the first large language model and whose execution result represents the execution failure.

[0075] In one embodiment, the processor 802 is specifically used for: If the first condition is met, the invocation of the first major language model will be terminated; where... The first conditions include: the corresponding tool execution result indicates successful execution; or, the tools corresponding to the set number of first vectors have all been selected by the first large language model; or, the number of times the tool is called for this subtask exceeds the set number.

[0076] It should be noted that the specific processing procedure of processor 802 can be understood by referring to the above method.

[0077] Of course, in practical applications, the various components in electronic device 800 are coupled together through bus system 804. It can be understood that bus system 804 is used to realize the connection and communication between these components. In addition to a data bus, bus system 804 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in... Figure 7 The general labeled all buses as Bus System 804.

[0078] The memory 803 in this embodiment is used to store various types of data to support the operation of the electronic device 800. Examples of such data include any computer program used to operate on the electronic device 800.

[0079] The methods disclosed in the embodiments of this application can be applied to, or implemented by, the processor 802. The processor 802 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the integrated logic circuitry of the hardware or by instructions in software form within the processor 802. The processor 802 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 802 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, specifically a memory 803. The processor 802 reads information from the memory 803 and, in conjunction with its hardware, completes the steps of the aforementioned method.

[0080] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.

[0081] It is understood that the memory (memory 803) in the embodiments of this application can be volatile memory or non-volatile memory, or it can include both volatile memory and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); the magnetic surface memory can be disk storage or magnetic tape storage. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of this application are intended to include, but are not limited to, these and any other suitable types of memories.

[0082] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 803 storing a computer program, which can be executed by the processor 802 of the electronic device 800 to complete the steps described in any of the aforementioned methods. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.

[0083] For example, embodiments of this application also provide a computer program product, including a computer program that can be executed by a processor 802 of an electronic device 800 to perform the steps described in any of the foregoing methods.

[0084] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish different objects and do not represent a distinction of superiority or inferiority or priority in the implementation process. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.

Claims

1. An artificial intelligence agent method, characterized in that, include: Based on the user request, an execution strategy for the first task is generated, wherein the user request is used to request the execution of the first task, and the execution strategy includes multiple sub-tasks obtained by decomposing the first task and the tools that need to be invoked to execute one or more of the sub-tasks respectively; The plurality of subtasks are executed sequentially according to the execution strategy; wherein... In the process of executing the plurality of subtasks, the method further includes: For each of the one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the execution result of the tool, first environmental information related to the task is collected; Based on the first environment information and the execution result of the tool, the execution strategy is updated.

2. The method according to claim 1, characterized in that, The step of generating an execution strategy for the first task based on the user request includes: In response to the user request, collect second environmental information related to the first task; Based on the second environmental information, an execution strategy for the first task is generated.

3. The method according to claim 1 or 2, characterized in that, The invocation of the corresponding tool to process the subtask includes: The system searches the database for the tools required for the subtask and obtains the search results. The database stores multiple first vectors, each representing the description information of a tool among multiple tools. Based on the search results, the corresponding tool is invoked to process the subtask.

4. The method according to claim 3, characterized in that, The process of searching the designated database for the tools required by the subtask and obtaining the search results includes: Determine the second vector, which is obtained by transforming the description information of the tools to be called by the subtask; The search results are obtained by searching the database for a predetermined number of first vectors that match the second vector.

5. The method according to claim 3 or 4, characterized in that, The search results include a predetermined number of first vectors; correspondingly, the step of invoking the corresponding tool to process the subtask based on the search results includes: The first language model is invoked to process the first and second information, or the first language model is invoked to process the first, second, and third information, and the first tool and the first parameter configuration of the first tool are output. Based on the first parameter configuration, the first tool is invoked to process the subtask; wherein... The first large language model is used to select a first tool from the tools corresponding to the set number of first vectors. The first information represents the set number of first vectors, the second information represents the description information of the tool to be called by the subtask, and the third information represents the relevant information of the first tool that has been selected by the first large language model and whose execution result represents the execution failure.

6. The method according to claim 5, characterized in that, The step of invoking the corresponding tool to process the subtask based on the search results also includes: If the first condition is met, the invocation of the first large language model is terminated; wherein... The first condition includes: the corresponding tool execution result indicates successful execution; or, the tools corresponding to the set number of first vectors have all been selected by the first large language model; or, the number of times the tool is called for the subtask exceeds the set number.

7. An artificial intelligence agent device for implementing the method according to any one of claims 1-6, characterized in that, include: The generation unit is configured to generate an execution strategy for a first task based on a user request, wherein the user request is for requesting the execution of the first task, and the execution strategy includes multiple sub-tasks obtained by decomposing the first task and tools that need to be invoked to execute one or more of the sub-tasks respectively. An execution unit is configured to sequentially execute the plurality of subtasks according to the execution strategy; wherein, During the execution of the plurality of subtasks, the execution unit is further configured to: For each of the one or more subtasks, the corresponding tool is invoked to process the subtask and obtain the corresponding tool execution result; In response to the execution result of the tool, first environmental information related to the task is collected; Based on the first environment information and the execution result of the tool, the execution strategy is updated.

8. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing, when running the computer program, the artificial intelligence proxy method as described in any one of claims 1-6 above.

9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by one or more processors, it implements the artificial intelligence proxy method as described in any one of claims 1-6 above.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by one or more processors, it implements the artificial intelligence proxy method as described in any one of claims 1-6 above.