Dynamic task cooperation method and system for multi-agent parallel planning and execution
By employing a multi-agent collaboration method involving parallel planning and execution, and utilizing a large language model and a centralized memory system, the response latency and information synchronization issues of multi-agent systems in dynamic task environments are resolved, achieving efficient and flexible task collaboration.
Patent Information
- Application Number
- CN202511484211.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-01-23
AI Technical Summary
Existing multi-agent systems suffer from problems such as high response latency, lack of flexible interruption, and information synchronization lag in dynamic task environments, and cannot meet the requirements of high real-time performance, high adaptability, and efficient collaboration.
It adopts a parallel planning and execution approach, with independent planning and execution threads, and utilizes a large language model for real-time information judgment and interruption decision-making. Combined with a centralized memory system and file lock mechanism, it achieves dynamic task collaboration.
It achieves real-time and dynamic adaptability in planning and execution, reduces collaboration delays, improves system flexibility and information synchronization efficiency, and supports efficient collaboration of multi-agent systems in dynamic task scenarios.
Smart Images

Figure CN121387474A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence and multi-agent collaboration technology, and in particular to a dynamic task collaboration method and system for multi-agent parallel planning and execution, applicable to network task scenarios that require multi-agent collaboration, such as information retrieval, literature review generation, web page interaction, and daily task processing. Background Technology
[0002] With the rapid development of artificial intelligence technology, especially large language models, multi-agent systems based on natural language interaction have gradually become a research hotspot in academia and industry. These systems, through the division of labor and cooperation among multiple agents, can accomplish complex tasks that are difficult for a single agent to handle. They are currently widely used in network task scenarios such as information retrieval, data summary generation, online navigation, automatic ticketing, content generation, and multi-user request response.
[0003] Most existing multi-agent systems employ a sequential planning-execution paradigm for task collaboration. The core logic is as follows: first, a language model completes the entire reasoning plan, determining all operational steps; then, the execution module calls a tool library or interface to execute the task. In this model, planning and execution are strictly divided into two sequential stages with no parallel interaction. While this works correctly in static, simple task environments, it reveals significant shortcomings in real-world dynamic scenarios. High response latency: The execution module must wait for the planning module to complete all inference before it can start, resulting in a long overall task response time and insufficient real-time performance. Lack of flexible interruption: The operation being executed cannot be interrupted in time. Even if the user inserts a high-priority request or the external environment changes (such as the target webpage becoming invalid or the search information being updated), the system still needs to complete the original task, resulting in poor adaptability. Information synchronization lag: The system memory module is usually updated only after the task is completely completed. During the execution process, each agent can only rely on old information to make decisions, which is prone to cooperation conflicts and reduces task execution efficiency. Therefore, existing serial planning-execution multi-agent collaborative schemes cannot meet the requirements of high real-time performance, high adaptability, and efficient collaboration in dynamic task environments. There is an urgent need for a technical solution that can realize parallel planning and execution, support dynamic interruption and real-time information synchronization, and solve the above problems. Summary of the Invention
[0004] To address the technical problems of high response latency, interruption loss, and information lag in existing multi-agent collaboration schemes, this invention provides a dynamic task collaboration method and system for parallel planning and execution of multiple agents. Through designs such as "planning-execution dual-thread parallelism," it achieves efficient collaboration in dynamic scenarios.
[0005] In a first aspect, the present invention provides a dynamic task collaboration method for multi-agent parallel planning and execution, comprising the following steps:
[0006] 1. Agent Initialization: Construct an agent containing independent and parallel planning threads and execution threads. The planning thread is configured with a callable large language model and a readable and writable centralized memory system, and the execution thread is configured with a callable tool library. At the same time, each agent's planning thread and execution thread establish a dedicated communication link, and the centralized memory system configures a configuration lock mechanism. 2. Planning process: At each time step, the planning thread retrieves the latest environmental information, team communication logs, and execution history from the centralized memory system, calls the large language model to generate formatted tool library API instructions as the next step plan, and the large language model independently determines whether to trigger the interruption mechanism. If it is triggered, an interruption signal is generated, and the tool library API instructions are written to the action buffer (if there are already instructions in the buffer, they are overwritten). 3. Execution process: The execution thread continuously retrieves the latest tool library API instructions from the action buffer and calls the tool library to execute the corresponding tasks; if an interrupt signal is received from the planning thread through a dedicated communication link, the current task is immediately terminated, the occupied resources are released, and the latest instructions in the buffer are loaded and executed. 4. Centralized memory update: The centralized memory system updates content at each time step. The updated content includes environmental observation results returned by the tool library, communication logs between agents, and task execution history of each agent, which are accessible to all planning threads.
[0007] Based on the above scheme, the dynamic task cooperation method for multi-agent parallel planning and execution of the present invention can be further improved as follows: In one alternative approach, the specific details of the agent initialization described in step 1 include: The dedicated communication link is used only for transmitting interrupt signals. Zero-copy communication between threads is achieved through a global flag bit shared within the same process space, ensuring the real-time performance and security of interrupt signal transmission. The triggering logic of the file lock mechanism is as follows: when any thread (planning thread or execution thread) of any agent performs read or write operations on the centralized memory system, the file lock is automatically triggered to restrict other threads from performing read or write operations simultaneously; after the thread completes the read or write operation and releases the file lock, other threads can access the centralized memory system in the order of their requests, thus avoiding data inconsistency caused by concurrent access by multiple threads.
[0008] In one optional approach, step 2, which involves calling the large language model to generate formatted API instructions from the tool library, includes: constraining the output JSON format of the large language model through preset prompts. The JSON format must contain three core fields: "API type," "parameter name," and "parameter value." These can be extracted from the JSON dictionary as executable formats such as "API type (parameter name = parameter value)," for example, "browsePage (url = target webpage address)," "searchWeb (keyword='multi-agent collaboration')," and "collectDoc (format=DOCX,content = extract text)." If the API instructions generated by the large language model do not meet the above formatting requirements (e.g., missing parameters or incorrect fields), they are not written to the action buffer. Instead, a planned thread calls the large language model again and supplements the prompts (e.g., "must contain complete API type, parameter name, and parameter value") until a compliant API instruction is generated.
[0009] In one alternative approach, the large language model independently determines whether to trigger the interruption mechanism in step 2. The determination criteria include: new user requests stored in the centralized memory system (such as "add literature search for the past five years"), external environment change data (such as "target webpage cannot be accessed" or "search results updated"), and strategy adjustment information shared by other agents (such as "the literature analysis agent should prioritize processing English literature"). The interruption signal contains only a single binary instruction of "whether to interrupt" (such as "1" for interruption and "0" for no interruption). The execution thread does not need to parse complex information and only needs to determine the operation based on this instruction.
[0010] In one alternative approach, step 3, where the execution thread terminates the current task, includes: the execution thread immediately sending an API call termination instruction to the tool library to forcibly terminate the current API request; simultaneously, releasing resources such as network bandwidth and memory space occupied by the current task, and clearing the current task state cache within the execution thread (such as incomplete webpage parsing progress and temporary storage data of search results); subsequently, reading the latest tool library API instruction from the action buffer, and after parameter validation (determining whether the parameters are complete and whether the format is valid), initializing the execution flow of the new task; if the current task has performed part of the operation and supports breakpoint resumption (such as a document collection task having completed part of the text extraction), the execution thread will write the breakpoint information (such as "text from pages 1-3 has been extracted") into the centralized memory system for reference if the task needs to be resumed later.
[0011] In one alternative approach, the update rules for the centralized memory system described in step 4 include: Environmental observation results: The task environment information of each agent is collected through a timed polling mechanism (polling interval is configurable, default is 1 second / time). For example, the web search agent collects the current web page content, and the document processing agent detects changes in document content. The latest environmental information collected directly overwrites the historical information of this type of environment in the centralized memory system, ensuring that the environmental data is up-to-date in real time. Communication logs: Only record "message sending time + sending agent ID + message content", without redundant fields; the system automatically sorts and stores communication logs in chronological order of sending time, and supports quick retrieval by "sending agent ID" and "time range"; Execution history: Stored content includes structured instructions from the tool library API (with complete parameters, such as "searchWeb(keyword='multi-agent collaboration')"), as well as inference information when the planning thread calls the large language model to generate the API instruction (such as "supplementing literature from the past 3 years based on user needs, requiring the search engine API to retrieve the latest results"). The retention period for execution history is configurable, and it is automatically cleaned up after the expiration date to save storage resources.
[0012] In one alternative approach, the tool library includes browser APIs, search engine APIs, document collection APIs, and other commonly used tool APIs; the action buffer is a single-slot queue structure that stores only the latest tool library API instructions generated by the planning thread, with older instructions automatically overwritten when new instructions are written, ensuring that the execution thread always obtains the latest plan.
[0013] Secondly, this invention provides a dynamic task collaboration system for multi-agent parallel planning and execution.
[0014] The technical solution of the system is as follows: it includes multiple intelligent agents, an action buffer, a centralized memory system, and a tool library; each intelligent agent contains a planning thread and an execution thread, which run independently and in parallel; the planning thread is configured with a large language model module, a centralized memory access module, and an interruption judgment module: the centralized memory access module is used to obtain the latest information (including environmental information, communication logs, and execution history) from the centralized memory system at each time step; the large language model module is used to generate formatted tool library API instructions; the interruption judgment module is used to call the large language model to independently determine whether to trigger an interrupt and generate an interrupt signal; the execution thread is configured with a tool library calling module and an interrupt response module: the tool library calling module is used to obtain API instructions from the action buffer, verify the validity of parameters, and call the tool library for execution; the interrupt response module is used to receive interrupt signals through a dedicated communication link, triggering the termination of the current task and resource release; the action buffer is a single-slot queue structure, configured with an instruction overwrite mechanism, retaining only the latest tool library API. The instructions ensure the real-time acquisition of the plan by the execution thread; the centralized memory system is configured with a read / write control module, which has a built-in file lock unit to avoid concurrent read / write conflicts between multiple threads, while supporting simultaneous reading by multiple planned threads and synchronous updating of stored content according to time steps; the tool library includes a browser API subsystem, a search engine API subsystem, a document collection API subsystem, and a commonly used tool API subsystem for performing specific task operations. Each API subsystem provides a standardized calling interface that can be directly called by the tool library calling module of the execution thread.
[0015] The beneficial effects of the dynamic task collaboration system for parallel planning and execution of multiple agents proposed in this invention are as follows: The system architecture is clear and highly decoupled, with the four core modules of planning, execution, memory, and tools operating independently yet cooperating in a coordinated manner, facilitating subsequent maintenance and functional iteration; In particular, the design of the file lock mechanism and the single-slot action buffer provides dual protection for the accuracy of information synchronization and the real-time performance of task execution from both hardware and logic levels, effectively solving the problems of low collaboration efficiency and poor adaptability of existing multi-agent systems, and providing stable and efficient technical support for dynamic task scenarios.
[0016] Based on the above solution, the dynamic task cooperation system for multi-agent parallel planning and execution of the present invention can be further improved as follows: In one alternative approach, the centralized memory access module of the planning thread is configured with an information update detection unit: if a change is detected in the information related to the current planning in the centralized memory system (such as new user requests or policy adjustment information shared by other agents), the planning thread is immediately triggered to re-call the API instructions of the large language model generation tool library to ensure that the planning result matches the latest information; the interruption judgment module does not set up additional complex priority judgment logic, but relies entirely on the interruption decision based on the real-time information output of the large language model, thereby reducing the system logic complexity.
[0017] In one optional approach, the tool library invocation module of the execution thread includes a parameter validation unit: used to validate the completeness of API command parameters (e.g., the "searchWeb" command needs to be validated to see if it contains the "keyword" parameter) and the validity of the format (e.g., the "url" parameter needs to conform to the HTTP / HTTPS format specification); if the parameters are incomplete or the format is incorrect, the tool library invocation module sends a parameter supplementation request to the planning thread through a dedicated communication link, and executes the API call only after obtaining complete and valid parameters; the interrupt response module is configured with a fast termination unit, which completes the termination of the current API call, resource release and cache clearing within 100ms after receiving the interrupt signal, ensuring the speed of task switching.
[0018] In one optional approach, each API subsystem of the tool library is configured with an exception handling unit: if an exception occurs during an API call (such as a browser API timeout or a search engine API returning no results), the exception handling unit writes the exception information (including the exception type, occurrence time, and associated API instructions) into a centralized memory system and returns an exception identifier to the execution thread; after receiving the exception identifier, the execution thread suspends the execution of the current task, and the planning thread regenerates the API instructions (such as "change web address" or "adjust search keywords") based on the exception information in the centralized memory system, thereby achieving automatic recovery in abnormal scenarios.
[0019] The beneficial effects of this invention are as follows: Significantly improved real-time performance: Planning and execution threads run in parallel, execution does not need to wait for planning to finish completely, and planning can also be performed simultaneously during execution; Highly adaptable: The interruption decision is dominated by a large language model, and a single "whether to interrupt" signal is needed to achieve rapid task switching, which can respond promptly to high-priority requests or sudden changes in the environment; Efficient information synchronization: The centralized memory system avoids read-write conflicts through a file lock mechanism and updates in real time according to time steps, ensuring that all agents collaborate based on the latest information and reducing unnecessary operations; Excellent scalability: The dual-threaded architecture supports flexible expansion of the number of agents, and the system performance will not deteriorate significantly as the scale of agents increases; Wide applicability: It can be directly applied to various dynamic task scenarios such as information retrieval, document writing, travel planning, and ticket booking navigation, without the need for extensive adaptation and modification for specific scenarios. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of the method of the present invention. Detailed Implementation
[0021] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0022] Example 1
[0023] This embodiment relates to a dynamic task collaboration method for multi-agent parallel planning and execution, including the following steps.
[0024] 1. Agent Initialization: Construct an agent containing independent and parallel planning threads and execution threads. The planning thread is configured with a callable large language model and a readable and writable centralized memory system, and the execution thread is configured with a callable tool library. At the same time, each agent's planning thread and execution thread establish a dedicated communication link, and the centralized memory system configures a configuration lock mechanism. 2. Planning process: At each time step, the planning thread retrieves the latest environmental information, team communication logs, and execution history from the centralized memory system, calls the large language model to generate formatted tool library API instructions as the next step plan, and the large language model independently determines whether to trigger the interruption mechanism. If it is triggered, an interruption signal is generated, and the tool library API instructions are written to the action buffer (if there are already instructions in the buffer, they are overwritten). 3. Execution process: The execution thread continuously retrieves the latest tool library API instructions from the action buffer and calls the tool library to execute the corresponding tasks; if an interrupt signal is received from the planning thread through a dedicated communication link, the current task is immediately terminated, the occupied resources are released, and the latest instructions in the buffer are loaded and executed. 4. Centralized memory update: The centralized memory system updates content at each time step. The updated content includes environmental observation results returned by the tool library, communication logs between agents, and task execution history of each agent, which are accessible to all planning threads.
[0025] Based on the above scheme, the dynamic task cooperation method for multi-agent parallel planning and execution of the present invention can be further improved as follows: The specific details of the agent initialization described in step 1 include: The dedicated communication link is used only for transmitting interrupt signals. Zero-copy communication between threads is achieved through a global flag bit shared within the same process space, ensuring the real-time performance and security of interrupt signal transmission. The triggering logic of the file lock mechanism is as follows: when any thread (planning thread or execution thread) of any agent performs read or write operations on the centralized memory system, the file lock is automatically triggered to restrict other threads from performing read or write operations simultaneously; after the thread completes the read or write operation and releases the file lock, other threads can access the centralized memory system in the order of their requests, thus avoiding data inconsistency caused by concurrent access by multiple threads.
[0026] Step 2, which involves calling the large language model to generate formatted API instructions from the tool library, includes: constraining the output JSON format of the large language model through preset prompts. The JSON format must contain three core fields: "API type," "parameter name," and "parameter value." These can be extracted from the JSON dictionary as executable formats such as "API type (parameter name = parameter value)," for example, "browsePage (url = target webpage address)," "searchWeb (keyword='multi-agent collaboration')," and "collectDoc (format=DOCX,content = extract text)." If the API instructions generated by the large language model do not meet the above formatting requirements (e.g., missing parameters or incorrect fields), they are not written to the action buffer. Instead, a planned thread calls the large language model again and supplements the prompts (e.g., "must contain complete API type, parameter name, and parameter value") until a compliant API instruction is generated.
[0027] The decision to trigger the interruption mechanism independently by the large language model in step 2 is based on the following criteria: new user requests stored in the centralized memory system (such as "add literature search for the past five years"), external environment change data (such as "target webpage cannot be accessed" or "search results updated"), and strategy adjustment information shared by other agents (such as "the literature analysis agent should prioritize processing English literature"). The interruption signal contains only a single binary instruction of "whether to interrupt" (such as "1" for interruption and "0" for no interruption). The execution thread does not need to parse complex information and only needs to determine the operation based on this instruction.
[0028] Step 3, which describes the execution thread terminating the current task, includes: the execution thread immediately sending an API call termination instruction to the tool library to forcibly terminate the current API request; simultaneously, releasing resources such as network bandwidth and memory space occupied by the current task, and clearing the current task status cache within the execution thread (such as the progress of incomplete webpage parsing and temporary storage data of search results); subsequently, reading the latest tool library API instruction from the action buffer, and after parameter validation (determining whether the parameters are complete and whether the format is valid), initializing the execution flow of the new task; if the current task has performed part of the operation and supports breakpoint resumption (such as the document collection task having completed part of the text extraction), the execution thread will write the breakpoint information (such as "text of pages 1-3 extracted") into the centralized memory system for reference if the task needs to be resumed later.
[0029] The update rules for the centralized memory system described in step 4 include: Environmental observation results: The task environment information of each agent is collected through a timed polling mechanism (polling interval is configurable, default is 1 second / time). For example, the web search agent collects the current web page content, and the document processing agent detects changes in document content. The latest environmental information collected directly overwrites the historical information of this type of environment in the centralized memory system, ensuring that the environmental data is up-to-date in real time. Communication logs: Only record "message sending time + sending agent ID + message content", without redundant fields; the system automatically sorts and stores communication logs in chronological order of sending time, and supports quick retrieval by "sending agent ID" and "time range"; Execution history: Stored content includes structured instructions from the tool library API (with complete parameters, such as "searchWeb(keyword='multi-agent collaboration')"), as well as inference information when the planning thread calls the large language model to generate the API instruction (such as "supplementing literature from the past 3 years based on user needs, requiring the search engine API to retrieve the latest results"). The retention period for execution history is configurable, and it is automatically cleaned up after the expiration date to save storage resources.
[0030] In one alternative approach, the tool library includes browser APIs, search engine APIs, document collection APIs, and other commonly used tool APIs; the action buffer is a single-slot queue structure that stores only the latest tool library API instructions generated by the planning thread, with older instructions automatically overwritten when new instructions are written, ensuring that the execution thread always obtains the latest plan.
[0031] Figure 1 This is only intended to visually illustrate the core execution logic and data flow relationship of the present invention, and should not be construed as a limitation on the scope of protection of the technical solution. Figure 1The data and control flow of the core process of this invention is clearly demonstrated: Centralized memory system and environment: The environment continuously synchronizes the latest status information to the centralized memory system through a "polling update" mechanism; the centralized memory system, as the central hub for shared information, receives the environmental perception results written by the "observation update" module on the one hand, and provides a reading interface for the "planning" module on the other hand, supporting the historical and real-time information required for planning decisions.
[0032] Planning and Task Buffer: After reading information from the centralized memory system, the "Planning" module generates API call instructions for the tool library and updates the "Task Buffer". At the same time, the "Planning" module can generate "interrupt signals" that directly affect the "Execution" module, enabling dynamic intervention in task execution.
[0033] Execution and Tool Library API: The "Execution" module reads the latest instructions from the "Task Buffer" and triggers the "Tool Library API" to execute specific tasks through the "Call" operation; if an "Interruption Signal" is received, the "Execution" module will "immediately execute the latest task" and terminate any currently running operations to ensure real-time task switching; after the "Tool Library API" executes the task, it will "change" the external environment to complete the interaction and influence on the real-world scenario.
[0034] It should be noted that the large language model, tool library API, and database used in this embodiment are all existing mature technologies. The core innovation of this invention lies in integrating these technologies according to the logic of "parallel planning-execution," "real-time memory update," and "flexible interruption" to form a completely new multi-agent collaborative architecture, rather than an improvement on a single technology. In practical applications, the large language model (such as deploying open-source models such as LLaMA and Qwen locally, or calling closed-source model APIs such as GPT), tool library API (such as configuring commonly used tools such as calculators and calendars), or database (such as using commonly used databases such as MySQL) can be replaced as needed without affecting the implementation of the core functions of this invention.
[0035] Example 2
[0036] This embodiment relates to a dynamic task collaboration system for multi-agent parallel planning and execution, in order to implement a dynamic task collaboration method for multi-agent parallel planning and execution in this embodiment.
[0037] The technical solution of the system is as follows: it includes multiple intelligent agents, an action buffer, a centralized memory system, and a tool library; each intelligent agent contains a planning thread and an execution thread, which run independently and in parallel; the planning thread is configured with a large language model module, a centralized memory access module, and an interruption judgment module: the centralized memory access module is used to obtain the latest information (including environmental information, communication logs, and execution history) from the centralized memory system at each time step; the large language model module is used to generate formatted tool library API instructions; the interruption judgment module is used to call the large language model to independently determine whether to trigger an interrupt and generate an interrupt signal; the execution thread is configured with a tool library calling module and an interrupt response module: the tool library calling module is used to obtain API instructions from the action buffer, verify the validity of parameters, and call the tool library for execution; the interrupt response module is used to receive interrupt signals through a dedicated communication link, triggering the termination of the current task and resource release; the action buffer is a single-slot queue structure, configured with an instruction overwrite mechanism, retaining only the latest tool library API. The instructions ensure the real-time acquisition of the plan by the execution thread; the centralized memory system is configured with a read / write control module, which has a built-in file lock unit to avoid concurrent read / write conflicts between multiple threads, while supporting simultaneous reading by multiple planned threads and synchronous updating of stored content according to time steps; the tool library includes a browser API subsystem, a search engine API subsystem, a document collection API subsystem, and a commonly used tool API subsystem for performing specific task operations. Each API subsystem provides a standardized calling interface that can be directly called by the tool library calling module of the execution thread.
[0038] Based on the above solution, the dynamic task cooperation system for multi-agent parallel planning and execution of the present invention can be further improved as follows: The centralized memory access module configuration information update detection unit of the planning thread: if it detects a change in information related to the current planning in the centralized memory system (such as new user requests, policy adjustment information shared by other agents), it immediately triggers the planning thread to re-call the API instructions of the large language model generation tool library to ensure that the planning result matches the latest information; the interruption judgment module does not set up additional complex priority judgment logic, but relies entirely on the interruption decision based on the real-time information output of the large language model, reducing the system logic complexity.
[0039] The tool library calling module of the execution thread includes a parameter verification unit: used to verify the completeness of API command parameters (e.g., the "searchWeb" command needs to verify whether it contains the "keyword" parameter) and the legality of the format (e.g., the "url" parameter needs to conform to the HTTP / HTTPS format specification); if the parameters are incomplete or the format is incorrect, the tool library calling module sends a parameter supplementation request to the planning thread through a dedicated communication link, and executes the API call only after obtaining complete and legal parameters; the interrupt response module is configured with a fast termination unit, which completes the termination of the current API call, resource release and cache clearing within 100ms after receiving the interrupt signal, ensuring the speed of task switching.
[0040] Each API subsystem in the tool library is configured with an exception handling unit: if an exception occurs during an API call (such as a browser API timeout or a search engine API returning no results), the exception handling unit will write the exception information (including the exception type, occurrence time, and associated API instructions) into the centralized memory system and return an exception identifier to the execution thread; after receiving the exception identifier, the execution thread will pause the execution of the current task, and the planning thread will regenerate the API instructions (such as "change web address" or "adjust search keywords") based on the exception information in the centralized memory system, thereby achieving automatic recovery in abnormal scenarios.
[0041] The beneficial effects of the dynamic task collaboration system for parallel planning and execution of multiple agents proposed in this invention are as follows: The system architecture is clear and highly decoupled, with the four core modules of planning, execution, memory, and tools operating independently yet cooperating in a coordinated manner, facilitating subsequent maintenance and functional iteration; In particular, the design of the file lock mechanism and the single-slot action buffer provides dual protection for the accuracy of information synchronization and the real-time performance of task execution from both hardware and logic levels, effectively solving the problems of low collaboration efficiency and poor adaptability of existing multi-agent systems, and providing stable and efficient technical support for dynamic task scenarios.
[0042] Furthermore, although the above example uses "multi-agent collaborative literature review writing," the method and system of this invention are not limited to specific scenarios. In different application scenarios, only the API type and number of agents in the tool library need to be adjusted, and the LLM schema needs to be adjusted as appropriate (e.g., for a specific vertical domain, a finely tuned large language model can be used) to directly apply the solution of this invention, which has broad applicability.
Claims
1. A dynamic task collaboration method for multi-agent parallel planning and execution, characterized in that, include: Step 1: Agent initialization. The agent includes independent and parallel planning threads and execution threads. The planning thread is configured with a callable large language model and a read-write centralized memory system. The execution thread is configured with a callable tool library. Step 2: The planning thread executes the planning process. At each time step, it retrieves the latest environmental information, team communication logs, and execution history from the centralized memory system, calls the large language model to generate formatted tool library API instructions as the next step plan, determines whether to trigger the interruption mechanism, generates an interruption signal if triggered, and writes the tool library API instructions into the action buffer. If there are already instructions in the buffer, they are overwritten. Step 3: The execution thread executes the API execution process, continuously retrieves the latest tool library API instructions from the action buffer, calls the tool library to execute the corresponding tasks, and if it receives an interrupt signal sent by the planning thread, it immediately terminates the current task and loads the latest instructions from the buffer for execution. Step 4: The centralized memory system updates content at each time step. The updated content includes environmental observation results returned by the tool library, communication logs between agents, and task execution history of each agent, which are accessible to all planning threads. Any of the tool libraries includes commonly used tool APIs such as browser API, search engine API, document collection API, and other commonly used tool APIs. Any of the action buffers is a single-slot queue that stores only the latest tool library API instructions generated by the planning thread.
2. The dynamic task cooperation method for multi-agent parallel planning and execution according to claim 1, characterized in that, The agent initialization in step 1 also includes: establishing a dedicated communication link between the planning thread and the execution thread of each agent, the communication link being used for real-time transmission of interrupt signals; and configuring a file lock mechanism for the centralized memory system, whereby when any thread of any agent performs read or write operations on the centralized memory system, a file lock is automatically triggered to restrict simultaneous read and write operations by other threads. Only after the thread completes the read / write operation and releases the file lock can other threads access the centralized memory system.
3. The dynamic task cooperation method for multi-agent parallel planning and execution according to claim 1, characterized in that, Step 2, which involves calling the large language model to generate formatted tool library API instructions, includes: constraining the large language model to output JSON format through preset prompt words, wherein the output format is extracted from the JSON dictionary format as "API type (parameter name = parameter value)"; if the API instruction parameters generated by the large language model are missing or other errors occur, they will not be written to the buffer, but the planning step will be skipped and the next planning step will be carried out.
4. The dynamic task cooperation method for multi-agent parallel planning and execution according to claim 1, characterized in that, The determination of whether to trigger the interrupt mechanism in step 2 is made independently by the large language model called by the planning thread. The large language model directly determines whether to trigger an interrupt after analyzing the information obtained from the centralized memory system. The interrupt signal contains only a single instruction of "whether to interrupt". The execution thread only needs to determine whether to terminate the current task and load the latest task in the action buffer according to the instruction.
5. The dynamic task cooperation method for multi-agent parallel planning and execution according to claim 1, characterized in that, Step 3, which involves the execution thread terminating the current task, includes: immediately sending a termination instruction via the utility library API, releasing the network and memory resources occupied by the current task, clearing the current task status cache within the execution thread, reading the latest utility library API instruction from the action buffer, and initializing the execution of a new task after parameter verification.
6. The dynamic task cooperation method for multi-agent parallel planning and execution according to claim 1, characterized in that, The update rules for the centralized memory system described in step 4 include: Environmental observation results: The task environment information of each agent is collected through a timed polling mechanism. The latest environmental information collected directly overwrites the historical information of this type of environment in the centralized memory system, ensuring that the environmental data is up-to-date in real time. Communication Log: Only records "Message Sending Time + Sending Agent Identifier + Message Content", and is automatically sorted and stored in chronological order of sending time, making it easy for each agent to quickly trace the information transmission process in team collaboration; Execution history: Stored content includes structured instructions from the tool library API, as well as inference information when the planning thread calls the large language model to generate the API instructions, for reference in the subsequent planning process.
7. A dynamic task collaboration system for multi-agent parallel planning and execution, characterized in that, include: The system comprises multiple agents, an action buffer, a centralized memory system, and a tool library. Each agent includes a planning thread and an execution thread, which run independently and in parallel. The planning thread is configured with a large language model module, a centralized memory access module, and an interrupt detection module. The centralized memory access module retrieves the latest information from the centralized memory system at each time step. The large language model module generates formatted tool library API instructions. The interrupt detection module determines whether an interrupt is triggered and generates an interrupt signal. Each execution thread is configured with a tool library invocation module and an interrupt response module. The tool library invocation module retrieves API instructions from the action buffer and invokes the tool library for execution. The interrupt response module receives interrupt signals and terminates the current task. The action buffer is a single-slot queue structure with an instruction overwrite mechanism, retaining only the latest tool library API instructions. The centralized memory system is configured with a read / write control module, supporting simultaneous reading by multiple planning threads and synchronous updates of stored content at time steps. The tool library includes a browser API subsystem, a search engine API subsystem, a document collection API subsystem, and a commonly used tool API subsystem for performing specific task operations.
8. The system as described in claim 7, characterized in that, The centralized memory access module configuration information update detection unit of the planning thread: if it detects that the information related to the current planning in the centralized memory system has changed, it immediately triggers the planning thread to call the API instruction of the large language model generation tool library again to ensure that the planning result matches the latest information; the interruption judgment module does not set up additional complex priority judgment logic, but relies entirely on the interruption decision based on the real-time information output of the large language model, reducing the system logic complexity.
9. The system as described in claim 7, characterized in that, The tool library calling module of the execution thread includes a parameter verification unit: used to verify the completeness and format validity of API command parameters; if the parameters are incomplete or incorrect, the tool library calling module sends a parameter supplementation request to the planning thread through a dedicated communication link, and executes the API call only after obtaining complete and valid parameters; the interrupt response module is configured with a fast termination unit, which completes the termination of the current API call, resource release and cache clearing within 100ms after receiving an interrupt signal, ensuring the speed of task switching.
10. The system as described in claim 7, characterized in that, Each API subsystem of the tool library is configured with an exception handling unit: if an exception occurs during an API call, the exception handling unit will write the exception information into the centralized memory system and return an exception identifier to the execution thread; after receiving the exception identifier, the execution thread will pause the execution of the current task, and the planning thread will regenerate the API instruction based on the exception information in the centralized memory system to achieve automatic recovery in abnormal scenarios.
Citation Information
Cited By
Voice control browser operation method and system based on double-agent real-time communication
CN121884813A