Task processing method and apparatus, electronic device, and storage medium

By introducing session identifiers and global file lock mechanisms into the multi-agent system, the problems of complex information synchronization and context consistency in the multi-agent collaborative system are solved, achieving efficient task processing and data consistency, and improving the collaborative effect of large language models.

CN122633645APending Publication Date: 2026-08-25BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610838748.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-10
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Existing multi-agent cooperative systems suffer from problems such as complex information synchronization, weak context consistency, conflicts caused by writing to shared resources, and poor cooperative performance. In particular, the lack of effective cooperative mechanisms in large language model applications leads to inconsistent state understanding and complex system debugging.

Method used

A shared file mechanism based on session identifiers is adopted. By obtaining shared content, target prompt words are generated, a large model is called to execute tasks, and an action summary is written to the shared file after the execution results are executed. Combined with a global file lock and state identifier mechanism, contextual consistency and data consistency under concurrent collaboration are ensured.

Benefits of technology

It achieves state sharing and context consistency among multiple agents, avoids concurrent write conflicts, improves the system's collaborative efficiency and data consistency, and reduces system resource overhead and debugging complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633645A_ABST
    Figure CN122633645A_ABST
Patent Text Reader

Abstract

The present disclosure provides a task processing method and device, electronic equipment and storage medium, relates to the technical field of artificial intelligence, in particular to the technical field of large model and the technical field of agent. The specific implementation scheme is: in response to receiving a to-be-processed task, obtaining shared content from a shared file according to the session identifier of the session to which the to-be-processed task belongs, the shared file being used for storing the output content of multiple agents, and the shared content including the output content of at least one agent for the historical task of the session; generating a target prompt word according to the shared content, calling a large model to execute the to-be-processed task based on the target prompt word, and obtaining an action instruction returned by the large model; executing the action instruction, and generating an action summary based on the execution result of the action instruction; and writing the action summary as the output content of the current agent into the shared file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and more particularly to the field of large model technology and intelligent agent technology. More specifically, this disclosure provides a task processing method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0002] With the development of large language models, multi-agent cooperative systems are widely used in complex task processing. Current cooperative methods mostly rely on message queues, central schedulers, or shared databases for explicit information synchronization. However, this mechanism not only involves complex communication links and high system overhead, but also results in inconsistent state understanding as each agent only maintains a local context. Furthermore, current multi-agent cooperative systems are prone to data overwriting issues when concurrently accessing shared resources. Summary of the Invention

[0003] This disclosure provides a task processing method, apparatus, electronic device, storage medium, and computer program product.

[0004] According to a first aspect, a task processing method is provided, the method comprising: in response to receiving a task to be processed, retrieving shared content from a shared file according to a session identifier of the session to which the task to be processed belongs, the shared file being used to store the output content of multiple agents, the shared content including the output content of at least one agent for historical tasks of the session; generating a target prompt word according to the shared content, invoking a large model to execute the task to be processed based on the target prompt word, and obtaining an action instruction returned by the large model; executing the action instruction, and generating an action summary based on the execution result of the action instruction; and writing the action summary as the output content of the current agent into the shared file.

[0005] According to a second aspect, a task processing apparatus is provided, comprising: an acquisition module, configured to, in response to receiving a task to be processed, acquire shared content from a shared file based on a session identifier of the session to which the task to be processed belongs, the shared file being used to store output content of multiple agents, the shared content including output content of at least one agent for historical tasks of the session; a first processing module, configured to generate target prompt words based on the shared content, invoke a large model to execute the task to be processed based on the target prompt words, and acquire action instructions returned by the large model; a second processing module, configured to execute the action instructions and generate an action summary based on the execution result of the action instructions; and a writing module, configured to write the action summary as the output content of the current agent into the shared file.

[0006] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method provided according to the present disclosure.

[0007] According to a fourth aspect, a non-transitory computer-readable storage medium is provided storing computer instructions for causing a computer to perform the methods provided in this disclosure.

[0008] According to a fifth aspect, a computer program product is provided, comprising a computer program stored on at least one of a readable storage medium and an electronic device, wherein the computer program, when executed by a processor, implements the method provided in this disclosure.

[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0011] Figure 1 This is an exemplary system architecture diagram of a task processing method and apparatus applicable according to an embodiment of the present disclosure;

[0012] Figure 2 This is a flowchart of a task processing method according to an embodiment of the present disclosure;

[0013] Figure 3 This is a flowchart of a task processing method according to another embodiment of the present disclosure;

[0014] Figure 4 This is a flowchart of a task processing method according to another embodiment of the present disclosure;

[0015] Figure 5 This is a flowchart of a task processing method according to another embodiment of the present disclosure;

[0016] Figure 6 This is a flowchart of a task processing method according to another embodiment of the present disclosure;

