Task execution method and device, electronic equipment and storage medium

By initializing the target task environment in a multi-agent system and executing tasks in stages, the problems of chaotic agent collaboration and resource waste are solved, and efficient task execution is achieved.

CN121349565APending Publication Date: 2026-01-16BEIJING CHIBO INFORMATION ENG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511854402.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-10
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing multi-agent technology solutions cannot autonomously collaborate based on the intent and progress of the target task, resulting in chaotic collaboration, wasted resources, and task delays.

Method used

By identifying multiple target agents based on the target task, initializing the target task environment, and executing tasks in multiple stages, the environment state is updated in real time to achieve tacit cooperation among the agents.

Benefits of technology

This effectively avoids resource waste, improves the efficiency of target task execution, prevents task delays, and enables efficient collaboration between intelligent agents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121349565A_ABST
    Figure CN121349565A_ABST
Patent Text Reader

Abstract

Embodiments of the invention disclose a task execution method and apparatus, an electronic device and a storage medium. The method comprises the steps of determining a plurality of target agents based on a target task; initializing the blank environment based on the target task and the multiple target intelligent agents to obtain a target task environment; and executing the target task in a plurality of stages based on the target task environment through the plurality of target agents, wherein before each stage task is executed, the current stage task is determined based on the real-time environment state of the target task environment, and after each stage task is executed, the real-time environment state of the target task environment is updated based on the execution result of the current stage task. According to the embodiment of the invention, the completion progress of the target task is mastered in real time, autonomous cooperation among the agents is driven according to the task intention, and cooperation disorder, resource waste and task delay are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a task execution method, apparatus, electronic device, and storage medium. Background Technology

[0002] Task-oriented multi-agent systems aim to construct intelligent agent roles with different capabilities to solve target tasks, such as development tasks, data analysis tasks, and text writing tasks. Existing multi-agent technologies mainly consist of two aspects: First, building a unified interactive intelligent agent based on a large model, which users can then expand into task-related agents with specific roles. Second, designing an interaction mode between agents, where users manually define the interaction order based on the application scenario to achieve the final goal. Existing multi-agent technologies focus on the agent's own structure and the pre-agreed interaction order with other agents, thus failing to enable autonomous collaboration based on the target task's intent and completion progress. This can lead to problems such as chaotic collaboration, resource waste, and task delays. Summary of the Invention

[0003] This invention provides a task execution method, apparatus, electronic device, and storage medium that can avoid collaboration chaos, resource waste, and task delays during the execution of a target task.

[0004] In a first aspect, embodiments of the present invention provide a task execution method, including:

[0005] Multiple target agents are identified based on the target task;

[0006] The target task environment is obtained by initializing the blank environment based on the target task and the multiple target agents; and

[0007] The target intelligent agents execute the target task in multiple stages based on the target task environment. Before executing each stage task, the current stage task is determined based on the real-time environmental state of the target task environment. After executing each stage task, the real-time environmental state of the target task environment is updated based on the execution result of the current stage task.

[0008] In a second aspect, embodiments of the present invention provide a task execution device, comprising:

[0009] The target agent determination module is used to determine multiple target agents based on the target task.

[0010] An initialization module is used to initialize a blank environment based on the target task and the multiple target agents to obtain a target task environment; and

[0011] The segmented execution module is used to execute the target task in multiple stages based on the target task environment through the multiple target agents. Before executing each stage task, the current stage task is determined based on the real-time environmental state of the target task environment. After executing each stage task, the real-time environmental state of the target task environment is updated based on the execution result of the current stage task.

[0012] Thirdly, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the task execution method as described in any of the embodiments of the present invention.

[0013] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the task execution method as described in any of the embodiments of the present invention.

[0014] This invention provides a task execution method, apparatus, electronic device, and storage medium. It determines multiple target agents based on a target task, and then initializes a blank environment based on the target task and the multiple target agents to obtain a target task environment, defining a shared task environment for the multiple target agents. Subsequently, this invention enables the multiple target agents to execute the target task in multiple stages based on the target task environment. This allows for seamless cooperation among the agents during the execution of the target task, helping to avoid resource waste, improve the execution efficiency of the target task, and prevent task delays. Attached Figure Description

