Task processing method and device, computer equipment and storage medium
By breaking down the query content into tasks and executing them concurrently, the inefficiency caused by rigid processes in intelligent dialogue systems is solved, and efficient processing of complex tasks is achieved.
Patent Information
- Application Number
- CN202511767001.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-24
AI Technical Summary
Existing intelligent dialogue systems suffer from low efficiency when handling complex tasks due to rigid processes and insufficient planning capabilities.
By breaking down the query content into tasks, determining multiple tasks and their execution order constraints, executing tasks in the ready state concurrently, and finally merging the task results, efficiency is improved.
By changing the serial workflow to a parallel workflow, waiting time was reduced, and the overall efficiency and accuracy of task processing were improved.
Smart Images

Figure CN121560490A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a task processing method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Technology
[0002] With the rapid development of computer technology, intelligent dialogue systems based on artificial intelligence agents (AI agents) have emerged. These agents are built upon large language models (LLMs) and possess the ability to autonomously understand, perceive, plan, remember, and use tools. In terms of technical architecture, AI agents have shifted from a process-oriented architecture to a goal-oriented architecture, aiming to complete complex tasks through a close integration of perception, thinking, and action.
[0003] In related technologies, the system obtains the query content input by the user, and then processes the query request using a single and fixed serial workflow to obtain the query results. Due to its rigid workflow and insufficient planning capabilities, the system's efficiency is limited when handling complex tasks. Summary of the Invention
[0004] Therefore, it is necessary to provide a task processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve work efficiency in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a task processing method. The method includes:
[0006] Retrieve query results;
[0007] Based on the query content, the task is decomposed to determine multiple tasks for the query content and the execution order constraints between the tasks.
[0008] For each of the tasks, if a prerequisite task with an execution order constraint with the task has been completed, or if the task has no prerequisite task, the task is determined to be in a ready state.
[0009] Execute at least two tasks that are in a ready state concurrently;
[0010] Upon completion of each task, the query results for the query content are obtained by merging the execution results of each task.
[0011] Secondly, this application also provides a task processing apparatus. The apparatus includes:
[0012] The retrieval module is used to retrieve query content;
[0013] The task planning module is used to decompose tasks based on the query content, determine multiple tasks for the query content, and the execution order constraints between the tasks.
[0014] The ready task detection module is used to determine that a task is in a ready state for each task if a prerequisite task with an execution order constraint with the task has been completed, or if the task has no prerequisite task.
[0015] The task execution module is used to concurrently execute at least two tasks that are in the ready state;
[0016] The result merging module is used to obtain the query result of the query content by merging the execution results of each of the tasks after the execution of each task has ended.
[0017] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described task processing method.
[0018] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described task processing method.
[0019] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described task processing method.
[0020] The aforementioned task processing methods, apparatus, computer equipment, computer-readable storage media, and computer program products, before processing the acquired query content, decompose the task based on the query content, determine multiple tasks for the query content, and define the execution order constraints between these tasks. This not only breaks down complex tasks into multiple individual tasks but also clarifies the execution order constraints between tasks, enabling task planning for complex tasks and providing a basis for subsequent concurrent task execution. For each task, if a prerequisite task with an execution order constraint has been completed, or if the task has no prerequisite task, the task is determined to be in a ready state. At least two tasks in the ready state are executed concurrently. Based on the determined execution order constraints, tasks that can be executed concurrently can be accurately identified, transforming a serial workflow into a at least partially parallel workflow, directly reducing unnecessary waiting time and significantly improving work efficiency. Finally, after each task has finished executing, the query results are obtained by merging the execution results of each task. This enables the collaborative summarization of the execution results of multiple tasks, ensuring that query results are adapted to the query content, thereby avoiding global rework and improving overall work efficiency. In other words, the aforementioned task processing methods, devices, computer equipment, computer-readable storage media, and computer program products can improve the overall work efficiency of the task processing process through task planning before task execution, parallel processing during task execution, and result merging after execution. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a diagram illustrating the application environment of the task processing methods in some embodiments;
[0023] Figure 2 This is a schematic diagram of the task processing method in some embodiments;
[0024] Figure 3 This is a schematic diagram illustrating the parallel time period of multiple tasks being processed in parallel in some embodiments;
[0025] Figure 4 This is a schematic diagram illustrating the parallel time period for multiple tasks to be processed in parallel in other embodiments;
[0026] Figure 5 This is a flowchart illustrating the task processing method in some embodiments;
[0027] Figure 6 This is a schematic diagram of the task decomposition process in some embodiments;
[0028] Figure 7 This is a schematic diagram of the task decomposition process in some other embodiments;
[0029] Figure 8 This is a schematic diagram of structured information in some embodiments;
[0030] Figure 9 This is a directed acyclic graph for the query content in some embodiments;
[0031] Figure 10 For other embodiments, it is a directed acyclic graph for the query content;
[0032] Figure 11 This is a flowchart illustrating the task processing method in some other embodiments;
[0033] Figure 12 This is a schematic diagram of a serial loop process in some embodiments;
[0034] Figure 13 This is a schematic diagram of the replanning process after the failure of the serial loop process in some embodiments.
[0035] Figure 14 This is a schematic diagram of the overall system architecture of the task processing method in some embodiments;
[0036] Figure 15 This is a schematic diagram of the complete workflow of task processing in some embodiments;
[0037] Figure 16 This is a structural block diagram of the task processing device in some embodiments;
[0038] Figure 17 These are internal structural diagrams of the computer device in some embodiments;
[0039] Figure 18 This is an internal structural diagram of a computer device in some other embodiments. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0041] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0042] First, the key terms and definitions used in this application will be introduced:
[0043] Large language models: Large-scale AI models with natural language understanding and generation capabilities, such as GPT-4 and LLaMA, are the core engines that drive agents to perform task planning and decision-making.
[0044] An agent is an autonomous software entity capable of perceiving its environment, planning, invoking tools (or its own capabilities), and executing actions to achieve its goals. An agent can encapsulate complex logic and capabilities for solving specific types of problems.
[0045] Global Planning: This refers to a preliminary and complete sequence of task execution steps (such as "analysis-search-comparison-summary") generated by the planning agent at the beginning of task execution, based on the complex goals input by the user.
[0046] A Directed Acyclic Graph (DAG) is a graph data structure consisting of nodes and directed edges, without any cycles. In this invention, it is used for fine-grained decomposition and dependency modeling of global programming.
[0047] Task Node: The basic unit in a DAG, representing an atomic task that can be assigned to a specific Agent for execution.
[0048] Dependency Edge: A directed edge in a Directed Acyclic Graph (DAG) connecting two task nodes, defining the execution order constraints between tasks. The edge "A→B" indicates that node A must complete successfully before node B begins.
[0049] Concurrent execution refers to the simultaneous scheduling and execution of task nodes in a DAG that do not have direct or indirect dependencies, in order to make full use of system resources and shorten the total execution time.
[0050] Summary & Merge Node: A special type of node in a DAG whose responsibility is to wait for all its preceding dependent nodes to finish executing, and then summarize, integrate, deduplicate, or refine the outputs of these nodes to generate a structured intermediate or final report.
[0051] The task processing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, the application environment may include application terminal 110 and server terminal 120. Application terminal 110 and server terminal 120 can communicate via a communication network. This communication network can be a wired network or a wireless network. Therefore, application terminal 110 and server terminal 120 can be directly or indirectly connected via wired or wireless communication. For example, application terminal 110 can be indirectly connected to server terminal 120 via a wireless access point, or application terminal 110 can be directly connected to server terminal 120 via the Internet; this application does not impose any limitations on this.
[0052] In this system, the application terminal 110 can be a terminal, and the server terminal 120 can be either a terminal or a server. Terminals can be, but are not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Optionally, the application terminal 110 can have a client related to content query installed; this client can be an application, a webpage, or a mini-program. The server terminal 120 is the backend server corresponding to the client, or a server specifically designed to provide content query services. Furthermore, the server terminal 120 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The data storage system can store the data that the storage terminal 120 needs to process. The data storage system can be set up independently, integrated into the server 120, or placed in the cloud or on other computer devices.
[0053] In the embodiments of this application, such as Figure 1As shown, a user can send a query to the server 120 through the application client 110 and request the corresponding query results. The server 120 can obtain the query content, break it down into tasks, and determine multiple tasks related to the query content, as well as the execution order constraints between the tasks. Based on this, the server 120 can maintain the status of each task. Specifically, for each task, if a prerequisite task with an execution order constraint has been completed, or if the task has no prerequisite tasks, the server determines that the task is in a ready state. Then, at least two tasks in the ready state are executed concurrently. This state maintenance and concurrent execution process can be repeated multiple times until all tasks related to the query content have been completed. Finally, after all tasks related to the query content have been completed, the query results are obtained by merging the execution results of each task. Optionally, the query results can be fed back to the application client 110 via a communication network.
[0054] like Figure 2 As shown, server 120 can decompose tasks based on query content, obtaining n tasks. The execution order constraints between tasks can be represented by specific fields or by the positional relationship of tasks within the task set. For example, for each task, the "after list" field can be used to indicate the preceding tasks that the task depends on; alternatively, multiple nodes can represent each task in the task set, pointing to the preceding node of a given task, corresponding to the preceding tasks of that task. In the case of unexecuted tasks, server 120 can determine that each unexecuted task is in a ready state if the preceding tasks with execution order constraints have been completed, or if the task has no preceding tasks, and then concurrently execute these ready tasks. Figure 2 If there are no unexecuted tasks in the task set, it means that all tasks related to the query content have been completed. The server 120 can obtain the query results by merging the execution results of each task.
[0055] Optionally, if there are no tasks currently in a ready state, wait for a task to become ready before executing the corresponding task.
[0056] Optionally, when multiple tasks are in a ready state simultaneously, the server 120 can allocate these tasks to these independent resources based on currently available computing resources to achieve concurrent execution of multiple tasks. For example, as shown... Figure 3As shown, in this scenario, the concurrently executing tasks can begin execution simultaneously. Task 1 executes between t1 and t4, Task 2 between t1 and t2, and Task 3 between t1 and t3. Therefore, three tasks execute concurrently between t1 and t2, and two tasks execute concurrently between t2 and t3.
[0057] Optionally, during task execution, the server 120 can return to the step of determining whether there are any unexecuted tasks in the task set, and proceed to the next loop. If other tasks in a ready state are found, there is no need to wait for the current task to complete. Instead, the latest ready task is assigned to an idle process to execute concurrently on top of the current task. For example, such as... Figure 4 As shown, in this scenario, the start times of the concurrently executed tasks can be different. Task 4 is executed between t5 and t7, and Task 5 is executed between t6 and t7. Thus, two tasks are executed concurrently between t6 and t7.
[0058] Optionally, if the server 120 is a server cluster or a distributed system, the task processing method provided in this application can be executed by the scheduling node in the cluster.
[0059] Optionally, the application client 110 can interact with the server client 120 to implement the task processing method provided in this application. For example, the application client can obtain the query content and decompose the task, the server can identify the tasks in the ready state, schedule and execute the tasks, and finally merge the results to obtain the query results and feed them back to the application client 110.
[0060] In some embodiments, such as Figure 5 As shown, a task processing method is provided, which is executed by a computer device. In this embodiment, the method is applied to... Figure 1 Taking server 120 as an example, the explanation includes the following steps:
[0061] Step S502: Obtain the query content.
[0062] The query content refers to the combination of information used to query and retrieve specific content. Optionally, the query content may include one or more elements from the following: explicit instructions, question statements, contextual background, and output format requirements, to provide sufficient and structured semantic constraints and task guidance, aiming to obtain accurate, relevant, and user-expected query results. Instructions or question statements can be used to describe the purpose of the content query. For example, the query content may include "I need to buy a tent, any purchasing suggestions?", describing the query purpose in the form of a question; or it may include "Compare the horsepower, safety, and smart cockpit configuration of car models A, B, and C," describing the query purpose in the form of an instruction. Contextual background describes the current situation and needs. For example, the query content "I like hiking and now want to go out and live in the mountains, I need to buy a tent, any purchasing suggestions?" includes the contextual background "I like hiking and now want to go out and live in the mountains." Output format requirements specify the output requirements of the query results, such as "Please give the results in list form."
[0063] Optionally, the search terms may not be limited to a single field and may include at least one of the following: healthcare, education, office work, and shopping.
[0064] Optionally, the query content can be entered in various ways, such as text or voice. In an exemplary embodiment, the application can display a query content input page, which includes a query content input box, allowing the user to enter their query content. Optionally, the application can also obtain the query content by collecting the user's voice.
[0065] Specifically, users can input their queries through the application, and the server can then interact with the application to retrieve the corresponding query content. Optionally, the server can retrieve the query content actively or passively.
[0066] Step S504: Based on the query content, the task is decomposed to determine multiple tasks for the query content and the execution order constraints between the tasks.
[0067] Task decomposition is the process of breaking down a complex task into a series of smaller, simpler, and easier-to-manage and execute tasks. For the same query, the corresponding task decomposition results are not unique. Optionally, based on the query "Compare the horsepower, safety, and intelligent cockpit configuration of models A, B, and C," it can be decomposed into requirements analysis tasks, query tasks, comparison tasks, etc. Alternatively, based on the query "Compare the horsepower, safety, and intelligent cockpit configuration of models A, B, and C," it can be decomposed into requirements analysis tasks, nine query tasks corresponding to three dimensions for each of the three models, and comparison tasks for each of the three dimensions, etc.
[0068] The execution order constraint between tasks refers to the temporal or logical dependencies between multiple tasks that are decomposed into a complex task. Essentially, this constraint defines the workflow between tasks, specifying which tasks must be executed before, after, or simultaneously with other tasks to ensure the entire task can be completed correctly and efficiently. Optionally, the execution order constraint can characterize mandatory dependencies stemming from the inherent logic or physical laws of the tasks themselves. For example, data must be "extracted from the database" before "analyzed"; or, during a snapshot check of a device's health status, the tasks "detecting real-time CPU (Central Processing Unit) utilization" and "checking current memory usage" need to be executed simultaneously to ensure a unified snapshot of the system state at a given moment.
[0069] Specifically, the server can break down tasks based on the query content, transforming complex tasks related to the query content into a task set that includes multiple tasks, and further determining the execution order constraints between the tasks.
[0070] In an optional embodiment, the server can identify the user's core intent by parsing the query content and matching keywords. Then, the server can decompose the complex request into a series of ordered, atomic task sequences according to its internal predefined business processes or decision trees, and determine the execution order constraints between tasks based on the data flow dependencies between tasks.
[0071] In an optional embodiment, the server can transmit the query content to the planning agent, which parses the query content, performs task planning on the parsed content, obtains a task set including multiple tasks, and determines the execution order constraints between the tasks.
[0072] In this context, an intelligent agent can refer to an autonomous software entity capable of perceiving its environment, planning, invoking tools (or its own capabilities), and executing actions to achieve a goal. An intelligent agent typically encapsulates complex logic for solving a specific type of problem and possesses the ability to autonomously understand, perceive, plan, remember, and use tools. In an exemplary embodiment, the intelligent agent can employ a "thinking + action" reasoning pattern when determining the task for the query content. Thinking refers to the intelligent agent analyzing the current situation and considering what to do next; action refers to the actions performed by the intelligent agent, typically by invoking tools.
[0073] Optionally, an agent can be implemented using a single process or through the collaborative efforts of multiple processes. For example, an agent can correspond to two processes: one responsible for decision-making and another for hardware control. The deployment method of agents on physical machines is not unique. Optionally, the server can adopt a single-machine multi-agent mode, a multi-level multi-agent mode, or a hybrid deployment mode. For example, in a single-machine multi-agent mode, the code and logic of multiple agents can be deployed on a single physical machine. These agents are logically independent, possessing their own data, goals, and behaviors, and interacting through in-process message passing. The multi-machine multi-agent mode is suitable for distributed systems. In this mode, each agent or multiple agents run on different physical machines or virtual machines, communicating and collaborating via a network. In a hybrid deployment mode, some agents can run on the same machine, while others run on other machines, collectively forming a heterogeneous, distributed multi-agent system.
[0074] In practical applications, a multi-agent collaborative framework can be deployed on the server side. By endowing each agent with specific capabilities, they can solve complex problems through division of labor and cooperation. Optionally, these agents can include a planning agent for understanding and parsing user needs. This planning agent can receive the query content provided by the user, clarify the user needs, decompose them into a series of executable tasks, and determine the execution order constraints between the tasks.
[0075] Step S506: For each task, if the preceding task with which the task has an execution order constraint has been completed, or if the task has no preceding task, determine that the task is in a ready state.
[0076] Each task typically undergoes multiple state transitions throughout its lifecycle. The ready state is one of these states. Specifically, in task scheduling and management, a task has met all its prerequisites for execution (especially all its dependent prerequisite tasks have been completed), is ready to be allocated resources (such as computing units, execution threads, etc.) and begin execution, but has not yet actually started running. A task in the ready state has all the necessary inputs, data, or signals in place; the only waiting factor is the scheduling of system resources. Once resources are acquired, it will immediately transition from the "waiting to execute" ready state to the "running" running state.
[0077] Specifically, the server can determine that a task is in a ready state if the status of its prerequisite task is completed, or if the task has no prerequisite task. For example, if task 1 has no prerequisite task, and task 3's prerequisite task is task 2, and task 2 has been completed, then task 1 and task 3 can be determined to be in a ready state.
[0078] Optionally, a task can have one or more prerequisite tasks, and a task can serve as a prerequisite task for one or more other tasks.
[0079] Optionally, when a task is completed, the server can automatically trigger a scan of all subsequent tasks that are prerequisites for that task. For each scanned subsequent task, the server can check whether all its prerequisite tasks have been completed. If so, the subsequent task is marked as ready.
[0080] Optionally, the server can update the task's status from PENDING to Ready and place it in the "Ready Queue" to await allocation of execution resources if all its prerequisite tasks have been completed or if there are no prerequisite tasks. If the task still has other prerequisite tasks that have not been completed, the server can keep it in the PENDING state until all its prerequisite tasks have been completed, that is, all prerequisite dependencies have been satisfied.
[0081] Step S508: Execute at least two tasks that are in the ready state concurrently.
[0082] Concurrent execution of at least two tasks means having the ability to process at least two tasks within a certain period of time. These tasks can run simultaneously at the same time or can be switched and run alternately by quick switching.
[0083] Optionally, scheduling techniques such as time-slice round-robin can be used to alternately execute at least two tasks to achieve concurrent execution of at least two tasks.
[0084] Optionally, parallel execution can be a possible implementation of concurrent execution. Parallel execution of at least two tasks means that within the execution time intervals of these tasks, there exists at least one time period in which two tasks are executing simultaneously. In other words, the execution timelines of the tasks overlap macroscopically, but do not necessarily overlap completely. For example... Figure 3 As shown, although there are no other tasks that execute in parallel with task 1 during the time period from t3 to t4, tasks 1, 2 and 3 execute in parallel during the time period from t1 to t2, and tasks 1 and 3 execute in parallel during the time period from t2 to t3. Therefore, the execution timelines of tasks 1 to 3 overlap.
[0085] Optionally, when multiple tasks are in a ready state simultaneously, the server can allocate at least two of these tasks to independent resources based on available computing resources, enabling parallel execution of at least two tasks. These computing resources can include multiple CPU cores, multiple threads, or different computers within a distributed computing node. In this scenario, the tasks allocated resources can begin running independently within the same time window, with their respective instruction streams processed on different execution units. They share the overall system time but do not block each other during execution. Figure 3 As shown, tasks 1, 2, and 3, which are executed in parallel, can start executing synchronously and do not block each other during execution.
[0086] Optionally, during task execution, if other tasks in a ready state are discovered, the server does not need to wait for the current task to complete. Instead, it allocates the latest ready task to idle computing resources, allowing the latest ready task to be executed in parallel with the current task. For example, such as... Figure 4 As shown, in this case, the start times of the parallel tasks may be different, but there is at least one time period (e.g., the time period between t6 and t7) during which two tasks are executed in parallel.
[0087] Optionally, during concurrent task execution, if concurrent tasks need to share data, synchronization mechanisms such as locks, semaphores, and message passing can be used to coordinate their access to shared resources and ensure data consistency.
[0088] Optionally, when a task finishes execution, the resources it occupies will be released, and the server can change the task's state from running to terminated. Optionally, the server can continuously monitor tasks in the ready state at a set frequency. Optionally, during the concurrent execution of multiple tasks, if there are no available computing resources, the server can also pause the monitoring of ready tasks and re-trigger the monitoring of ready tasks when a task changes from running to terminated, thus forming a continuously flowing workflow.
[0089] In an optional embodiment, concurrent execution of at least two tasks in a ready state includes: assigning a task in a ready state to an agent that is currently in an idle state; changing the assigned task from a ready state to a running state, and changing the agent to which the task was assigned from an idle state to an occupied state; and if, during the execution of a task by an agent, there are other agents currently in an idle state and other tasks in a ready state, then returning to the step of assigning a task in a ready state to an agent in an idle state.
[0090] In practical applications, a multi-agent collaborative framework can be deployed on the server side. By assigning specific capabilities to each agent, they can solve complex problems through division of labor and cooperation. Optionally, these agents can include agents for performing tasks. Specifically, after determining that there are tasks in a ready state in the task set, the server can further determine whether there are agents in an idle state.
[0091] If an agent is currently idle, the server can assign a ready task to that agent and maintain the states of both the agent and the task based on the task allocation. Specifically, the server can change the assigned task from a ready state to a running state, and change the agent receiving the assigned task from an idle state to an occupied state. Furthermore, during the execution of a task, if other agents are currently idle and other tasks are in a ready state, the server can return to the step of assigning the ready task to the idle agent. Figure 4 As shown, at time t6 when task 4 is in the running state, since there are idle agents and ready task 5, the server can assign task 5 to the corresponding agent so that the agent can start executing task 5, thereby achieving concurrent execution of tasks.
[0092] Optionally, if all deployed agents are in an occupied state, or if there are no other tasks in a ready state, task allocation can be delayed. Instead, the agents can wait for them to complete their current tasks and change from an occupied state to an idle state, or wait for a new ready task to appear.
[0093] Optionally, the server can add tasks in the ready state from the task set to a task queue or distributed message queue to await scheduling, and then retrieve tasks from the task queue or distributed message queue for allocation. Optionally, the server can retrieve tasks in descending order of priority.
[0094] Optionally, when there are idle agents and ready tasks, the server can directly assign ready tasks to idle agents to simplify the scheduling logic and further improve work efficiency.
[0095] In the above embodiments, when there are idle agents and ready tasks, the ready tasks are assigned to the idle agents. On the one hand, agents can be deployed flexibly according to specific needs, improving the system's task processing capability; on the other hand, multiple ready tasks can be assigned to multiple idle agents for parallel execution, ensuring that system resources are fully utilized and further improving work efficiency.
[0096] In an optional embodiment, the task processing method further includes: decomposing the task into multiple subtasks during the execution of the task by the agent; determining the execution order constraints corresponding to each subtask based on the execution order constraints corresponding to the task; and assigning the subtask to the agent currently in an idle state if the subtask is determined to be in a ready state based on the execution order constraints of the subtask.
[0097] Optionally, the process of an intelligent agent performing a task can be implemented by calling tools. These tools can be external functions, programs, APIs, or services called through predefined interfaces, with the aim of extending the core capabilities of the intelligent agent. In specific implementations, tools may include document conversion tools, online search tools, webpage reading tools, report generation tools, image generation tools, chart generation tools, webpage generation tools, etc. In this embodiment, when an intelligent agent performs a task, the process of calling a tool can be considered a sub-task. For example, if task A involves online search tools and chart generation tools, the online search process and the chart generation process can be considered sub-tasks of task A, respectively. It is understood that calling a specific tool needs to be combined with the user's query requirements; for example, if the user indicates that online search is not needed, the online search tool will not be called.
[0098] Optionally, during the execution of a task by an intelligent agent, the task can be decomposed into multiple sub-tasks based on semantics. For example, based on the query "Compare the horsepower, safety, and intelligent cockpit configuration of models A, B, and C," a requirement analysis task, a query task, and a comparison task can be obtained. The query task can be further decomposed into nine sub-tasks corresponding to the three models in three dimensions, and the comparison task can be further decomposed into sub-tasks for each of the three dimensions.
[0099] It is understandable that the execution order constraints of each subtask obtained from the decomposition are determined based on the execution order constraints corresponding to the decomposed task. Specifically, the execution order constraints between each subtask and other tasks match the execution order constraints of the decomposed task; the execution order constraints among the subtasks are determined based on the logical dependencies between them. For example, when a query task is decomposed into nine subtasks corresponding to three car models across three dimensions, since the query task before decomposition serves as a prerequisite for the comparison task, the nine subtasks after decomposition are all prerequisites for the comparison task. Because there are no logical dependencies between these nine subtasks, there are no execution order constraints among them; they are parallel tasks.
[0100] When multiple subtasks are decomposed into tasks, the server can schedule these tasks to execute concurrently. The concurrently executed objects can include at least one of tasks or subtasks. That is, for each subtask, if the server determines that the subtask is ready based on its execution order constraints, it can assign the subtask to an idle agent to achieve concurrent execution of multiple ready tasks. Optionally, for complex tasks, the server can further decompose the subtasks and perform concurrent scheduling based on the decomposition results to further improve efficiency.
[0101] For example, such as Figure 6 As shown, for the query "What are the most popular tennis rackets right now? What model of tennis racket does athlete A use? I want to buy a tennis racket, is the tennis racket used by athlete A suitable for me? I am a girl, 170cm tall, please recommend a tennis racket that suits me," four tasks can be planned through task breakdown. Task 1 is "User Needs Analysis," which analyzes the user's basic information and purchasing needs, filters popular tennis rackets suitable for women of 170cm height on the current market, and initially identifies several mainstream models; Task 2 is "Tennis Racket Used by Athlete A"; Task 3 is "Matching Analysis of Athlete A's Tennis Racket with User Needs"; and Task 4 is "Recommendation and Result Generation." Optional tasks include... Figure 6As shown, the server can rewrite the query content entered by the user by rewriting the query content and analyzing the problem, so as to complete the task decomposition.
[0102] Tasks 1 and 2 have no prerequisite tasks and no dependencies on each other, so they can be executed concurrently. Task 3 needs to wait for the results of Tasks 1 and 2 before it can execute, and Task 4 needs to wait for the results of Tasks 1 and 3 before it can execute. In other words, Tasks 1 and 2 are prerequisite tasks for Task 3, and Tasks 1 and 3 are prerequisite tasks for Task 4.
[0103] Optionally, different task states can correspond to different display styles, which can be characterized by at least one of the following: color, status indicator, etc. For example, Figure 6 The task status for Task 1 and Task 2 is "in progress," and their corresponding text and boxes are displayed in blue.
[0104] Optional, such as Figure 7 As shown, when executing Tasks 1 and 2, Task 1 can be further broken down into three search subtasks: Task 11, Task 12, and Task 13. Task 11 searches for parameters of popular women's tennis rackets this year; Task 12 searches for recommendations of mainstream tennis racket brands; and Task 13 searches for comparisons of parameters for lightweight and easy-to-control tennis rackets. There are no execution order constraints between Tasks 11, 12, and 13; they can be executed concurrently.
[0105] Optionally, Task 2 can be further broken down into three tasks: Task 21, Task 22, and Task 23. Task 21 searches for the tennis racket model currently used by A, Task 22 determines the specific parameters after identifying the racket model, and Task 23 summarizes and organizes these parameters. Task 21 is a prerequisite sub-task of Task 22, and Task 22 is a prerequisite sub-task of Task 23. Furthermore, Task 21 is further divided into three tertiary tasks: Task 211, Task 212, and Task 213. Task 211 searches for the racket model used by A in matches, Task 212 searches for the racket model currently used by A, and Task 213 searches for the racket model for which A has a contract.
[0106] During execution, Task 1 and Task 2 can start simultaneously. Task 1 first performs task decomposition, then concurrently executes three search subtasks; Task 2 first performs task decomposition, then executes the decomposed Task 21, which in turn performs task decomposition again, and then concurrently executes three tertiary tasks. Optionally, the search agent can concurrently execute the three search subtasks of Task 1 first, then concurrently execute the three search subtasks under Task 21, meaning a maximum of six search tasks can be in execution at any given time.
[0107] In the above embodiments, the task is further decomposed during the task execution process, and the subtasks obtained after decomposition are concurrently scheduled and executed. This can significantly increase the number of concurrent tasks, so as to maximize the utilization of the system's computing resources and further improve work efficiency.
[0108] Step S510: After each task has finished executing, the query results of the query content are obtained by merging the execution results of each task.
[0109] Specifically, the server can continuously monitor the task status of each task, and once it confirms that each task for the query content has been completed, it can determine that the execution of each task has ended. Then, the server can collect the execution results of each task, integrate and merge the data, and obtain the query results for the query content.
[0110] Optionally, the process of merging multiple execution results can use at least one of the following methods: merging, aggregation, sorting, deduplication, or structured assembly. Structured assembly refers to assembling the execution results of each task into a complete query result according to a predetermined data structure, making it easier for users to view. For example, assembling separately processed components such as titles, body text, and images into a complete document or page.
[0111] Optionally, during the merging of execution results, if the server detects missing data, it can create a new task to complete the missing data, achieving immediate and small-scale correction. This new task can be a single task or a set of tasks. The processing procedure for the new task is described above and will not be repeated here.
[0112] The aforementioned task processing method, before processing the acquired query content, decomposes the task based on the query content, determining multiple tasks related to the query content and the execution order constraints between these tasks. This not only breaks down complex tasks into multiple individual tasks but also clarifies the execution order constraints between tasks, enabling task planning for complex tasks and providing a basis for subsequent concurrent task execution. For each task, if the prerequisite task with an execution order constraint has been completed, or if the task has no prerequisite task, it is determined to be in a ready state. Concurrent execution of the ready tasks allows for accurate identification of tasks that can be executed concurrently based on the determined execution order constraints, transforming a serial workflow into a workflow that is at least partially parallel, directly reducing unnecessary waiting time and significantly improving work efficiency. Finally, after the execution of each task related to the query content is completed, the query results are obtained by merging the execution results of each task. This enables collaborative summarization of the execution results of multiple tasks, ensuring that the query results are adapted to the query content, thereby avoiding global rework and improving overall work efficiency. In other words, the overall efficiency of the task processing process can be improved by task planning before task execution, parallel processing during task execution, and result merging after execution.
[0113] In one embodiment, task decomposition is performed based on the query content to determine a set of tasks for the query content and execution order constraints between tasks in the task set. This includes: obtaining first prompt information to guide the large language model to decompose the tasks; inputting question information containing the first prompt information and the query content into the large language model; and determining multiple tasks for the query content and execution order constraints between tasks based on the output of the large language model.
[0114] Large Language Models (LLMs) are large-scale AI (Artificial Intelligence) models with natural language understanding and generation capabilities, such as GPT-4 and LLaMA. In the application of LLMs, prompts are the core instructions and information carriers for interaction and communication with the model. Essentially, they are a set of input information provided by the user to the model, designed to stimulate the model's internal knowledge and capabilities, and guide it to generate output that conforms to specific intentions, formats, and contextual requirements. In this embodiment, the LLM can be the core engine driving the agent to perform task planning and decision-making.
[0115] The initial prompts guide the large language model in task decomposition and may include at least one of the following: role setting, core instructions, output format, constraints, and thought guidance. Role setting helps the large language model assume the correct role and use a specific mindset, such as "Assume you are an experienced strategy planner." Core instructions clearly and explicitly require the large language model to decompose the task, such as "Please break down the following task into specific execution steps." Output format constrains the output of the large language model, making the results structured, clear, and easy to understand, such as "Please output the task decomposition results according to the following format." Constraints and thought guidance remind the large language model of key points to consider during the decomposition process, such as dependencies, resources, and priorities, such as "Which steps must begin after other steps? Which steps are independent and can be performed simultaneously? Which steps require summarizing the results of multiple previous steps?"
[0116] Specifically, the server can obtain initial prompts to guide the large language model in task decomposition. These initial prompts can be pre-designed or entered in real-time. Then, the server can combine the initial prompts with the query content to obtain the question information. For example, the question "Please break down the following task into specific execution steps: Compare the horsepower, safety, and smart cockpit configuration of models A, B, and C" includes the initial prompt "Break down the following task into specific execution steps" and the query content "Compare the horsepower, safety, and smart cockpit configuration of models A, B, and C".
[0117] Then, the server can input the query information into the large language model, so that the large language model, guided by the first prompt, can decompose the query content into tasks and output the task decomposition results. Based on the output of the large language model, the server can then determine the multiple tasks for the query content and the execution order constraints between these tasks. Optionally, the first prompt may include output format requirements so that the large language model can directly output the multiple tasks for the query content and the execution order constraints between these tasks. The server can then directly use the output of the large language model as the multiple tasks for the query content and the execution order constraints between these tasks.
[0118] In an exemplary embodiment, multiple tasks related to the query content and the execution order constraints between these tasks can be represented using at least one of the following methods: task tree, dependency matrix, etc. Optionally, each node in the task tree can represent a task, and the parent-child relationship between nodes can be used to represent the execution order constraints between tasks; for example, a task may require its corresponding parent task to finish executing before it can be executed. Optionally, the execution order constraints between N tasks can be described by an N×N matrix, where matrix element a... ij This indicates whether task i depends on task j. For example, 1 indicates dependency and 0 indicates no dependency.
[0119] In the above embodiments, the large language model is guided to decompose the query content by the first prompt information. Thanks to the cognitive flexibility and reasoning ability of the large language model, it can match the diverse needs of different users by constructing appropriate first prompt information, which helps to improve the accuracy of the task decomposition results for the query content.
[0120] In an optional embodiment, each task is represented by a node in a directed acyclic graph (DAG); the directed edges in the DAG connecting two nodes represent the execution order constraints between the two tasks corresponding to the two nodes. In this embodiment, based on the output of the large language model, determining multiple tasks for the query content and the execution order constraints between each task includes: obtaining structured information from the output of the large language model; determining the tasks described by multiple first fields in the structured information and the prerequisite tasks of each task by parsing the structured information; and constructing a DAG for the query content based on each task and its prerequisite tasks.
[0121] A Directed Acyclic Graph (DAG) is a graph data structure consisting of nodes and directed edges, without any cycles. Specifically, in this embodiment, each node in the DAG represents a different task, and the directed edges connecting two nodes represent the execution order constraints between the two tasks corresponding to those two nodes.
[0122] Structured information refers to data information that follows a predetermined pattern, used to clearly define the hierarchical, relational, or logical relationships between data elements. This structured information contains a one-to-one correspondence between a first field and a second field; the first field describes the task; the second field corresponding to the first field is either empty or describes a prerequisite task that has an execution order constraint with the task described by the first field. Specifically, an empty second field corresponding to the first field indicates that the task described by the first field is the first task that does not depend on other tasks.
[0123] Optionally, structured information can be, for example, JSON or YAML structured information. Taking JSON structured information as an example, the first field could be "id", the second field could be "after list", where "id=compare power" describes the horsepower comparison task, and "id=search suv power" describes the horsepower query task. The "after list" field corresponding to the horsepower comparison task can include "search suv power", indicating that the horsepower query task is a prerequisite task for the horsepower comparison task. Optionally, such as... Figure 8 As shown, the structured information can also include a description field "description", which describes the specific task content.
[0124] Specifically, the server can guide the large language model to output structured information containing a first field and a second field by using the output format constraints in the first prompt message. Then, by parsing the structured information, it determines the tasks described by the multiple first fields and the prerequisite tasks for each task. Finally, according to each task and its prerequisite tasks, a directed acyclic graph (DAG) is constructed for the query content, so that each node in the DAG represents a different task. The directed edges connecting two nodes in the DAG represent the execution order constraints between the two tasks corresponding to the two nodes. Optionally, when the second field corresponding to the first field is empty, the server can use the first task described by the first field as the first node in the DAG. If there is a second task with the first task as a prerequisite, the server can draw a second node connected to the first node, which represents the second task, and so on, until all nodes corresponding to all tasks have been drawn.
[0125] For example, the directed acyclic graph constructed for the query "Compare the horsepower, safety, and smart cockpit configuration of models A, B, and C" can be as follows: Figure 9 As shown, the graph includes a requirements analysis node, query nodes corresponding to the nine query tasks for each of the three vehicle models across the three dimensions, and comparison nodes corresponding to the comparison tasks for each of the three dimensions. Optionally, the directed acyclic graph can also include result merging nodes to fully present the task architecture for the query content.
[0126] Optionally, if the first prompt does not include an output format, the server can perform semantic understanding and format conversion on the output of the large language model to obtain the structured information of the first and second fields.
[0127] In the above embodiments, the use of directed acyclic graphs to represent tasks and the execution order constraints between tasks can intuitively and clearly present all tasks and the dependencies between them, providing a foundation for subsequent parallel task scheduling.
[0128] In an optional embodiment, the task processing method further includes: for any task, if the task has been completed, changing the state of the node corresponding to the task in the directed acyclic graph to the completed state; if all nodes in the directed acyclic graph are in the completed state, determining that each task has been completed.
[0129] Specifically, the server can maintain the task state of the tasks represented by the nodes by maintaining the node states in the directed acyclic graph. For any given task, the server can change the state of the node corresponding to that task in the directed acyclic graph to the "completed" state when the task finishes execution, and determine that all tasks have finished execution when all nodes corresponding to each task in the directed acyclic graph are in the "completed" state.
[0130] Optionally, the end status can include a success status (SUCCESS) and a failure status (FAILED). The server can change the status based on the task execution result when the task execution ends. When the task is executed successfully, the status of the node corresponding to the task is changed to "SUCCESS", and when the task fails, the status of the node corresponding to the task is changed to "FAILED".
[0131] Optionally, each task typically undergoes several state transitions during its lifecycle. When a task is created, its corresponding node state can be PENDDING; when the task's preceding tasks are empty or all preceding tasks have been completed (status: SUCCESS), the task's corresponding node state can change from PENDDING to READY; when the task begins execution, its corresponding node state can change from READY to RUNNING; and when the task finishes execution, its node state can change from RUNNING to ENDY.
[0132] Optionally, if the directed acyclic graph also includes a result merging node, the server can determine the completion of each task when all nodes except the result merging node are in the completed state.
[0133] In the above embodiments, by maintaining the node states in the directed acyclic graph, the task state maintenance for the tasks represented by the directed acyclic graph can be achieved. This can clearly present the dependencies between tasks, accurately locate the state of each task, and thus enable overall control of task progress, improving the efficiency and accuracy of task management.
[0134] In an optional embodiment, the task processing method further includes: for any task, when the task execution is completed, feeding back the task execution result to the large language model; and updating the multiple tasks for the query content and the execution order constraints between the tasks based on the task adjustment information output by the large language model according to the execution result.
[0135] In practical applications, the task breakdown results can be dynamically adjusted based on the actual task execution. Specifically, for any task, upon completion, the server can feed back the task execution result to the large language model. The large language model, based on the original task breakdown results and referring to the task execution result, can determine whether task adjustments are needed. If so, the large language model can output corresponding task adjustment information to update the multiple tasks for the query content and the execution order constraints between the tasks. If no adjustment is needed, the large language model can output a prompt to keep the breakdown results unchanged, so that the server can execute the task according to the original task breakdown results.
[0136] Optionally, the server can adjust the directed acyclic graph to adjust the constraints on the task set and the execution order between tasks in the task set.
[0137] Optionally, the large language model can be deployed on the planning agent, which can then use the large language model to decompose and adjust tasks.
[0138] Optionally, when a task fails, other tasks that originally depended on it will also fail. In this case, a replacement task needs to be added to ensure the overall task can proceed smoothly. For example, if the task "Model A Horsepower Query" fails, multiple tasks such as "Model A Maximum Torque Query", "Model A Maximum Power Speed Query", and "Model A Horsepower Calculation" can be added to calculate the horsepower of Model A based on the maximum torque and maximum power speed. Horsepower = Maximum Torque * Maximum Power Speed / Constant.
[0139] Optionally, when disruptive new information is discovered during task execution, adjustments can be made to tasks related to that new information. For example, during the execution of the task "Smart Seat Configuration for Model A," it might be discovered that Model A is discontinued, and an upgraded model A1 is now available. Directly comparing with Model A might provide users with outdated information. In this case, a new task can be added to confirm with the user whether they still want to compare with Model A. Furthermore, if the user chooses to upgrade to Model A1, a new query task branch for Model A1 can be added.
[0140] In the above embodiments, updating multiple tasks for the query content and the execution order constraints between tasks based on the task execution results enables dynamic adjustment of task decomposition results to cope with uncertainties in the task execution process and improves the robustness of the task processing process.
[0141] In one embodiment, concurrent execution of at least two tasks in a ready state includes: determining a plurality of agents currently in an idle state; and assigning the at least two tasks in the ready state to each agent so that each agent executes the assigned tasks in parallel.
[0142] In this context, an agent being in an idle state means that the agent has not been assigned any tasks, has not performed any operations, and is waiting for new instructions. Specifically, the server can identify agents currently in an idle state and assign at least two tasks in a ready state to each agent in a one-to-one correspondence, so that each agent can execute the assigned tasks in parallel.
[0143] In an optional embodiment, the server can implement task scheduling through a scheduler. Specifically, the scheduler can find tasks in the ready state, add these tasks to the ready task queue, then check the available idle agent resources and the ready task queue, assign the tasks in the queue to idle agents for execution, and change the assigned tasks to the running state. Next, the scheduler can receive the execution callbacks from the agents, change the task to the finished state, and store its output in the context. The above process is repeated until all tasks have been executed or a fatal error is encountered.
[0144] In an optional embodiment, the agent assigned a task will change from an idle state to an occupied state. When an idle agent in the occupied state completes its current task, it will change back to an idle state, and the corresponding computing resources will be released again. It is understood that the resource release time for multiple agents simultaneously assigned tasks is not unique. Based on this, the server can continuously monitor ready tasks and idle agents, and when both idle agents and ready tasks exist simultaneously, perform the next round of task allocation, thereby forming a continuously flowing pipeline to ensure the smooth progress of tasks.
[0145] In the above embodiments, at least two tasks in the ready state are assigned to each agent so that each idle agent can execute the assigned tasks in parallel. On the one hand, this can minimize the idleness of agent resources and improve the utilization of computing resources. On the other hand, each task can be executed by different agents, so that the parallel execution of each task does not block each other during the execution process, which is conducive to further improving work efficiency.
[0146] In an optional embodiment, assigning at least two tasks in a ready state to each agent includes: determining the task type for each task that will be in a ready state; and assigning the task to a target agent if there is a target agent among the agents that matches the task type.
[0147] Task type refers to a classification of tasks based on their core objectives, required operations, and the form of their output. It abstracts the specific content of the task and focuses on its solution pattern. Task types can include query, comparison, calculation, translation, etc.
[0148] In practical applications, specialized agents can be deployed for specific task types. This is understandable because specialized agents do not need to handle irrelevant logic, which improves response speed. Furthermore, lightweight, specialized agent deployment based on specific task requirements helps reduce resource consumption. In this scenario, the server can determine the task type for each task that is about to enter the ready state, and if a target agent matching the task type exists among the agents, assign the task to that target agent.
[0149] For example, for query-type tasks, if there is a target agent among the idle agents that is used to perform query-type tasks, the server can assign the task to the target agent; if all the idle agents are used to perform non-query-type tasks, no task assignment will be performed for that task.
[0150] In the above embodiments, matching agents according to task type enables the design of dedicated agents based on task requirements. This eliminates the need for agents to deploy and process irrelevant logic, reducing resource consumption and improving response speed. Furthermore, decomposing the system into multiple dedicated agents according to task type makes the entire architecture modular. This not only enables fault isolation between different agents but also facilitates independent development, testing, upgrading, and replacement of agents, thereby enhancing the system's reliability and maintainability.
[0151] In an optional embodiment, determining multiple agents currently in an idle state includes: identifying multiple agents currently in an idle state from a set of agents deployed for the query content. In this embodiment, the task processing method further includes: determining the task type of each task; for each task type, determining the number of agents matching that task type based on the number of tasks belonging to that task type in each task; and deploying a set of agents for the query content according to the number of agents matched for each task type.
[0152] The number of agents is positively correlated with the number of tasks. In other words, the more tasks there are for a particular task type, the more agents can be deployed for that task type.
[0153] In practical applications, after task decomposition, the server can deploy a corresponding set of intelligent agents based on the decomposition results. Then, during subsequent task processing, the resources of these intelligent agents can be used to concurrently process each task. Specifically, the server can determine the task type of each task in the decomposition results. Then, for each task type, based on the number of tasks belonging to that type in the decomposition results, the number of intelligent agents matching that task type is determined. Finally, according to the number of intelligent agents matching each task type, a set of intelligent agents is deployed for the query content.
[0154] Optional, such as Figure 8 As shown, the structured information determined by task decomposition can also include agent types that match the task type. For example, analysis tasks match analysis agents (analysis_agent); query tasks match query agents (search_agent); and comparison tasks match comparison agents (compare_agent).
[0155] For example, for the query "Compare the horsepower, safety and smart cockpit configuration of three models A, B and C", since the corresponding task set includes nine query tasks and three comparison tasks, the number of deployed query agents Q1 can be greater than the number of comparison agents Q2.
[0156] In the above embodiments, for the query content, the set of intelligent agents is deployed according to the number of intelligent agents that are positively correlated with the number of tasks of that task type in the decomposition results. This can ensure that the number of intelligent agents can match the application requirements of task concurrency, which is conducive to further improving work efficiency.
[0157] In one embodiment, assigning at least two tasks in a ready state to each agent includes: determining the number of tasks in a ready state and the number of agents in an idle state; if the number of tasks is greater than the number of agents, assigning at least two tasks with relatively high priority and in a ready state to each agent according to the number of agents.
[0158] Specifically, the server can determine the number of tasks in the ready state and the number of agents in the idle state. If the number of tasks is less than or equal to the number of agents, the server can assign the ready tasks to different idle agents to enable concurrent execution. If the number of tasks exceeds the number of agents, the server can assign at least two tasks with relatively high priority and in the ready state to each agent, based on the number of agents. Optionally, the server can prioritize task allocation based on the start time of task readiness, using a first-come, first-served approach. Optionally, tasks in the ready state can be placed in a ready task queue and sequentially allocated to idle agents using a first-in, first-out (FIFO) approach.
[0159] In an optional embodiment, the server can determine the number of tasks belonging to that task type and in a ready state, and the number of agents matching that task type and in an idle state for each task type. Then, if the number of tasks is greater than the number of agents, the server can assign at least two tasks with relatively high priority and in a ready state to each agent according to the priority of each task belonging to that task type.
[0160] In practice, when a task is decomposed into multiple subtasks, the first subtask in each subtask that has no preceding subtask can inherit the priority of the task before it was decomposed. For example... Figure 7 In this context, tasks 11, 12, and 13 can inherit the priority of task 1, while task 21 can inherit the priority of task 2. Since task 21 is a prerequisite for task 22, these two tasks will not be in a ready state at the same time.
[0161] Optionally, for multiple subtasks in a ready state obtained from the decomposition of the same task, tasks can be allocated in a priority manner based on the start time of each subtask's ready state, according to the principle of first-come-first-served.
[0162] In the above embodiments, when there are not enough idle agents, allocating higher priority tasks can achieve priority-based resource scheduling, which can ensure that more important tasks can be prioritized and improve the reliability of the system.
[0163] In an optional embodiment, the task processing method further includes: determining the execution order hierarchy of each task based on the directed acyclic graph for the query content; and determining the priority of each task based on its respective execution order hierarchy.
[0164] The execution order level of a task refers to the level of the node corresponding to the task in the directed acyclic graph (DAG). Specifically, each node in the DAG corresponds to a task; the directed edges connecting two nodes represent the execution order constraints between the two tasks corresponding to those nodes. Tasks with higher execution order levels have higher priority than tasks with lower execution order levels.
[0165] For example, such as Figure 10 As shown, if the directed connection between node A and node D is "node A→node B→node C→node D", then node A is in the first execution order level, node B is in the second execution order level after the first, node C is in the third execution order level after the second, and node D is in the fourth execution order level after the third. And so on. Figure 10 The nodes in the second execution order level also include E and H; the nodes in the third execution order level include F and I; the nodes in the fourth execution order level include J; and node G is in the fifth execution order level. In this case, as... Figure 10 As shown, when the tasks corresponding to nodes A and H have been completed, the tasks corresponding to nodes B and I are in a ready state. Since node B is in the second execution order level and node I is in the third execution order level, the priority of the task corresponding to node B is higher than the priority of the task corresponding to node I.
[0166] Specifically, the server can determine the execution order level of each task based on the position of the node corresponding to the task in the directed acyclic graph, and then sort them according to the execution order to determine the priority of each task. Thus, when there are not enough idle agents, task scheduling can be performed based on priority.
[0167] In practical implementation, when a task is decomposed into multiple subtasks, the priority of each subtask can be determined based on its respective execution order hierarchy. For example... Figure 7 In the process, the three search subtasks under Task 1 and the three search subtasks under Task 21 are all in a ready state. However, since the three search subtasks under Task 1 are at the higher level, they can be executed first when there are not enough idle search agents.
[0168] In the above embodiments, the scheduling priority of tasks is determined according to the execution order hierarchy of tasks. This allows for the wired execution of tasks at higher levels, quickly preparing the necessary input data or preconditions for subsequent tasks. This maximizes concurrency, reduces idle waiting time, and helps to further improve resource utilization and work efficiency.
[0169] In one embodiment, the query results of the query content are obtained by merging the execution results of each task, including: obtaining a second prompt message to guide the large language model to merge the execution results; determining a question message containing the second prompt message and the execution results of each task; and inputting the question message into the large language model to guide the large language model to output the query results of the query content by merging the execution results of each task.
[0170] The second prompt information is used to guide the large language model in merging execution results. Similar to the first prompt information, the second prompt information may also include at least a portion of content such as role settings, core instructions, output format, constraints, and thought guidance. Specifically, the server can obtain the second prompt information used to guide the large language model in merging execution results, determine the query information containing the second prompt information and the execution results of each task, and then input the query information into the large language model to guide the large language model to output the query results by merging the execution results of each task.
[0171] Optionally, the query information may include the execution results of at least a portion of the tasks in the task set.
[0172] Optionally, the query information may include the execution results of each preceding node before the result merging node. For example, such as... Figure 9 As shown, the final merged content can include the execution results of the three comparison tasks. In this case, the second prompt message could include, for example, "Please integrate the following multiple comparison reports into a unified, structured final report."
[0173] In the above embodiments, the question information includes a second prompt message for guiding the large language model to merge the execution results, as well as the execution results of each task. The question information is input into the large language model to guide it to output the query results of the query content by merging the execution results of each task. This ensures the completeness and coherence of the final output results, achieves the final closed loop of task decomposition, and ensures that the output query results match the initial query content.
[0174] In one specific embodiment, a method is provided as follows: Figure 11 As shown, a task processing method is provided, which can be executed by a computer device, wherein the computer device is Figure 1 Taking the server-side as an example, in this embodiment, the method includes the following steps:
[0175] Step S1101: Obtain the query content and the first prompt information used to guide the large language model to decompose the task;
[0176] Step S1102: Input the question information containing the first prompt information and the query content into the large language model, and obtain the structured information output by the large language model;
[0177] The structured information contains a one-to-one correspondence between a first field and a second field; the first field is used to describe the task; the second field corresponding to the first field is empty, or the second field corresponding to the first field is used to describe a preceding task that has an execution order constraint with the task described by the first field;
[0178] Optionally, if the first prompt message does not contain an output format, the server can perform semantic understanding and format conversion on the output of the large language model to obtain the structured information of the first and second fields.
[0179] Step S1103: By parsing the structured information, determine the tasks described by the multiple first fields in the structured information, as well as the prerequisite tasks for each task.
[0180] Step S1104: Based on each task and its predecessor task, construct a directed acyclic graph for the query content, and initialize the nodes corresponding to each task in the directed acyclic graph to a waiting state.
[0181] Each task in the task set is represented by a node in a directed acyclic graph; the directed edges in the directed acyclic graph that connect two nodes represent the execution order constraints between the two tasks corresponding to the two nodes.
[0182] Step S1105: Determine the task type for each task;
[0183] Step S1106: For each task type, determine the number of agents matching the task type based on the number of tasks belonging to that task type in the task set.
[0184] Among them, the number of agents is positively correlated with the number of tasks;
[0185] Step S1107: Deploy a set of agents for the query content according to the number of agents matched for each task type.
[0186] Step S1108: For each task, if the preceding task with which the task has an execution order constraint has been completed, or if the task has no preceding task, change the node corresponding to the task in the directed acyclic graph to the ready state.
[0187] Step S1109: Determine the target task from the tasks that are in the ready state;
[0188] Optionally, each task in the ready state can be placed into a ready task queue, and then the server can retrieve the target task from each task in the ready state in a first-in-first-out order.
[0189] Optionally, the server can also determine the execution order level of each task in the directed acyclic graph based on the node positions of each task in the ready state, and then determine the priority of each task according to the execution order level, and determine the target task in order of priority from high to low.
[0190] Step S1110: Determine the agents currently in an idle state from the set of deployed agents;
[0191] Step S1111: Determine if there is a target agent among the idle agents that matches the task type of the target task; if yes, proceed to step S1112; otherwise, return to step S1110 and wait for the agent that matches the task type to be released (from occupied state to idle state).
[0192] Step S1112: Assign the target task to the target agent so that the target agent can start executing the target task;
[0193] Step S1113: Change the state of the node corresponding to the target task in the directed acyclic graph from the ready state to the running state, and change the state of the target agent from the idle state to the occupied state.
[0194] Step S1114: For any task, if the task has been completed, change the state of the node corresponding to the task in the directed acyclic graph to the completed state.
[0195] Optionally, for any task, the server can feed back the execution result of the task to the large language model after the task is completed, and update the directed acyclic graph used to represent the task set and the execution order constraints between tasks in the task set based on the task adjustment information output by the large language model according to the execution result, so as to realize the dynamic adjustment of the task set.
[0196] Optionally, if there are waiting nodes in the nodes corresponding to each task in the directed acyclic graph, the server can return to step S1108, and the waiting node will change to the ready state, and continue to allocate and execute tasks until all tasks have been completed.
[0197] Optionally, the process of assigning the next task and the execution process of the previous task can be carried out synchronously; alternatively, different tasks can be assigned to different agents to enable multiple agents to process multiple tasks in parallel.
[0198] Step S1115: If all the nodes corresponding to each task in the directed acyclic graph are in the finished state, determine that the execution of each task for the query content has ended.
[0199] Step S1116: Obtain the second prompt information used to guide the large language model to merge the execution results;
[0200] Step S1117: Determine the question information that includes the second prompt information and the execution results of each task;
[0201] Step S1118: Input the query information into the large language model to guide the large language model to output the query results by merging the execution results of each task.
[0202] The aforementioned task processing method, before processing the acquired query content, decomposes the task based on the query content, determining multiple tasks related to the query content and the execution order constraints between these tasks. This not only breaks down complex tasks into multiple individual tasks but also clarifies the execution order constraints between tasks, enabling task planning for complex tasks and providing a basis for subsequent concurrent task execution. For each task, if the prerequisite task with an execution order constraint has been completed, or if the task has no prerequisite task, it is determined to be in a ready state. Concurrent execution of the ready tasks allows for accurate identification of tasks that can be executed concurrently based on the determined execution order constraints, transforming a serial workflow into a workflow that is at least partially parallel, directly reducing unnecessary waiting time and significantly improving work efficiency. Finally, after the execution of each task related to the query content is completed, the query results are obtained by merging the execution results of each task. This enables collaborative summarization of the execution results of multiple tasks, ensuring that the query results are adapted to the query content, thereby avoiding global rework and improving overall work efficiency. In other words, the overall efficiency of the task processing process can be improved by task planning before task execution, parallel processing during task execution, and result merging after execution.
[0203] In an exemplary embodiment, taking the task processing method of this application as an example, applied to a system with multiple task agents collaborating (including multiple task agents, each task agent being responsible for content query feedback of a specific task (such as problem solving, result generation), the task processing method provided by this application will be described in detail.
[0204] With the development of artificial intelligence technology, task processing techniques based on large language models have emerged. In traditional applications, such as... Figure 12As shown, the entire task processing follows a linear cycle of "Reason - Act - Observe." LLM considers and executes only one step at a time, then considers the next step based on the result, forming a sequential execution pattern. The reasoning process is used to consider the next action, the action process is used to execute the corresponding action by calling tools, and the observation process is used to obtain the action results. For example... Figure 12 As shown, after each execution, LLM determines whether the problem has been answered or resolved. If yes, it ends; otherwise, it proceeds to the next round of reasoning. Figure 13 As shown, under the above paradigm, when a step fails, a replan is triggered, which may adjust subsequent steps. However, the execution flow is still single-threaded and does not change the serial nature, resulting in low execution efficiency. For information retrieval, multi-object comparison, data extraction and other needs involving a large number of independent tasks, the serial mode is particularly cumbersome and slow.
[0205] The task processing method provided in this application reduces the total execution time from the sum of the time spent in each step to the sum of the time spent in the "critical path" through DAG concurrent scheduling, resulting in a significant performance improvement. The system's CPU, network I / O and other resources are fully utilized during task execution, and multiple agents can work simultaneously, maximizing resource utilization. It is naturally suitable for handling complex requirements that include a large number of independently executable tasks, and the system throughput is increased by orders of magnitude.
[0206] In an optional embodiment, such as Figure 14 As shown, the overall system architecture of this application may include an input layer, a planning and parsing layer, a DAG scheduling layer, an execution layer, and a result layer.
[0207] The input layer provides a window for users to input their queries, which can then be retrieved. This query can be a question (Query). The planning and parsing layer can deploy a planning agent and a DAG builder, taking the query as input and outputting a structured DAG graph. Specifically, the planning agent can invoke an LLM (Limited Learning Model) to decompose tasks. Through carefully designed initial prompts, it guides the LLM to break down the query into multiple tasks and determine the dependencies between them (i.e., execution order constraints). Figure 8 As shown, the output of the planning agent can be structured information, so that the DAG builder can parse this structured information and construct a complete DAG graph for the query content based on the "after list" field.
[0208] The DAG scheduling engine is the central hub of the system, responsible for traversing the DAG, managing task states, and deciding which tasks to schedule next. Task states are maintained by managing the states of the nodes corresponding to the tasks in the DAG, which can include "PENDING", "READY", "RUNNING", "SUCCESS", and "FAILED".
[0209] Optionally, the scheduling loop process may include the following steps:
[0210] Step 1: Find all nodes with a status of READY (i.e., all preceding tasks in after_list have a status of SUCCESS).
[0211] Step 2: Add the tasks corresponding to these nodes to the ready task queue.
[0212] Step 3: Check available Agent resources and the ready queue, distribute the tasks in the queue to idle Agents for execution, and set their status to RUNNING.
[0213] Step 4: Receive the Agent's execution completion callback, update the node status to SUCCESS or FAILED, and store its output in the context.
[0214] Repeat step one until all tasks corresponding to all nodes have been completed or a fatal error has been encountered.
[0215] Optionally, the Agent Worker Pool may include a set of pre-initialized Agent instances, waiting for the scheduler to assign tasks. It is typically managed by a thread pool or process pool, supporting parallel execution.
[0216] Optionally, the agent execution unit pool can receive task instructions (including the type of agent to be invoked and parameters) from the scheduler, execute the assigned task by invoking the corresponding type of agent, and return the results and status to the scheduler.
[0217] Optionally, the Summary & Merge Agent is activated when the scheduler is about to execute a summary node (such as summarize). The input to the agent is the output of all preceding nodes. Specifically, by calling LLM, the agent summarizes, integrates and refines the input under the guidance of the second prompt information to output the complete and coherent query results delivered to the user.
[0218] In an optional embodiment, such as Figure 15 As shown, the complete workflow of the system from task input to final completion includes:
[0219] 1. Task Submission: Users submit query content to the system, and the system determines the initial complex task corresponding to the query content.
[0220] 2. Generate a global plan: The Agent receives tasks, understands user intent, and generates a structured global execution plan. This plan is a sequence of steps and includes declarations of dependencies between steps (such as the after_list field).
[0221] 3. Constructing a Directed Acyclic Graph: The DAG builder parses the plan output by the planning agent and constructs a directed acyclic graph (DAG) data structure based on the explicit dependencies (such as after_list). Nodes in the graph represent tasks, and edges represent execution order constraints.
[0222] 4. Initialization state: The system initializes the state of each task node in the DAG to PENDING (waiting), waiting for its prerequisites to be satisfied.
[0223] 5. Scheduling loop begins: The DAG scheduling engine starts working, iterating through the DAG to find executable tasks.
[0224] 6. Check ready nodes: The scheduler checks all nodes in the DAG that are in the PENDING state and determines whether all their predecessor dependent nodes have been executed successfully.
[0225] 7. Marking and Enqueuing: For nodes that have met all the prerequisites, the scheduler updates their status to READY and puts their corresponding tasks into the ready task queue to wait for execution.
[0226] 8. Check if the ready queue is empty: The scheduler checks if the ready task queue is empty. If the queue is empty, proceed to the next step (step 9); if the queue is not empty, proceed to step 10.
[0227] 9. Determine if all tasks have been completed: The scheduler determines if all tasks corresponding to all nodes have been completed (whether successfully or not); if all are completed, the entire task ends successfully; if not all are completed, it means that there are still tasks running or waiting for dependencies to be met, and the scheduler returns to step 6 to continue waiting and checking.
[0228] 10. Check available resources: If there are tasks in the ready queue, the scheduler checks if there are any idle Agent execution units in the current system to execute the tasks; if there are no idle Agents, return to step 9 to wait; if there are idle Agents, continue to the next step.
[0229] 11. Task Assignment: The scheduler takes a task from the head of the ready task queue.
[0230] 12. Execute the task: The scheduler assigns the task to an idle Agent execution unit.
[0231] 13. Update task status: The status of this task node is immediately updated to RUNNING.
[0232] 14. Concurrent execution of tasks by agents: Agents assigned tasks begin to execute their specific tasks independently (such as calling a search engine, executing code, etc.); multiple agents in the RUNNING state work in parallel, which is the key to improving efficiency in this solution.
[0233] 15. Task completed: The Agent completes its work and returns the execution result and status (success / failure).
[0234] 16. Update Results and Status: The scheduler receives the callback from the Agent, updates the status of the task node to SUCCESS or FAILED, and saves the execution result to the shared context for use by subsequent nodes.
[0235] 17. Continue the loop: After completion, the process jumps back to step 6, and the scheduler continues to check if any new nodes have become ready due to the completion of this step.
[0236] The above loop continues until all nodes have completed their execution.
[0237] The above task processing method, by introducing DAG for concurrent scheduling of multiple agents, can produce at least the following beneficial effects:
[0238] Firstly, it improves execution efficiency: by executing independent tasks concurrently, the overall system execution time is shortened from the "cumulative time of each step" in the serial mode to the "time of the critical path of the DAG". For parallelizable tasks, the efficiency is improved by several times or even tens of times, resulting in a qualitative leap in user experience.
[0239] Secondly, it maximizes resource utilization: the system can continuously keep multiple agent instances busy, fully explore and utilize the potential of computing resources such as multi-core CPUs and network I / O, and achieve a higher cost-effectiveness of resource utilization.
[0240] Third, it clearly models the dependencies of complex tasks; by using the after_list field and DAG data structure, the dependencies within complex tasks become explicit and visible, which not only facilitates the correct scheduling of the system, but also greatly facilitates developers in understanding and debugging the task process.
[0241] Fourth, the system throughput is greatly enhanced: In high-concurrency request scenarios, the system can efficiently manage and cross-schedule the DAG of multiple tasks, significantly increasing the number of tasks processed per unit time and providing stronger scalable service capabilities.
[0242] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0243] Based on the same inventive concept, this application also provides a task processing apparatus for implementing the task processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more task processing apparatus embodiments provided below can be found in the limitations of the task processing method described above, and will not be repeated here.
[0244] In some embodiments, such as Figure 16 As shown, a task processing apparatus is provided, comprising:
[0245] Module 1601 is used to retrieve query content;
[0246] The task planning module 1602 is used to decompose tasks based on query content, determine multiple tasks for the query content, and the execution order constraints between the tasks.
[0247] The ready task detection module 1603 is used to determine that a task is in a ready state for each task if the preceding task with which the task has an execution order constraint has been completed, or if the task has no preceding task.
[0248] Task execution module 1604 is used to concurrently execute at least two tasks that are in the ready state;
[0249] The result merging module 1605 is used to obtain the query results of the query content by merging the execution results of each task after the execution of each task has ended.
[0250] In one embodiment, the task planning module 1602 includes: a prompt information acquisition unit, used to acquire first prompt information for guiding the large language model to perform task decomposition; and a task planning unit, used to input question information containing the first prompt information and query content into the large language model, and based on the output of the large language model, determine multiple tasks for the query content and the execution order constraints between the tasks.
[0251] In one embodiment, each task is represented by a node in a directed acyclic graph (DAG); the directed edges in the DAG connecting two nodes represent the execution order constraints between the two tasks corresponding to the two nodes. In this case, the task planning unit is specifically used to: obtain the structured information output by the large language model; the structured information contains a one-to-one correspondence of a first field and a second field; the first field is used to describe the task; the second field corresponding to the first field is empty, or the second field corresponding to the first field is used to describe the pre-tasks that have execution order constraints with the task; by parsing the structured information, determine the tasks described by the multiple first fields in the structured information, as well as the pre-tasks of each task; and construct a directed acyclic graph for the query content based on each task and the pre-tasks of each task.
[0252] In one embodiment, the task processing device further includes a state determination module, configured to: for any task, if the task has been completed, change the state of the node corresponding to the task in the directed acyclic graph to the end state; and if all nodes in the directed acyclic graph are in the end state, determine that each task has been completed.
[0253] In one embodiment, the task processing device further includes a planning and adjustment module, used to: for any task, when the task execution is completed, feed back the task execution result to the large language model; and based on the task adjustment information output by the large language model according to the execution result, update the multiple tasks for the query content and the execution order constraints between the tasks.
[0254] In one embodiment, the task execution module 1604 includes: an idle agent determination unit for determining a plurality of agents currently in an idle state; and a task allocation unit for allocating at least two tasks in a ready state to each agent, so that each agent can execute the allocated tasks in parallel.
[0255] In one embodiment, the task allocation unit is specifically used to: determine the task type of each task that is in a ready state; and allocate the task to the target agent if there is a target agent among the agents that matches the task type.
[0256] In one embodiment, the idle agent determination unit is specifically used to: determine multiple agents currently in an idle state from the set of agents deployed for the query content. In this embodiment, the task processing device further includes an agent deployment module, used to: determine the task type of each task; for each task type, determine the number of agents matching the task type based on the number of tasks belonging to the task type in the task set; the number of agents is positively correlated with the number of tasks; and deploy the set of agents for the query content according to the number of agents matching each task type.
[0257] In one embodiment, the task allocation unit is specifically used to: determine the number of tasks in the ready state and the number of agents in the idle state; when the number of tasks is greater than the number of agents, allocate at least two tasks with relatively high priority and in the ready state to each agent according to the number of agents.
[0258] In one embodiment, the task execution module 1604 further includes a priority determination unit, configured to: determine the execution order level of each task based on the directed acyclic graph for the query content; each node in the directed acyclic graph corresponds to each task; the directed edge in the directed acyclic graph connecting two nodes represents the execution order constraint between the two tasks corresponding to the two nodes; and determine the priority of each task based on its respective execution order level; wherein, the task with the higher execution order level has a higher priority than the task with the lower execution order level.
[0259] In one embodiment, the task execution module 1604 is specifically configured to: when there is an agent currently in an idle state, assign a task in a ready state to the agent; change the assigned task from a ready state to a running state, and change the agent to which the task is assigned from an idle state to an occupied state; and during the execution of the task by the agent, if there are other agents currently in an idle state and other tasks in a ready state, return to the step of assigning the task in the ready state to the agent in the idle state.
[0260] In one embodiment, the task planning module 1602 is further configured to: decompose the task into multiple subtasks during the execution of the task by the agent; and determine the execution order constraints corresponding to each subtask based on the execution order constraints corresponding to the task. In this embodiment, the task execution module 1604 is further configured to: for each subtask, if it is determined that the subtask is in a ready state based on the execution order constraints of the subtask, assign the subtask to the agent currently in an idle state.
[0261] In one embodiment, the result merging module 1605 is specifically used to: obtain second prompt information for guiding the large language model to merge execution results; determine question information containing the second prompt information and the execution results of each task; and input the question information into the large language model to guide the large language model to output the query results of the query content by merging the execution results of each task.
[0262] Each module in the aforementioned task processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.
[0263] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 17 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data involved in task processing, specifically including resource conversion request information, quota information for different objects, and the amount of resources held. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a task processing method.
[0264] In some embodiments, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 18As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a task processing method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0265] Those skilled in the art will understand that Figure 17 or Figure 18 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0266] In some embodiments, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the task processing method described above.
[0267] In some embodiments, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the task processing method described above.
[0268] In some embodiments, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the task processing method described above.
[0269] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0270] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logic devices, etc., and are not limited to these.
[0271] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0272] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A task processing method, characterized in that, The method includes: Retrieve query results; Based on the query content, the task is decomposed to determine multiple tasks for the query content and the execution order constraints between the tasks. For each of the tasks, if a prerequisite task with an execution order constraint with the task has been completed, or if the task has no prerequisite task, the task is determined to be in a ready state. Execute at least two tasks that are in a ready state concurrently; Upon completion of each task, the query results for the query content are obtained by merging the execution results of each task.
2. The method according to claim 1, characterized in that, The step of decomposing tasks based on the query content to determine multiple tasks related to the query content and the execution order constraints between the tasks includes: Obtain the initial prompt information used to guide the large language model in task decomposition; The query information, which includes the first prompt information and the query content, is input into the large language model. Based on the output of the large language model, multiple tasks for the query content and the execution order constraints between the tasks are determined.
3. The method according to claim 2, characterized in that, Each task is represented by a node in a directed acyclic graph; the directed edges in the directed acyclic graph that connect two nodes represent the execution order constraints between the two tasks corresponding to the two nodes. The process of determining multiple tasks for the query content based on the output of the large language model, and the execution order constraints between the tasks, includes: Obtain the structured information output by the large language model; the structured information includes a one-to-one corresponding first field and a second field; the first field is used to describe the task; the second field corresponding to the first field is empty, or the second field corresponding to the first field is used to describe the preceding task that has an execution order constraint with the task. By parsing the structured information, the tasks described by the multiple first fields in the structured information, as well as the prerequisite tasks for each task, are determined. Based on each of the tasks and the preceding tasks of each of the tasks, a directed acyclic graph is constructed for the query content.
4. The method according to claim 3, characterized in that, The method further includes: For any of the tasks, if the task execution is completed, the state of the node corresponding to the task in the directed acyclic graph is changed to the completed state. When all nodes in the directed acyclic graph are in an ended state, it is determined that the execution of each task has ended.
5. The method according to claim 2, characterized in that, The method further includes: For any of the tasks, upon completion of the task, the execution result of the task is fed back to the large language model; Based on the task adjustment information output by the large language model according to the execution result, the multiple tasks for the query content and the execution order constraints between the tasks are updated.
6. The method according to claim 1, characterized in that, The concurrent execution of at least two tasks in the ready state includes: Identify the multiple agents that are currently in an idle state; At least two tasks that are in a ready state are assigned to each of the agents, so that each of the agents can execute the assigned tasks in parallel.
7. The method according to claim 6, characterized in that, Assigning at least two tasks in the ready state to each of the agents includes: For each of the tasks that will be in the ready state, determine the task type of the task; If there is a target agent among the agents that matches the task type, the task is assigned to the target agent.
8. The method according to claim 6, characterized in that, The determination of the multiple agents currently in an idle state includes: From the set of agents deployed in response to the query, identify multiple agents that are currently in an idle state; The method further includes: Determine the task type for each of the aforementioned tasks; For each task type, the number of agents matching the task type is determined based on the number of tasks belonging to that task type in each task; the number of agents is positively correlated with the number of tasks. Deploy a set of agents for the query content according to the number of agents matched for each of the aforementioned task types.
9. The method according to claim 6, characterized in that, Assigning at least two tasks in the ready state to each of the agents includes: Determine the number of tasks in the ready state and the number of agents in the idle state; If the number of tasks is greater than the number of agents, at least two tasks with relatively high priority and in a ready state are assigned to each agent according to the number of agents.
10. The method according to claim 9, characterized in that, The method further includes: Based on the directed acyclic graph for the query content, the execution order level of each task is determined; each node in the directed acyclic graph corresponds to each task; the directed edge in the directed acyclic graph connecting two nodes is used to represent the execution order constraint between the two tasks corresponding to the two nodes. Based on the execution order hierarchy of each task, the priority of each task is determined; wherein, the task with the higher execution order hierarchy has a higher priority than the task with the lower execution order hierarchy.
11. The method according to claim 1, characterized in that, The concurrent execution of at least two tasks in the ready state includes: If there is an agent that is currently idle, assign the ready task to that agent; The assigned task is changed from a ready state to a running state, and the agent to which the task is assigned is changed from an idle state to an occupied state. If, during the execution of the task by the agent, there are other agents currently in an idle state and other tasks in a ready state, the process returns to the step of assigning the ready tasks to the agents in the idle state.
12. The method according to claim 11, characterized in that, The method further includes: During the execution of the task by the intelligent agent, the task is decomposed into multiple sub-tasks; Based on the execution order constraints corresponding to the tasks, determine the execution order constraints corresponding to each of the subtasks. For each of the subtasks, if the subtask is determined to be in a ready state based on the execution order constraints of the subtask, the subtask is assigned to the agent that is currently in an idle state.
13. The method according to any one of claims 1 to 12, characterized in that, The process of obtaining the query results for the query content by merging the execution results of each task includes: Obtain the second prompt information used to guide the large language model in merging the execution results; Determine the query information that includes the second prompt information and the execution results of each of the tasks; The query information is input into the large language model to guide the large language model to output the query result by merging the execution results of each task.
14. A task processing device, characterized in that, The device includes: The retrieval module is used to retrieve query content; The task planning module is used to decompose tasks based on the query content, determine multiple tasks for the query content, and the execution order constraints between the tasks. The ready task detection module is used to determine that a task is in a ready state for each task if a prerequisite task with an execution order constraint with the task has been completed, or if the task has no prerequisite task. The task execution module is used to concurrently execute at least two tasks that are in the ready state; The result merging module is used to obtain the query result of the query content by merging the execution results of each of the tasks after the execution of each task has ended.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.