[0017] Figure 7 This is a block diagram of a task processing system according to an embodiment of the present disclosure;

[0018] Figure 8 This is a block diagram of a task processing apparatus according to an embodiment of the present disclosure; and

[0019] Figure 9 This is a block diagram of an electronic device for a task processing method according to an embodiment of the present disclosure. Detailed Implementation

[0020] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0021] Current multi-agent collaborative systems primarily achieve information sharing and action coordination among agents through explicit message passing mechanisms. Common implementation schemes include centralized control architectures that use a central controller to collect, summarize, and redistribute tasks from sub-agents, or point-to-point communication architectures that utilize message queues and communication interfaces for agents to send messages to each other. In addition, there are environment-driven architectures that use the environment as a state memory for state exchange, and memory-sharing mechanisms that store data in memory for data sharing and information synchronization. Typical examples in related technological research and industrial applications include large language model-based agent collaboration frameworks based on explicit message passing, and round-robin interaction systems used in specific business scenarios.

[0022] However, the aforementioned multi-agent collaboration schemes exhibit numerous shortcomings and deficiencies in practical engineering applications. Specifically, centralized control architectures, where all data and task allocation flow through the central node, lead to excessive pressure on the central node, significant single-point-of-failure risks, and extremely complex overall state management. Point-to-point message queue architectures require the introduction of additional infrastructure, resulting in difficulties in controlling message execution order, synchronizing large language model prompts, and complex system debugging. Architectures incorporating shared databases not only have complex underlying data structure designs and require additional schema management, but are also unsuitable for storing contextual information from long texts, making dynamic concatenation and synchronization of large language model prompts extremely difficult. Furthermore, memory-sharing mechanisms lack inherent persistence capabilities, leading to difficulties in auditing the collaboration process and poor overall system fault tolerance.

[0023] In summary, current multi-agent collaborative systems suffer from problems such as complex information synchronization, weak context consistency, conflicts arising from writing to shared resources, and poor collaborative performance. Specifically, as the number of agents increases, the number of communication links grows exponentially, leading to complex context synchronization, difficulties in state maintenance, and a significant increase in system modulation complexity. Since each agent typically maintains its local task context independently, historical information between agents cannot be kept in strong consistency, resulting in discrepancies in the understanding of the global task state by different agents. This easily leads to serious semantic conflicts or the continuation of erroneous reasoning based on outdated information during collaboration. Particularly in software development-related multi-agent collaborative systems, if one agent has modified the code, and other agents continue to publish based on the old code, severe conflicts will occur. Regarding shared resource writing scenarios, when multiple agents modify shared files simultaneously, issues such as overwriting, state loss, and context rollback can arise, leading to corruption of the global writing state. Furthermore, current multi-agent collaborative systems lack collaborative mechanisms suitable for large language models; for example, they do not consider contextual concatenation of prompt words, agent reasoning behavior, the size of the conversation window, and the non-deterministic output of large language models.

[0024] The collection, storage, use, processing, transmission, provision, and disclosure of any type of information, such as user personal information, in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.

[0025] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.

[0026] Figure 1 This is a schematic diagram of an exemplary system architecture to which task processing methods and apparatus can be applied according to an embodiment of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.

[0027] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0028] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices, including but not limited to smartphones, tablets, laptops, etc.

[0029] Server 105 can be a server providing various services, such as a backend management server supporting websites browsed by users using terminal devices 101, 102, and 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as the action instructions obtained in response to user requests, and the execution results of the action instructions after execution) to the terminal devices. Server 102 can be deployed with a multi-agent collaborative architecture.

[0030] The task processing method provided in this embodiment can generally be executed by server 105. Accordingly, the task processing device provided in this embodiment can generally be located in server 105.

[0031] Figure 2 This is a flowchart of a task processing method according to an embodiment of the present disclosure.

[0032] like Figure 2 As shown, the task processing method 200 includes operations S210 to S240. The executing entity in this embodiment can be any one of the multiple agents participating in multi-agent cooperation.

[0033] In operation S210, in response to receiving a task to be processed, the shared content is retrieved from the shared file based on the session identifier of the session to which the task to be processed belongs.

[0034] In this embodiment of the disclosure, the task to be processed is, for example, a task generated by a user request sent by the user through an interactive interface, or a subtask split from a task generated by a user request. The session identifier can be a string or numeric code used to distinguish different sessions, and the shared file can be a text file on a disk, where the shared content is stored in association with the session identifier. Specifically, a shared file address can be maintained, containing one or more globally shared files used to store the output content of multiple agents. For example, at least one shared file can be maintained for different sessions, and the shared file can be associated with the session identifier. Alternatively, the content output by the agent for different sessions can be associated with the session identifier and stored in a single shared file.