[0015] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart illustrating a task execution method provided in an embodiment of the present invention;

[0017] Figure 2 This is another flowchart illustrating the task execution method provided in this embodiment of the invention;

[0018] Figure 3 This is another flowchart illustrating the task execution method provided in this embodiment of the invention;

[0019] Figure 4 This is another flowchart illustrating the task execution method provided in this embodiment of the invention;

[0020] Figure 5 This is a structural schematic of the task execution device provided in the embodiments of the present invention;

[0021] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

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

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0024] Figure 1 This is a flowchart illustrating a task execution method provided in an embodiment of the present invention. This method can be executed by a task execution device provided in this embodiment, which can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a computer or server. The following embodiments will illustrate this using the integration of the device into an electronic device as an example. (Reference) Figure 1 The method may specifically include the following steps:

[0025] Step 101: Determine multiple target agents based on the target task. This step facilitates the initialization of the blank environment based on the target agents to obtain the target task environment.

[0026] Specifically, the aforementioned multiple target intelligent agents may include a scheduling intelligent agent, a planning intelligent agent, and multiple phase task execution intelligent agents, or may include a scheduling intelligent agent and multiple phase task execution intelligent agents.

[0027] Optionally, prior to step 101, multiple candidate agents are formed based on multiple possible types of the target task.

[0028] Specifically, the type of target task can be predicted based on different application scenarios and requirements to obtain the type of target task.

[0029] Specifically, the possible types of the aforementioned target tasks include: classification tasks, prediction tasks, generation tasks, model training tasks, decision control tasks, and / or optimization tasks.

[0030] Optionally, the process of constructing multiple candidate agents based on multiple possible types of the target task includes: determining the capability list of agents required for each possible type based on the target task content of each possible type of the target task; selecting a matching architecture based on the complexity of the corresponding task to build the operating framework of the agents required for each possible type, thereby obtaining multiple candidate agents.

[0031] Optionally, the process of determining multiple target agents based on the target task includes: determining the target agent from multiple candidate agents based on the actual type of the target task.

[0032] Specifically, after forming multiple candidate agents based on multiple possible types of the target task, a mapping relationship can be established between each possible type and the corresponding candidate agent.

[0033] Optionally, the process of determining the target agent from multiple candidate agents based on the actual type of the target task includes: determining the target agent from multiple candidate agents based on the actual type of the target task and the corresponding mapping relationship.

[0034] Specifically, multiple target intelligent agents can be directly constructed based on the content of the target task.

[0035] Step 102: Initialize the blank environment based on the target task and multiple target agents to obtain the target task environment. This step defines a shared task environment for multiple target agents, which allows the associated agents to monitor the progress of the target task in real time during its execution.

[0036] Specifically, the aforementioned blank environment can be understood as including the basic computer hardware and software resources, data flow mechanisms, rule protocols, and interaction interfaces required for multiple candidate intelligent agents to perform corresponding tasks.

[0037] Optionally, the above blank environment includes: the data management module and the code execution environment.

[0038] Specifically, the aforementioned data management module can manage data such as task description text, structured data, code, and images.

[0039] Specifically, the above-mentioned code runtime environment can run code written by candidate agents.

[0040] Optionally, the process of initializing the blank environment based on the target task and multiple target agents to obtain the target task environment includes: establishing a list of task execution agents including the identifiers of each target agent; and adding the list of task execution agents and the task content of the target task to the blank environment to initialize the blank environment and obtain the target task environment.

[0041] Specifically, the task execution agent list includes the role name and job description of each target agent.

[0042] Specifically, multiple stages of the target task can be predetermined, and the content of each stage task, the list of task execution agents, and the running order of the task execution agents can be added to the blank environment to initialize the blank environment.