[0035] In this embodiment of the disclosure, the shared content obtained from the shared file may include the output content of at least one agent for historical tasks within the session to which the task to be processed belongs. Historical tasks may be tasks that precede the task to be processed within the same session, or they may be processed sub-tasks split from tasks generated by user requests. In other words, the task to be processed and historical tasks may be different sub-tasks belonging to the same task.

[0036] For example, after receiving a task to be processed, a session identifier can be extracted from the task. If extraction fails, a new session identifier can be assigned to the task. After determining the session identifier of the session to which the task belongs, the shared content can be obtained from the shared file based on the session identifier.

[0037] In operation S220, target prompt words are generated based on shared content, the large model is invoked to execute the task to be processed based on the target prompt words, and the action instructions returned by the large model are obtained.

[0038] In this embodiment of the disclosure, the large model can be a large language model, the target prompt word can be the structured text sent to the large language model to guide it, and the action instruction can be the structured command generated by the large language model based on reasoning to indicate the next operation of the current agent.

[0039] For example, the agent can generate target prompts based on shared content and preset target prompt template rules, and then send the target prompts to a large language model deployed in the cloud or locally. The large language model can perform inference based on the target prompts, such as analyzing the task target, giving the task processing result, and generating action instructions to return to the agent.

[0040] In operation S230, the action instruction is executed, and an action summary is generated based on the execution result of the action instruction.

[0041] In this embodiment of the disclosure, the action summary can refer to a generalized text generated after analyzing and summarizing the action instruction and its execution result. For example, the action instruction is to query a database according to a certain query statement, and the corresponding execution result can be the list data obtained from the query or the error log. After obtaining the execution result, the information such as the task to be processed, the action instruction, and the execution result can be input into a large language model, and the large language model can be used to summarize and generate an action summary.

[0042] In operation S240, the action summary is written to a shared file as the output of the current agent.

[0043] In this embodiment of the disclosure, the action summary can be associated with the session identifier of the session to which the task to be processed belongs and stored in a shared file.

[0044] This disclosure introduces a shared file mechanism based on session identifiers, which avoids the complex explicit message communication between traditional multi-agents. Before executing a task, each agent obtains globally shared content and generates target prompts based on the shared content, ensuring strong consistency of the context and state sharing among multiple agents.

[0045] Figure 3 This is a flowchart of a task processing method according to another embodiment of the present disclosure, such as... Figure 3 As shown, in scenarios where both the first and second agents need to perform task processing, such as... Figure 3 As shown, the first intelligent agent can execute operations S310 to S340 and operation S390, and the second intelligent agent can execute operations S350 to S390.

[0046] In operation S310, target prompt words are generated.

[0047] After receiving the task to be processed, the first intelligent agent can obtain shared content from the shared file to generate target prompt words.

[0048] When operating the S320, the large language model is invoked to generate action instructions.

[0049] The first agent invokes a large language model to generate action instructions based on target prompts.

[0050] When operating S330, execute action instructions.

[0051] The first intelligent agent can invoke tools to execute action commands based on action commands and obtain the execution results of the action commands.

[0052] When operating S340, invoke the large model generation action overview.

[0053] The first intelligent agent can input the execution results of action instructions and the completion status of tasks to be processed into the large language model, and obtain the action overview generated by the large language model.

[0054] When operating S350, generate target prompt words.

[0055] After receiving the task to be processed, the second agent can obtain shared content from the shared file to generate target prompt words.

[0056] When operating the S360, the large language model is invoked to generate action commands.

[0057] The second agent invokes a large language model to generate action instructions based on target prompts.

[0058] When operating S370, execute action commands.

[0059] The second agent can invoke tools to execute action commands based on action commands and obtain the execution results of the action commands.

[0060] When operating S380, invoke the large model generation action overview.

[0061] The second agent can input the execution results of action instructions and the completion status of tasks to be processed into the large language model, and obtain the action overview generated by the large language model.

[0062] When operating S390, write the action summary to a shared file.

[0063] It should be noted that operations S310-S340 and operations S350-S380 can be executed in parallel. However, the embodiments of this disclosure are not limited to this. These two sets of operations can also be executed in other orders, such as executing operations S310-S340 and operation S390 first, and then executing operations S350-S380, or executing operations S350-S390 first, and then executing operations S310-S340 and operation S390.

[0064] For example, after the first agent executes operation S340 to call the large model to generate an action summary, operation S390 is executed first, in which the first agent writes the action summary to a shared file. Then, the second agent executes operations S350 to S390. After S390 is executed, if the first agent receives a task to be processed, it can execute operations S310 to S340 based on the updated file. If the second agent receives a task to be processed, it can execute operations S350 to S390 based on the updated shared file.

[0065] Figure 4 This is a flowchart of a task processing method according to another embodiment of the present disclosure. Figure 4 As shown, the task processing method 400 includes operations S401 to S404.

[0066] When operating S401, read the shared file.

[0067] After receiving the task to be processed, the first intelligent agent 10 performs a read operation on the shared file 20 based on the session identifier of the session to which the task to be processed belongs, so as to obtain the shared content from the shared file 20.

[0068] In operation S402, a reasoning request is made.

[0069] After acquiring the shared content, the first intelligent agent 10 generates target prompt words based on the shared content and requests the large language model 30 to perform the reasoning process based on the target prompt words.

[0070] Operation S403 returns the inference result.

[0071] The large language model 30 performs the reasoning process based on the target prompt word and returns the reasoning result, such as instructing the first agent 10 to perform a specific action.

[0072] In operation S404, write action overview.

[0073] After receiving the reasoning result returned by the large language model 30, the first intelligent agent 10 can call the tool to execute the action based on the reasoning result, such as a specific action instruction, and generate an action summary based on the action execution result and task completion status, and write the action summary to a shared file. The action summary can be generated by the first intelligent agent 10 calling the large language model 30.

[0074] According to embodiments of this disclosure, before writing the action summary as the output of the current agent into a shared file, the method further includes: obtaining the latest modification time of the shared file and the latest read / write time of the current agent for the shared file; in response to the latest modification time being later than the latest read / write time, re-obtaining the shared content from the shared file; and, for the re-obtained shared content, returning to the step of generating target prompt words based on the shared content.

[0075] If another agent updates the file while the current agent is reading and processing a shared file, the shared content obtained by the current agent will become invalid, and continuing to write will lead to a conflict.

[0076] In this embodiment of the disclosure, in order to prevent the current agent from performing write operations based on expired shared files, before the agent writes the action summary to the shared file, it can obtain the latest modification time by reading the metadata of the shared file. The latest modification time can be associated with a session identifier, so as to determine whether other agents have performed other tasks for the session to which the task to be processed belongs in the scenario with multiple sessions. At the same time, this embodiment of the disclosure introduces an agent state machine mechanism, that is, to maintain the latest write time and the latest read time for each agent, and the latest read and write time of the current agent for the shared file can be determined based on the maintained agent state machine.

[0077] After obtaining the latest modification time of the shared file and the latest read / write time of the current agent for the shared file, the latest modification time of the shared file is compared with the latest read / write time of the current agent for the shared file. If the latest modification time of the shared file is later than the latest read / write time of the current agent for the shared file, that is, later than the maximum value of the latest read time and the latest write time, it means that during the time window when the current agent is performing large model inference, other concurrently running collaborative agents have preemptively modified the shared file.

[0078] In this scenario, the shared content can be retrieved again, and the agent can re-enter the node that generates the target prompt word, generating the target prompt word based on the re-retrieved shared content. For example, the system can automatically inject additional prompt words into the agent: "The shared file has been updated by another agent. Your current context has expired. Please reread the shared file content and replan the task based on the latest state. Direct writing is prohibited." Upon receiving these prompt words, the target agent automatically re-enters the node that retrieves the shared content and generates the target prompt word.

[0079] The embodiments disclosed herein intercept expired writes by comparing time, thus avoiding inconsistencies in state such as data overwriting, logical conflicts, and code rollback in concurrent environments.

[0080] Figure 5 This is a flowchart of a task processing method according to another embodiment of the present disclosure. Figure 5 As shown, the task processing method 500 includes operations S510 to S560.

[0081] When operating S510, the agent generates an action overview.

[0082] After the agent invokes the tool to complete the action command, it can call the large language model to summarize and generate an action overview based on the execution status of the action command and the completion status of the pending tasks.

[0083] When operating the S520, determine whether the shared files have been updated.

[0084] Before writing the action summary to the shared file, the agent first determines whether the shared file has been updated before the agent last read it and last wrote it. If so, operation S540 is executed; otherwise, operation S530 is executed.

[0085] When operating the S530, write the action summary to a shared file.

[0086] For example, an action summary can be associated with the session identifier of the session to which the task to be processed belongs and stored in a shared file.

[0087] When operating the S540, reread the shared file.

[0088] If the shared file has been updated, it means that the agent did not generate the target prompt based on the latest shared content in the shared file. In other words, the target prompt generated by the agent has expired. Therefore, the agent needs to reread the shared file to obtain the new shared content.

[0089] When operating S550, regenerate the target prompt words.

[0090] The agent regenerates target prompts based on the reacquired shared content.

[0091] When operating the S560, the large language model is invoked again for inference and the action instructions returned by the large language model are received. The action instructions are executed and an action summary is generated.