[0043] Step 103 involves multiple target agents executing the target task in multiple stages based on the target task environment. Before executing each stage, the current stage task is determined based on the real-time environmental state of the target task environment. After executing each stage task, the real-time environmental state of the target task environment is updated based on the execution result of the current stage task. Building upon steps 101 and 102, this step determines multiple target agents based on the target task, then initializes the blank environment based on the target task and the multiple target agents to obtain the target task environment. This defines a shared task environment for the multiple target agents. Subsequently, the multiple target agents execute the target task in multiple stages based on this environment. This allows for seamless collaboration among the agents during task execution, helping to avoid resource waste, improve task execution efficiency, and prevent task delays.

[0044] Specifically, the target task can be divided into multiple stages by the target agent, and the agent executing each stage task can be determined based on the stage task. Then, the corresponding stage task executing agent executes each stage task.

[0045] Specifically, when initializing the target task environment, which includes tasks at each stage, the execution agent for each stage task can be determined directly based on the stage task, and then the corresponding stage task execution agent can be used to execute each stage task.

[0046] The following further describes the task execution method provided by the embodiments of the present invention.

[0047] Optionally, the multiple target agents include: a scheduling agent, a planning agent, and a multi-stage task execution agent.

[0048] Specifically, the working mechanism of the scheduling agent can be as follows: based on the state of the current target task environment, the next suitable agent is determined by reasoning. Specifically, the user's goal, sub-task content and completion status or available agents are obtained from the target task environment. The decision is made using a large language model, thereby selecting the next suitable agent and feeding it back to the task environment to ensure the efficiency and rationality of task allocation.

[0049] Specifically, the job responsibilities of the scheduling agent, the available agents, and the output constraints can be defined. The job responsibilities can be defined as: selecting the most suitable agent role from the available agents to complete the task based on the provided task description; available agents: a list of agents that execute the task, providing the agent role name and a summary of their corresponding job responsibilities; output constraints: constraining the output content, requiring only the agent role name to be returned.

[0050] Specifically, the working mechanism of the planning agent can be as follows: it transforms the target task into a detailed planning scheme, ensuring that the final plan not only meets the requirements but is also effectively implementable. The planning agent observes the target task from the target task environment and uses its own planning capabilities to break down the target into executable phased tasks and feed them back to the task environment.

[0051] Specifically, the job responsibilities and output format of the planning agent can be defined. The job responsibilities are defined as: breaking down the user's goal into no more than a certain number of stage tasks; output format constraints: restricting the format of the output stage tasks, for example, restricting it to JSON format; each data point represents a subtask, and the attributes of each subtask include a sequence number and a task description.

[0052] Specifically, the working mechanism of the intelligent agent executing tasks at each stage can be as follows: observe the executed and unexecuted stage tasks in the target task environment to determine the current stage task, execute the current stage task, and return the corresponding execution result to ensure that the tasks at each stage are executed in an orderly and efficient manner.

[0053] Optional, such as Figure 2 As shown, that is Figure 1 Step 103 may include the following steps:

[0054] Step 1031: The scheduling agent divides the target task into multiple stages according to the task content of the target task in the target task environment, and returns the task information of each stage task to the target task environment. The task information of each stage task includes the task content, task execution order and task execution status of the corresponding stage task.

[0055] Optionally, the process of dividing the target task into multiple stages by scheduling the planning agent according to the task content of the target task in the target task environment includes: using the scheduling agent to determine the agent to be scheduled as the planning agent from multiple target agents based on the initial state of the target task environment after initialization using a large language model, and using the planning agent to divide the target task into multiple stages using a large speech model.

[0056] Specifically, the target task environment after the above initialization can be represented as: That is, the description text of the target task can be used as the initial state of the target task environment. Let Scheduler represent the scheduling agent. The process of using the scheduling agent to determine the agent to be scheduled from multiple target agents based on the initial state of the target task environment using a large speech model can be represented as: Return to the planning agent, planner.

[0057] Specifically, the task content for each stage can be the descriptive text and task identifier for that stage.

[0058] Specifically, when the task identifiers of each stage are represented by the execution order, the execution order of the tasks in each stage can be the task identifiers of each stage.

[0059] Specifically, the execution status of the above tasks can be the initialization state—not started.

[0060] Specifically, the process of dividing the target task into multiple stages by planning the intelligent agent using a large speech model can be represented as follows:

[0061] ,

[0062] After the task information for each stage is returned to the target task environment, the task environment undergoes the following changes:

[0063] .

[0064] In a specific example, the task information returned for each stage of the task is shown in Table 1:

[0065] Optionally, the planning agent stores multiple single-sample cases, each of which is a case for classifying various possible types of target tasks.

[0066] Optional, such as Figure 3 As shown, that is Figure 2 Step 1031 may include the following steps:

[0067] 1031A uses a planning agent to determine the target sample case from multiple single sample cases using a large language model.

[0068] 1031B divides the target task into multiple phases based on the target sample cases.

[0069] Specifically, single-sample cases are an effective strategy for dividing target tasks of various possible types. Dividing target tasks into phase tasks based on single-sample cases can improve the efficiency of division and enhance the feasibility of phase tasks after division.

[0070] Step 1032: The scheduling agent determines the current stage task based on the task execution order and task execution status of each stage task in the target task environment.

[0071] Specifically, the target task environment can be observed in real time by scheduling intelligent agents. When the target task environment changes, such as when the task status of a stage task changes or the data managed by the data management module changes, the stage tasks that have not been started can be determined based on the task execution status of each stage task, and the stage task with the highest priority can be determined as the current stage task.

[0072] Step 1033: By scheduling the agent, the large language model is used to determine the agent that executes the task in the current stage from multiple agents that execute the task in the current stage based on the task content of the task in the current stage.

[0073] Specifically, the process described above, which uses a large language model to determine the agent executing the current task from multiple agents executing tasks at different stages based on the task content of the current stage, can be represented as follows: , where i can be a natural number not greater than the number of stage tasks.

[0074] Step 1034: The task execution agent of the current stage executes the task of the current stage and returns the corresponding execution result.

[0075] Specifically, the agent executing the task at the current stage can observe the description information of the task at the current stage in the target task environment, and complete the task at the current stage according to its own role responsibilities and behavioral capabilities.

[0076] Specifically, the corresponding execution results include the output generated by the task execution agent during the current stage of its work, which can be code, text, images, etc.

[0077] Specifically, after the current task is completed, the state of the target task environment continues to change, which can be represented as follows:

[0078]

[0079] Specifically, the process described above can be iterated continuously until all tasks at each stage are successfully executed, at which point the final state of the target task environment is obtained:

[0080]

[0081] Where n can be the number of tasks in a stage.

[0082] Optionally, the target task environment may include a code execution environment.

[0083] Optionally, multi-stage task execution agents include development agents.

[0084] Specifically, the working mechanism of the aforementioned development agent can be as follows: complete tasks by writing code and ensuring the correctness of code execution, observe the task progress from the task environment, obtain some information generated by the current stage task and the previous stage task, mainly the completed code, among which the information of the previous stage task will be initialized into the agent's memory in advance as the development agent's memory.

[0085] Specifically, the job responsibilities, output format, and constraints of the developing agent can be defined. Job responsibilities can be defined as: completing a given task using a specified programming language, such as Python; output format can be defined as: adopting the code block conventions of Markdown, supporting scenarios where multiple code blocks are output during a single inference; constraints can be defined as: first, ensuring the code is fully written and does not contain incomplete content like "TODO". Second, reminding that all code will run within the same Jupyter Kernel, avoiding duplicate code, as excessive code duplication will dramatically increase the context of the developing agent's interaction with the large language model, easily exceeding the limit.

[0086] Optional, such as Figure 4 As shown, when the task execution agent is the development agent in the current stage, step 1034 may include:

[0087] Step 1034A: Using the large language model, write the code needed to execute the task of the current stage based on the task content of the current stage to obtain the task code of the current stage.

[0088] Step 1034B: Execute the current stage task code through the code executor in the code execution environment and return the corresponding code execution result.

[0089] Specifically, code snippets of the current task code can be sent to the code executor via WebSocket (a persistent connection established based on the WebSocket protocol).

[0090] Step 1034C: When an error occurs during the execution of the task code in the current stage, obtain the corresponding error information, perform error analysis using a large language model, and rewrite the task code in the current stage based on the error analysis results until the code in the current stage is executed successfully.