[0092] The agent invokes a large language model to perform the reasoning process based on the regenerated target prompts, obtains the reasoning results returned by the large language model, such as action instructions, and then invokes tools to perform actions based on the action instructions and generates a work summary.

[0093] According to an embodiment of this disclosure, the current agent is set with a status flag, which is used to indicate whether the agent has read the latest shared file. Before writing the action summary as the output content of the current agent into the shared file, the method further includes: in response to the status flag indicating that the agent has not read the latest shared file, re-acquiring the shared content from the updated shared file, and for the re-acquiring shared content, returning to the step of generating target prompt words based on the shared content.

[0094] In this embodiment of the disclosure, the state machine of the current agent may also maintain a state flag to indicate whether the agent has read the latest shared file. Before the current agent writes the action summary to the shared file, it can first determine whether the state flag indicates that the current agent has obtained the latest shared content. If the state flag indicates that the current agent has obtained the latest shared content, the action summary can be written to the shared file. Otherwise, the latest shared content is obtained from the shared file, and a target prompt word is generated for the latest shared content.

[0095] This embodiment of the disclosure can directly determine whether the shared content obtained by the current agent has expired by using a status identifier, thereby reducing query overhead and computing resource consumption, and improving the execution efficiency and response speed of anti-collision verification.

[0096] According to embodiments of this disclosure, in response to the current agent writing an action summary as the output of the current agent to a shared file, the state flag of the current agent is set to read, and the state flags of at least one agent other than the current agent are set to unread.

[0097] In this embodiment of the disclosure, after the current agent writes the action summary as the output content of the current agent into the shared file, the state of the current agent is maintained. Since the agent has just completed the latest modification of the shared file and has mastered the latest global state, the state flag of the current agent can be set to read, while the state flags of other agents are set to unread.

[0098] This embodiment of the disclosure avoids the need for each agent to frequently query the time in order to perceive state changes by using state identifiers, thereby reducing system resource overhead and enabling rapid interception of expired write operations and consistency under concurrent collaboration of multiple agents.

[0099] According to embodiments of this disclosure, writing an action summary as the output of the current agent to a shared file includes: acquiring a global file lock, which restricts at most one agent to have write permissions to the shared file at any given time; in response to successful acquisition, writing the action summary to the shared file and releasing the global file lock after writing is completed; in response to acquisition failure, placing the current agent's write task into a waiting queue, acquiring the global file lock after it is released, and returning to the step of retrieving shared content from the shared file.

[0100] In scenarios where multiple agents need to perform write operations on a shared file simultaneously—for example, one agent is updating code status, another is updating a task schedule, and a third is writing to an error log—concurrent writes can lead to problems such as file corruption, overwriting, and partial data loss.

[0101] In this embodiment of the disclosure, to avoid the above-mentioned problems, before the current agent writes the action summary to the shared file, it can first request to acquire a global file lock. The global file lock can be a mutex or a distributed lock, that is, for a shared file with the same session identifier, only one agent is allowed to hold the global file lock at the same time.

[0102] If the acquisition is successful, it means that no other agent needs to perform a write operation on the shared file. Therefore, the current agent can write the action summary to the shared file and release the global file lock.

[0103] If the acquisition fails, it means that another agent is currently performing a write operation on the shared file. Therefore, the write task of that agent can be placed in the waiting queue. After acquiring the global file lock, since the shared file has been updated, the agent can acquire the new shared content, generate target prompts, call the large language model to generate action instructions, execute the actions and generate an action summary, write the action summary to the shared file, and then release the global file lock.

[0104] Figure 6 This is a flowchart of a task processing method according to another embodiment of the present disclosure. Figure 6 As shown, the task processing method 600 includes operations S610 to S690.

[0105] When operating the S610, acquire a global file lock.

[0106] Before writing the action summary to the shared file, the first intelligent agent 10 needs to acquire the global file lock 50.

[0107] Successfully obtained after operating the S620.

[0108] For example, if no other agent is performing a write operation when the first agent 10 acquires the global file lock, the acquisition will be successful.

[0109] When operating the S630, acquire a global file lock.

[0110] Before writing the action summary to the shared file, the second agent 40 needs to acquire the global file lock 50.

[0111] Operation on S640 failed to retrieve data.

[0112] For example, when the second agent 40 attempts to acquire the global file lock, the first agent 10 is already holding the global file lock and needs to perform a write operation, so the second agent 40 fails to acquire it.

[0113] When operating the S650, write the action overview.

[0114] If the first intelligent agent 10 successfully acquires the global file lock 50, it writes an action summary to the shared file 20.

[0115] When operating the S660, release the global file lock.

[0116] After writing the action summary to the shared file 20, the first intelligent agent 10 releases the global file lock 50.

[0117] When operating the S670, allocate a global file lock.

[0118] After the global file lock 50 is released, the global file lock 50 can be assigned to an agent waiting to write in the waiting queue. For example, currently only the second agent 40 is in the waiting queue, so the global file lock 50 can be assigned to the second agent 40.

[0119] Operate S680 and reread.

[0120] After acquiring the global file lock 50, the second agent 40 needs to reread the shared file 20, generate target prompts, call the large model to generate action instructions, execute actions, and generate an action overview because the shared file has been updated by the first agent 10.

[0121] When operating S690, write the action overview.

[0122] The second agent 40 writes the regenerated action summary to the shared file 20. It should be noted that since the global file lock is always held by the second agent 40, no other agent can perform the write operation. Therefore, the regenerated action summary can be directly written to the shared file 20.

[0123] This embodiment of the disclosure avoids overwriting and data corruption of shared resources in high-concurrency scenarios with multiple agents by using a global file lock and a waiting queue mechanism. After a queued agent acquires the lock, it reads the latest shared content, ensuring the consistency between the output instructions of the large model and the latest global state.

[0124] According to embodiments of this disclosure, generating target prompts based on shared content includes: obtaining the dialogue context of the current agent and obtaining shared content from a shared file; and concatenating the dialogue context and the shared content to generate target prompts.

[0125] In this embodiment of the disclosure, the historical interaction records between the agent and the user in the current task can be obtained from the agent's session memory or local database. At the same time, shared content can be obtained from a shared file based on the session identifier. This shared content records information such as an overview of the work completed by other collaborating agents and the progress of the work.

[0126] After obtaining the current agent's dialogue context and shared content, these two parts of text can be concatenated. For example, the shared content can be appended to the end of the dialogue context to obtain the target prompt word.

[0127] This embodiment of the disclosure generates target prompt words by concatenating the local dialogue context of the agent with the globally shared content, enabling the large language model to perform reasoning based on the global collaborative progress, ensuring the global consistency of the reasoning logic, and reducing communication latency and development and deployment costs.

[0128] According to embodiments of this disclosure, the method further includes: concatenating at least one of the current agent's dialogue context, action instructions, action instruction execution results, and the completion status of the task to be processed to obtain summary request information; and summarizing the summary request information using a large model to determine an action overview.

[0129] In this embodiment of the disclosure, after the current agent completes the action and obtains the action instruction execution result and the completion status of the pending task, at least one of the current agent's dialogue context, action instruction, action instruction execution result and the completion status of the pending task can be concatenated to obtain summary request information. That is, messy structured data and long text log records are assembled into a long text prompt word with a clear structure that can be read by a large language model.

[0130] The large language model uses its natural language understanding capabilities to compress and refine the summary request information to obtain an action summary.

[0131] This embodiment of the disclosure summarizes redundant text information to obtain an action overview, which can ensure that the shared content stored in the shared file has high semantic clarity, which is beneficial for other intelligent agents to quickly understand the current state and take over the task.

[0132] According to embodiments of this disclosure, the method further includes: in response to the task being received in the interactive interface through a newly created window, assigning a session identifier to the task; and in response to the task being received in the interactive interface through a history window, determining the session identifier of the session to which the task belongs based on the history window.

[0133] In this embodiment of the disclosure, if the task to be processed is sent by the user through a new window in the interactive interface, it means that the task to be processed belongs to a new session and a new session identifier needs to be assigned to the task to be processed.

[0134] If the task to be processed was sent by the user through a history window such as the history chat list or history project space in the interactive interface, then the session ID to which the task belongs can be determined based on the session ID bound to that history window.

[0135] The embodiments disclosed herein can support concurrent multi-threaded sessions without context data concatenation by identifying the source of the task to be processed and dynamically allocating session identifiers or inheriting historical session identifiers.

[0136] Figure 7 This is a block diagram of a task processing system according to an embodiment of the present disclosure. Figure 7 As shown, the user request receiving module 701 receives user requests, and the task scheduler 702 is used to determine the corresponding intelligent agent from the first intelligent agent 703, the second intelligent agent 704 and the third intelligent agent 705 according to the task to be processed indicated by the user request, and forward the task to be processed to the corresponding intelligent agent, which is responsible for executing the task processing flow.

[0137] The session context splicing module 706 is used to splice the user request with the file under the session to which the user request belongs, and store the spliced ​​session context in the shared file 711.

[0138] The state machine verification module 707 is used to verify whether the shared content received by the agent is the latest shared content. The global file lock acquisition module 709 is used to acquire the global file lock. If the acquisition fails, the write task can be placed in the waiting queue 708. The file update model 710 is used to write the generated action summary to the shared file 711.