[0091] Specifically, by developing intelligent agents to solve corresponding tasks through coding, it is possible to complete tasks with higher complexity and enhance the generalization ability of the proposed solution.

[0092] Optionally, multi-stage task execution agents include tool expert agents.

[0093] Specifically, the aforementioned tool expert agent can be defined as someone who is familiar with various types of tools or a particular type of tool and can recommend tools based on historical information.

[0094] Specifically, the aforementioned tools can be, for example, modeling tools, configuration tools, or development programming tools.

[0095] Optionally, step 1034 includes: when the task execution agent in the current stage is a tool expert agent, determining the types of tools required for the current stage task based on the task content of the current stage task using a large language model, and recommending a predetermined number of corresponding types of tools.

[0096] Optionally, multi-stage task execution agents include reporting expert agents.

[0097] Specifically, the aforementioned report expert agent can be defined as: someone who is familiar with the relevant knowledge of report writing and can write corresponding analysis reports based on data and their own knowledge.

[0098] Optionally, step 1034 includes: when the task execution agent in the current stage is a reporting expert agent, using a large language model to write a data analysis report based on the task content of the current stage task and the data corresponding to the current stage task.

[0099] Specifically, the data corresponding to the current stage task can be the data returned from the execution of the previous stage task and stored in the target task environment.

[0100] In a specific instance, the target task is:

[0101] Goal: Read data from D: / workspace / datasets / exchange_rate.xlsx and recommend one or two prediction models to forecast future exchange rate trends.

[0102] The initial environment state of the target task only contains the goal; the scheduling agent divides the target task into 5 phases, as shown in Table 1:

[0103]

[0104] The scheduling agent identifies the first stage task, "Read data from 'D: / workspace / datasets / exchange_rate.xlsx'", as the current stage task based on the first stage task that has not yet started execution in the target task environment. The scheduling agent then identifies the development agent to execute the current stage task based on the first stage task. Finally, the development agent, according to the task description of the first stage task ("Read data from 'D: / workspace / datasets / exchange_rate.xlsx'"), determines the execution agent for the current stage task. The process involves reading data, writing code, and calling the code executor to run the code in the target task environment. The read data is then returned to the target environment, and the task status of the first stage task is changed to "execution completed." Following this pattern, the development agent (CodeEngineer) is called to execute the second and third stage tasks, followed by the tool expert agent to execute the fourth stage task. The development agent is then called to complete the fifth stage task, and the reporting expert agent is called to complete the sixth stage task. The final target task environment includes the target task, all stage tasks with completed status, process code, the prediction model, and a model performance report with charts.

[0105] The embodiments of the present invention, by setting up a scheduling agent, a planning agent, and a stage task execution agent, can schedule tasks according to the target task environment, and decompose and allocate target tasks. It supports adjusting the stage task execution agent based on the target task, thereby facilitating the application of the agent to more target task execution scenarios and having good generalization ability.

[0106] Figure 5 This is a structural diagram of a task execution device provided in an embodiment of the present invention. This device is suitable for executing the task execution method provided in an embodiment of the present invention. Figure 5 As shown, the device may specifically include:

[0107] The target agent determination module 501 is used to determine multiple target agents based on the target task, which can facilitate the initialization of the blank environment based on the target agents to obtain the target task environment.

[0108] Optionally, the multiple target agents include: a scheduling agent, a planning agent, and a multi-stage task execution agent.

[0109] Optionally, the task execution device provided in this embodiment of the invention further includes a candidate agent composition module, which is used to compose multiple candidate agents based on multiple possible types of the target task before determining multiple target agents based on the target task.

[0110] Optionally, the target agent determination module 501 described above can be specifically used to determine the target agent from multiple candidate agents based on the actual type of the target task.

[0111] The initialization module 502 is used to initialize the blank environment based on the target task and multiple target agents to obtain the target task environment. It defines a shared task environment for multiple target agents, which is conducive to real-time monitoring of the completion progress of the target task during its execution.

[0112] Optionally, the target task environment mentioned above includes a code execution environment.