[0139] This disclosure can be applied to various large language model-driven scenarios, such as software development collaboration systems: multiple intelligent agents, such as architects, developers, and code reviewers, collaborate on writing and reviewing code, automatically synchronizing project progress in shared files. For example, collaborative research document writing systems: research assistants, editors, and review agents synchronously generate and modify research reports in shared documents. Enterprise knowledge management systems: various business intelligent agents, such as sales or customer service, collaboratively maintain the enterprise knowledge base through shared files. Game and story generation systems: multiple roles, such as narrators, interlocutors, and world setters, synchronize world states through shared files to achieve multi-role narrative generation. Teaching support systems: teacher and student intelligent agents collaboratively advance teaching plans by sharing learning records.

[0140] Taking a software development collaboration system as an example, the architect agent is responsible for requirements analysis and system design, the developer agent is responsible for writing specific code, and the code review agent is responsible for code review.

[0141] Suppose the received user request is: Add a caching mechanism to the current login module. This can be broken down into two sub-tasks: modifying the system architecture and coding and executing the code. The corresponding intelligent agents are the architect agent and the developer agent, respectively.

[0142] For example, it can be determined whether a user request has a corresponding session identifier based on the interactive interface. For instance, if a user sends a request after clicking "Create New Session" or "Create New Project" on the interface, the task scheduler will assign an identifier to it. If the user continues to send requests in an existing chat interface or project space, the session identifier can be determined based on that chat interface. In this scenario, the user request is initiated based on an existing chat interface, so it can be directly determined that a new session identifier does not need to be assigned.

[0143] Upon receiving a user request, the architect agent can retrieve file content from the shared file based on the session identifier, such as the current design scheme. It can also generate prompts based on the dialogue context and the content in the shared file, call the large language model to generate an architecture modification scheme, and then perform state machine verification and acquire a global file lock. If the lock is successfully acquired and the state machine verification passes, the modified scheme is written to the shared file.

[0144] The developer agent is responsible for executing the code writing and execution process. Specifically, the developer agent can read the modified solution in the shared file, and then generate prompt words based on the dialogue context and the modified solution. It can also call the large language model to generate the corresponding code. The developer agent calls the corresponding tools to add a caching mechanism to the current login module based on the generated code and generate an action summary. Then, it performs state machine verification and acquires the global file lock. After successfully acquiring the lock and passing the verification, it writes the action summary to the shared file.

[0145] According to embodiments of this disclosure, this disclosure also provides a task processing apparatus.

[0146] Figure 8 This is a block diagram of a task processing apparatus according to an embodiment of the present disclosure.

[0147] like Figure 8 As shown, the task processing device 800 includes an acquisition module 810, a first processing module 820, a second processing module 830, and a writing module 840.

[0148] The acquisition module 810 is used to, in response to receiving a task to be processed, retrieve shared content from a shared file according to the session identifier of the session to which the task to be processed belongs. The shared file is used to store the output content of multiple agents, and the shared content includes the output content of at least one agent for the historical tasks of the session. The first processing module 820 is used to generate target prompt words according to the shared content, call the large model to execute the task to be processed based on the target prompt words, and obtain the action instructions returned by the large model. The second processing module 830 is used to execute the action instructions and generate an action summary based on the execution result of the action instructions. The writing module 840 is used to write the action summary as the output content of the current agent into the shared file.

[0149] According to embodiments of this disclosure, the task processing device 800 further includes a time acquisition module and a third processing module. The time acquisition module is used to acquire the latest modification time of the shared file and the latest read / write time of the current agent on the shared file. The third processing module is used to, in response to the latest modification time being later than the latest read / write time, re-acquire the shared content from the shared file, and for the re-acquired shared content, return to the step of generating target prompt words based on the shared content.

[0150] According to an embodiment of this disclosure, the current agent is set with a status flag, which is used to indicate whether the agent has read the latest shared file. The task processing device 800 further includes a fourth processing module, which is used to retrieve the shared content from the updated shared file again in response to the status flag indicating that the agent has not read the latest shared file, and return to the step of generating target prompt words based on the shared content for the retrieved shared content.

[0151] According to embodiments of this disclosure, in response to the current agent writing an action summary as the output of the current agent to a shared file, the state flag of the current agent is set to read, and the state flags of at least one agent other than the current agent are set to unread.

[0152] According to embodiments of this disclosure, the writing module 840 includes a global file lock acquisition module, an action summary writing module, and a fifth processing module. The global file lock acquisition module acquires a global file lock, which restricts at most one agent to having write permissions to the shared file at any given time. The action summary writing module, in response to successful acquisition, writes an action summary to the shared file and releases the global file lock after writing is complete. The fifth processing module, in response to acquisition failure, places the current agent's write task in a waiting queue, acquires the global file lock after it is released, and returns to the step of retrieving shared content from the shared file.

[0153] According to embodiments of this disclosure, the first processing module 820 includes a shared content acquisition module and a target prompt word generation module. The shared content acquisition module is used to acquire the dialogue context of the current agent and obtain shared content from a shared file. The target prompt word generation module is used to concatenate the dialogue context and the shared content to generate target prompt words.

[0154] According to embodiments of this disclosure, the task processing device 800 further includes a splicing module and an action summary determination module. The splicing module is used to splice at least one of the current agent's dialogue context, action instructions, action instruction execution results, and the completion status of the task to be processed to obtain summary request information. The action summary determination module is used to summarize the summary request information using a large language model to determine an action summary.

[0155] According to embodiments of this disclosure, the task processing apparatus 800 further includes a session identifier allocation module and a session identifier determination module. The session identifier allocation module is used to allocate a session identifier to the task to be processed in response to the task being received through a new window in the interactive interface. The session identifier determination module is used to determine the session identifier of the session to which the task to be processed belongs based on the history window in response to the task being received through a history window in the interactive interface.

[0156] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0157] Figure 9A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0158] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.

[0159] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0160] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as task processing methods. For example, in some embodiments, the task processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the task processing method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform task processing methods by any other suitable means (e.g., by means of firmware).

[0161] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0162] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0163] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination of the foregoing.

[0164] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0165] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0166] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0167] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

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

Claims

1. A task processing method, comprising: In response to receiving a task to be processed, shared content is obtained from a shared file according to the session identifier of the session to which the task to be processed belongs. The shared file is used to store the output content of multiple agents, and the shared content includes the output content of at least one agent for the historical tasks of the session. Based on the shared content, target prompt words are generated, the large model is invoked to execute the task to be processed based on the target prompt words, and the action instructions returned by the large model are obtained; Execute the action instruction and generate an action overview based on the execution result of the action instruction; The action summary is written to the shared file as the output of the current agent.

2. The method according to claim 1, wherein before writing the action summary as the output of the current agent into the shared file, the method further comprises: Obtain the latest modification time of the shared file and the latest read / write time of the current agent for the shared file; In response to the latest modification time being later than the latest read / write time, the shared content is retrieved again from the shared file. For the retrieved shared content, the step of generating target prompt words based on the shared content is returned.

3. The method according to claim 1, wherein, The current agent is set with a status flag, which indicates whether the agent has read the latest shared file. Before writing the action summary as the output of the current agent into the shared file, the method further includes: In response to the status flag indicating that the agent has not read the latest shared file, the agent retrieves the shared content from the updated shared file again, and returns to the step of generating target prompt words based on the re-retrieved shared content.

4. The method according to claim 3, wherein, In response to the current agent writing the action summary as the output of the current agent to the shared file, the status flag of the current agent is set to read, and the status flags of the at least one agent other than the current agent are set to unread.

5. The method according to claim 1, wherein, The step of writing the action summary as the output of the current agent into the shared file includes: Acquire a global file lock, which is used to restrict that at most one agent has write permission to the shared file at any given time; Upon successful acquisition, a summary of the action is written to the shared file, and the global file lock is released after the writing is complete. In response to the failure to acquire the data, the write task of the current agent is placed in the waiting queue. After the global file lock is released, the global file lock is acquired, and the process of retrieving the shared content from the shared file is returned.

6. The method according to claim 1, wherein generating target prompt words based on the shared content includes: Obtain the dialogue context of the current agent and retrieve shared content from the shared file; The dialogue context and the shared content are concatenated to generate the target prompt word.

7. The method according to claim 1, wherein, The method further includes: The summary request information is obtained by concatenating at least one of the following: the dialogue context of the current intelligent agent, the action command, the execution result of the action command, and the completion status of the task to be processed. The large model is used to summarize the request information to determine the action overview.

8. The method according to claim 1, further comprising: In response to the fact that the task to be processed is received in the interactive interface through a new window, a session identifier is assigned to the task to be processed; In response to the fact that the task to be processed is received in the interactive interface through the history window, the session identifier of the session to which the task to be processed belongs is determined based on the history window.

9. A task processing apparatus, comprising: The acquisition module is used to, in response to receiving a task to be processed, acquire shared content from a shared file according to the session identifier of the session to which the task to be processed belongs. The shared file is used to store the output content of multiple agents, and the shared content includes the output content of at least one agent for the historical tasks of the session. The first processing module is used to generate target prompt words based on the shared content, call the large model to execute the task to be processed based on the target prompt words, and obtain the action instructions returned by the large model; The second processing module is used to execute the action instructions and generate an action overview based on the execution result of the action instructions; The writing module is used to write the action summary as the output of the current agent into the shared file.

10. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.

11. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 8.

12. A computer program product comprising a computer program stored on at least one of a readable storage medium and an electronic device, the computer program implementing the method according to any one of claims 1 to 8 when executed by a processor.