[0113] Optionally, the initialization module 502 described above can be specifically used to establish a list of task execution agents, including the identifiers of each target agent; and

[0114] The list of task execution agents and the task content of the target task are added to the blank environment to initialize the blank environment and obtain the target task environment.

[0115] The segmented execution module 503 is used to execute a target task in multiple stages based on a target task environment by multiple target agents. Before executing each stage task, the current stage task is determined based on the real-time environment state of the target task environment. After executing each stage task, the real-time environment state of the target task environment is updated based on the execution result of the current stage task. It can be combined with modules 501 and 502 to determine multiple target agents based on the target task, and then initialize a blank environment based on the target task and multiple target agents to obtain the target task environment. A shared task environment is defined for multiple target agents. Then, the target task is executed in multiple stages by multiple target agents based on the target task environment. This enables the agents to cooperate tacitly during the execution of the target task, which helps to avoid resource waste, improve the execution efficiency of the target task, and avoid the delay of the target task.

[0116] Optionally, the segmented execution module 503 can be specifically used to divide the target task into multiple stages by scheduling the intelligent agent according to the task content of the target task in the target task environment.

[0117] The task information of each stage is returned to the target task environment. The task information of each stage includes the task content, task execution order and task execution status of the corresponding stage.

[0118] The scheduling agent determines the current stage task based on the task execution order and task execution status of each stage task in the target task environment;

[0119] By scheduling agents and utilizing a large language model based on the task content of the current stage task, the agent executing the current stage task is determined from multiple agents executing tasks at different stages; and

[0120] The task execution agent executes the task of the current stage and returns the corresponding execution result.

[0121] Optionally, the planning agent stores multiple single-sample cases, each of which is a case for dividing various possible types of target tasks. The segmented execution module 503 can be specifically used to: determine the target sample case from multiple single-sample cases using a large language model through the planning agent; and divide the target task into multiple stage tasks based on the target sample case.

[0122] Optionally, the multi-stage task execution agents include a development agent. Specifically, the segmented execution module 503 can be used to, when the current stage task execution agent is a development agent, utilize a large language model to write the code required to execute the current stage task based on the current stage task content, thus obtaining the current stage task code;

[0123] The code executor in the code execution environment executes the code for the current stage of the task and returns the corresponding code execution results; and

[0124] When an error occurs during the execution of the task code in the current stage, the corresponding error information is obtained, and the error is analyzed using a large language model. Based on the error analysis results, the task code for the current stage is rewritten until the code for the current stage is executed successfully.

[0125] Optionally, multi-stage task execution agents include tool expert agents.

[0126] Optionally, multi-stage task execution agents include reporting expert agents.

[0127] Optionally, the segmented execution module 503 can be specifically used to determine the types of tools needed for the current stage task based on the task content of the current stage task using a large language model, and recommend a predetermined number of corresponding types of tools when the task execution agent in the current stage is a tool expert agent.

[0128] Optionally, the segmented execution module 503 can be specifically used to, when the task execution agent in the current stage is a reporting expert agent, to write a data analysis report based on the task content of the current stage task and the data corresponding to the current stage task using a large language model.

[0129] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is merely an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0130] This invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the task execution method provided in any of the above embodiments.

[0131] This invention also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the task execution method provided in any of the above embodiments.

[0132] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the task execution method as described in any of the embodiments of this invention.

[0133] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing an electronic device according to embodiments of the present invention. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0134] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0135] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0136] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.

[0137] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0139] The modules and / or units described in the embodiments of this invention can be implemented in software or hardware. The described modules and / or units can also be housed in a processor; for example, a processor can be described as including a target agent determination module, an initialization module, and a segmented execution module. The names of these modules do not necessarily limit the functionality of the module itself.

[0140] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: determining a plurality of target agents based on a target task; initializing a blank environment based on the target task and the plurality of target agents to obtain a target task environment; and executing the target task in multiple stages based on the target task environment by the plurality of target agents; wherein, before executing each stage task, the current stage task is determined based on the real-time environment state of the target task environment, and after executing each stage task, the real-time environment state of the target task environment is updated based on the execution result of the current stage task.

[0141] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A task execution method characterized by, The method comprises: determining a plurality of target agents based on a target task; initializing a blank environment based on the target task and the plurality of target agents to obtain a target task environment; and executing the target task in a plurality of stages by the plurality of target agents based on the target task environment, wherein, before executing each stage task, a current stage task is determined based on a real-time environment state of the target task environment, and after executing each stage task, the real-time environment state of the target task environment is updated based on an execution result of the current stage task. The initializing of the blank environment based on the target task and the plurality of target agents to obtain the target task environment comprises:

2. The task execution method according to claim 1, wherein establishing a task execution agent list comprising the identification of each target agent; and adding the task execution agent list and the task content of the target task to the blank environment to initialize the blank environment to obtain the target task environment. The plurality of target agents comprises a scheduling agent, a planning agent and a plurality of stage task execution agents; the executing of the target task in a plurality of stages by the plurality of target agents based on the target task environment comprises:

3. The task execution method according to claim 1, wherein dividing the target task into a plurality of stage tasks by the scheduling agent based on the task content of the target task in the target task environment, and returning the task information of each stage task to the target task environment, the task information of each stage task comprising the task content, the task execution order and the task execution state of the corresponding stage task; determining a current stage task by the scheduling agent based on the task execution order and the task execution state of each stage task in the target task environment; determining a current stage task execution agent from the plurality of stage task execution agents by the scheduling agent based on the task content of the current stage task using a large language model; and executing the current stage task by the current stage task execution agent and returning the corresponding execution result to the target task environment.

4. The task execution method according to claim 3, wherein a plurality of single-sample cases are stored in the planning agent, each single-sample case being a case of dividing each possible type of target task; the dividing of the target task into a plurality of stage tasks by the scheduling agent based on the task content of the target task in the target task environment comprises: determining a target sample case from the plurality of single-sample cases by the planning agent using a large language model; and dividing the target task into a plurality of stage tasks based on the target sample case. The plurality of stage task execution agents comprises a development agent; the target task environment comprises a code running environment; when the current stage task execution agent is a development agent, the executing of the current stage task by the current stage task execution agent comprises:

5. The task execution method according to claim 3, wherein writing a code required for executing the current stage task based on the task content of the current stage using a large language model to obtain a current stage task code; executing the current stage task code by a code executor in the code running environment and returning the corresponding code execution result; and ​ ​ When the current stage task code execution fails, corresponding error information is obtained, error analysis is performed on the large language model, and the current stage task code is re-written based on the error analysis result until the current stage code is successfully executed.

6. The task execution method according to claim 3, wherein The plurality of stage task execution agents includes a tool expert agent and a report expert agent. When the current stage task execution agent is a tool expert agent, the current stage task is executed by the current stage task execution agent, and the corresponding execution result is returned, including: Based on the task content of the current stage task, a tool type required by the current stage task is determined using a large language model, and a predetermined number of tools of the corresponding type are recommended. When the current stage task execution agent is a report expert agent, the current stage task is executed by the current stage task execution agent, and the corresponding execution result is returned, including: Based on the task content of the current stage task, a data analysis report is written based on the data corresponding to the current stage task using a large language model.

7. The task execution method according to claim 1, wherein Before the plurality of target agents is determined based on the target task, the method further includes: A plurality of candidate agents are formed based on a plurality of possible types of the target task; and The task content based on which the plurality of target agents is determined based on the target task includes: The target agents are determined from the plurality of candidate agents based on the actual type of the target task.

8. A task execution apparatus characterized by comprising: It includes: A target agent determination module is configured to determine a plurality of target agents based on a target task; An initialization module is configured to initialize a blank environment based on the target task and the plurality of target agents to obtain a target task environment; And A segmented execution module is configured to execute the target task in a plurality of stages based on the target task environment by the plurality of target agents, wherein before each stage task is executed, a current stage task is determined based on a real-time environment state of the target task environment, and after each stage task is executed, the real-time environment state of the target task environment is updated based on the execution result of the current stage task.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the task execution method of any one of claims 1-7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the task execution method of any one of claims 1-7.