Parallel task execution method and device oriented to agent system and electronic equipment
By constructing a directed acyclic graph structure, identifying and scheduling parallel task nodes, the problem of insufficient task dependency identification in intelligent agent systems is solved, achieving efficient concurrent execution and real-time monitoring, and improving task execution efficiency and system stability.
Patent Information
- Application Number
- CN202511064805.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2025-11-25
AI Technical Summary
Existing intelligent agent systems lack the ability to identify and model potential dependencies between task steps during task execution, resulting in low execution efficiency and a lack of fault tolerance, making it impossible to achieve parallel execution and real-time monitoring.
By acquiring a structured plan, identifying dependencies, generating a dependency table, mapping task steps to nodes to form a directed graph, performing loop detection and verification, constructing a valid directed acyclic structure, sorting nodes based on a preset scheduling strategy, realizing parallel task execution, and performing fault tolerance processing in case of failure.
It achieves a complete closed loop from natural language input to structured scheduling, supports efficient concurrent execution and real-time monitoring, and improves task execution efficiency and system resilience.
Smart Images

Figure CN121008887A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence, and in particular to a method, apparatus and electronic device for parallel task execution for intelligent agent systems. Background Technology
[0002] Current intelligent agent systems generally rely on large models to transform user input into a linear list of task steps, and then complete the task step by step based on this list.
[0003] However, this sequential planning has several limitations. First, all task steps are considered to be strictly sequential, and the system cannot recognize possible parallel relationships, resulting in a large number of concurrently executable operations being artificially chained together, significantly reducing overall execution efficiency. Second, linear structures lack the ability to explicitly model task dependencies and cannot perform pre- and post-condition checks on the state of steps during execution. This often leads to a lack of effective rollback mechanisms or alternative paths when intermediate steps fail, affecting the robustness and fault tolerance of the task. Summary of the Invention
[0004] This disclosure provides a method, apparatus, and device for parallel task execution in intelligent agent systems, which solves the technical problem of unstable task execution.
[0005] According to a first aspect of this disclosure, a method for parallel task execution in intelligent agent systems is provided. The method includes: obtaining a structured plan containing multiple task steps; identifying dependencies in the structured plan using language model reasoning, resource mapping analysis, and rule and keyword matching to generate a dependency table; mapping task steps to nodes, connecting nodes according to the dependency table to form a directed graph, performing loop detection and verification on the directed graph to obtain a valid directed acyclic structure; constructing a candidate node set based on the nodes of the valid directed acyclic structure, and sorting the nodes in the candidate node set according to a preset scheduling strategy to obtain a set of candidate nodes to be executed, and constructing execution context information for the nodes to be executed; receiving and parsing a pending scheduling request to obtain the execution context information, and starting the corresponding node to be executed according to the execution context information; if execution is successful, updating the valid directed acyclic structure based on the success result; if execution fails, performing fault-tolerant processing on the execution node process.
[0006] One possible approach to obtaining a structured plan includes: receiving natural language instructions; invoking a pre-defined large language model, and combining it with a structured prompt template to guide the large language model to perform multi-step decomposition and analysis of the natural language instructions, thereby generating a structured task plan containing multiple task steps.
[0007] One possible approach is to map task steps to nodes and connect the nodes to form a directed graph based on a dependency table. This includes: mapping each task step to a node to be processed in the task graph, where the nodes to be processed include a source node and an execution node; connecting the starting point of each dependency edge to the source node of the corresponding node to be processed; and connecting the ending point of each dependency edge to the execution node of the corresponding node to be processed, thus forming a directed connection relationship to obtain a directed graph.
[0008] One possible approach is to perform cycle detection and verification on a directed graph to obtain a valid directed acyclic structure. This includes: applying a topological sorting algorithm to traverse the nodes to be processed and dependent edges in the directed graph; if a directed cycle is detected in the directed graph, then disconnecting one or more dependent edges forming the cycle based on preset rules to eliminate the cycle; if the directed cycle cannot be automatically repaired, then the graph structure of the directed graph is determined to be invalid, and an error message is generated; if the directed cycle is automatically repaired, then the graph structure of the directed graph is determined to be valid, thus constructing a valid directed acyclic structure.
[0009] One possible approach is to sort the nodes in the candidate node set based on a preset scheduling strategy to obtain a set of candidate nodes to be executed. This includes: estimating the execution time of each node based on historical execution data or a preset model, and scoring the nodes according to their execution time; or, statistically analyzing the resource requirements of each node based on the current available system resources, and scoring each node according to the matching degree between its resource requirements and the currently available resources; and sorting all nodes in descending order of their scores to obtain a set of candidate nodes to be executed.
[0010] As one possible approach, updating the legal directed acyclic structure based on the successful execution result includes: if the node to be executed executes successfully, retrieving all successor nodes of the node to be executed and updating the in-degree count of the successor nodes; if the updated in-degree count of the successor node is zero, adding the successor node with an in-degree count of zero to the set of schedulable candidate nodes to update the legal directed acyclic structure.
[0011] As one possible approach, a fault-tolerance strategy is implemented for the execution node process, including: checking the retry configuration of the currently pending node; if the retry count of the currently pending node has not reached the upper limit and the failure reason is determined to be intermittent, then the current execution context is reloaded, the execution flow of the currently pending node is triggered again, and the retry count is updated. If the currently pending node executes successfully after retrying, the valid directed acyclic structure is updated based on the successful execution result; if execution fails, a degradation strategy is executed; the degradation strategy includes one or more of the following: calling simplified logic, using cached historical data to replace real-time calculation, and reducing the output precision requirement; if the currently pending node executes successfully after executing the degradation strategy, the valid directed acyclic structure is updated based on the successful execution result; if execution fails, it is checked whether there is a backup node in the valid directed acyclic structure; if a backup node exists, the backup node is executed, and the valid directed acyclic structure is updated based on the successful execution result; if execution fails or no backup node exists, the task is aborted and marked as failed.
[0012] As one possible approach, the steps for suspending a task and marking it as failed include: marking the status of the failed node and recording the reason for the failure, the attempted handling measures, and the error stack information; identifying all downstream nodes that depend on the failed node based on the dependency relationship of a valid directed acyclic structure; suspending the scheduling of the downstream node if there are no other alternative dependency paths; and switching to the backup dependency branch node if there is a backup dependency branch node, and notifying the scheduling module to prioritize the scheduling of the backup dependency branch node.
[0013] According to a second aspect of this disclosure, a parallel task execution device for intelligent agent systems is provided. The device includes: an acquisition module for acquiring a structured plan containing multiple task steps; identifying dependencies in the structured plan using language model reasoning, resource mapping analysis, and rule and keyword matching to generate a dependency table; a directed acyclic structure construction module for mapping task steps to nodes, connecting nodes according to the dependency table to form a directed graph, performing loop detection and verification on the directed graph to obtain a valid directed acyclic structure; a node selection module for constructing a candidate node set based on the nodes of the valid directed acyclic structure, sorting the nodes in the candidate node set according to a preset scheduling strategy to obtain a set of candidate nodes to be executed, and constructing execution context information for the nodes to be executed; and a task execution module for receiving and parsing pending scheduling requests to obtain the execution context information, and starting the corresponding node to be executed according to the execution context information; if execution is successful, updating the valid directed acyclic structure based on the success result; if execution fails, performing fault-tolerant processing on the execution node process.
[0014] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the program to implement the method described above.
[0015] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the methods according to the first and / or second aspects of this disclosure.
[0016] The beneficial effects of this application are as follows: It obtains a structured plan, identifies the dependencies of the structured plan, and generates a dependency table; it maps task steps to nodes, connects nodes according to the dependency table to form a directed graph, performs loop detection and verification on the directed graph, and obtains a valid directed acyclic structure; it enables the automatic generation of a task graph structure that conforms to semantic logic and has concurrent scheduling and execution status monitoring capabilities, starting from natural language input, thus improving task execution efficiency and system resilience; it then constructs a candidate node set based on the nodes of the valid directed acyclic structure, and selects the nodes to be executed from the candidate node set based on a preset scheduling strategy, constructing execution context information for the nodes to be executed; it receives and parses pending scheduling requests to obtain execution context information, and starts the corresponding nodes to be executed according to the execution context information; if execution is successful, it updates the valid directed acyclic structure based on the success result; if execution fails, it performs fault-tolerant processing on the execution node process, thereby constructing a complete closed loop from natural language task to structured scheduling, supporting efficient concurrent execution, and realizing real-time monitoring and dynamic feedback of the execution process.
[0017] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. The drawings are provided for a better understanding of the invention and are not intended to limit the scope of this disclosure. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0019] Figure 1 A flowchart of a parallel task execution method for an intelligent agent system according to an embodiment of the present disclosure is shown;
[0020] Figure 2 A block diagram of a parallel task execution apparatus for an intelligent agent system according to an embodiment of the present disclosure is shown;
[0021] Figure 3 A block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure is shown. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0023] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0024] In recent years, large language models have driven the rapid development of natural language-driven intelligent agent systems in areas such as dialogue interaction, task understanding, and operational control. A typical intelligent agent workflow involves: a user inputting a request via natural language; the large model identifies the user's intent and decomposes the task into several operational steps; and then these steps are executed step-by-step by system modules. However, the planning structure of this workflow is usually linear and lacks inherent structural information, resulting in the following shortcomings:
[0025] First, most intelligent agent systems only output task plans in list form and process them strictly in sequence, lacking the ability to identify and model potential dependencies between task steps. This design is insufficient in terms of execution efficiency and system resilience. For example, tasks such as "acquiring data," "cleaning data," "generating charts," and "writing reports" are often executed sequentially, but some of these tasks can be executed in parallel or conditionally.
[0026] Secondly, although some studies have attempted to enable large models to directly generate structured tasks (such as flowcharts and hierarchical trees) through prompt engineering, the stability of this approach depends on the example settings and is difficult to adapt to large-scale, diverse task scenarios. Some attempts to infer order using conjunctions in natural language (such as "then," "next," and "afterward") have also been limited in effectiveness due to semantic ambiguity.
[0027] Some scheduling platforms (such as Apache Airflow and Perfect) support task execution based on DAG (Directed Acyclic Graph), but they are typically geared towards structured data workflows, requiring developers to manually specify dependencies between tasks, and lack the ability to automatically construct dependency graphs from natural language. While these platforms perform well in terms of execution efficiency, their initial configuration and graph generation processes are not suitable for general-purpose intelligent agent systems driven by natural language.
[0028] Other studies explore using semantic matching and vector similarity to determine the relevance between tasks, or combine rule engines to create process templates for tasks. However, these solutions lack universality and automation in graph structure generation and cannot dynamically adapt to open scenarios with changing user intentions and strong input uncertainty.
[0029] At the execution level, traditional serial execution frameworks typically handle tasks in a step-by-step, blocking manner, with the system only proceeding to the next step after each task is completed. This lacks a graph-based concurrency control strategy. Furthermore, current intelligent agent systems have relatively weak mechanisms for observing the state and handling anomalies during task execution. Most systems lack node-level state monitoring and progress feedback mechanisms, resulting in opaque task execution processes and difficulty in locating faults.
[0030] In summary, existing technologies cannot automatically generate a task graph structure that conforms to semantic logic and possesses concurrent scheduling and execution status monitoring capabilities, starting from natural language input. Nor can they construct a complete closed loop from natural language tasks to structured scheduling. Therefore, the parallel task execution method, apparatus, and electronic device for intelligent agent systems proposed in this application can automatically identify dependencies between tasks, construct a graph structure, support efficient concurrent execution, and achieve real-time monitoring and dynamic feedback of the execution process, thereby meeting the technical needs of future intelligent agent systems in handling complex tasks.
[0031] The parallel task execution method for intelligent agent systems proposed in this application will be described in detail below.
[0032] Figure 1 A flowchart of a parallel task execution method 100 for an intelligent agent system according to an embodiment of the present disclosure is shown.
[0033] Step S110: Obtain the structured plan, which contains multiple task steps; identify the dependencies of the structured plan using language model reasoning, resource mapping analysis, and rule and keyword matching, and generate a dependency table.
[0034] In some embodiments, obtaining a structured plan includes: receiving natural language instructions; invoking a preset large language model, and combining it with a structured prompt template to guide the large language model to perform multi-step decomposition and analysis of the natural language instructions, thereby generating a structured task plan containing multiple task steps.
[0035] As an example, each task step is structured as a data entity containing the following key fields: Operation Name: Identifies the core action or behavioral intent of this step. Goal Description: Describes the specific goal of this step. Input Items: Input data or resource identifiers required for the execution of this step. Output Items: Output data or resource identifiers generated after the execution of this step. Tools / Interfaces: Tools, service interfaces, or functional modules that this step may call (or depend on). Task Intent Label: Optional, used to label the high-level intent or category to which this step belongs. Granularity Label: Optional, used to indicate the hierarchy of this step in the task structure. The structured task plan is output in a standardized data format (such as a JSON object), providing a foundation for subsequent processing. By setting field length constraints and structured expression, the generated model content is compressed, retaining only key logical information, significantly reducing computational cost and latency while maintaining the effectiveness of inference.
[0036] When identifying dependencies in a structured task plan, language model inference, resource mapping analysis, and rule-keyword matching are used. The dependency table is generated by integrating at least two of these algorithms to identify dependencies between task steps, resulting in a table containing dependency edges. Each dependency edge records the identifiers of the source step (prerequisite task) and the target step (dependent task). Wherein:
[0037] Language Model Inference Method: This method uses a large language model to analyze each task step, determining if it has a prerequisite task step (a necessary condition) and outputting the corresponding prerequisite step identifier or label. Resource Mapping Analysis Method: This method extracts the input and output items of each task step and constructs a resource reference mapping table. If an input item of the current task step is identified as an output item of the previous task step, a dependency relationship exists between the two task steps, pointing from the previous task to the next. Rule and Keyword Matching Method: Using a pre-defined dependency rule base (containing common operation sequence patterns, tool combination rules, and keyword triggering rules) and semantic vector calculation methods, this method compares and analyzes the content of the task steps, identifying and supplementing dependencies that may have been missed by the aforementioned methods. This accurately identifies the dependencies between task steps, facilitating the parallel execution of subsequent corresponding task nodes.
[0038] Step S120: Map the task steps to nodes, connect the nodes according to the dependency table to form a directed graph, perform loop detection and verification on the directed graph to obtain a valid directed acyclic structure.
[0039] In some embodiments, task steps are mapped to nodes, and nodes are connected according to a dependency table to form a directed graph, including: mapping each task step to a node to be processed in the task graph, the node to be processed including a source node and a node to be executed; connecting the starting point of each dependency edge to the source node of the corresponding node to be processed, and connecting the ending point of each dependency edge to the node to be executed of the corresponding node to be processed, to form a directed connection relationship to obtain a directed graph.
[0040] In some embodiments, loop detection and verification are performed on a directed graph to obtain a valid directed acyclic structure, including: applying a topological sorting algorithm to traverse the nodes to be processed and dependent edges in the directed graph; if a directed cycle is detected in the directed graph, one or more dependent edges constituting the cycle are disconnected based on preset rules to eliminate the cycle; if the directed cycle cannot be automatically repaired, the graph structure of the directed graph is determined to be illegal, and an error message is generated; if the directed cycle is automatically repaired, the graph structure of the directed graph is determined to be valid, thus constructing a valid directed acyclic structure. The final valid directed acyclic graph structure is then constructed. Each node is associated with metadata (such as identifier, execution label, and state information), and the graph records the topological information of the nodes (including in-degree, out-degree, and stage label), providing complete dependency topology data for subsequent scheduling.
[0041] As the foundation of task scheduling, it records the topological information of nodes (such as in-degree, out-degree, and stage labels), supporting concurrent scheduling systems to schedule nodes with an in-degree of zero in parallel, thus shortening the total task duration. Simultaneously, as a unified representation of task progress and dependencies, it tracks the status of each node in real time through a graph structure monitoring mechanism during task execution, forming a global execution status view. When a node fails, it can automatically determine the affected subsequent nodes based on the directed acyclic graph structure and issue abort or replacement signals, improving system robustness and self-healing capabilities. It also provides semantic support for task failure retries and alternative path planning.
[0042] Therefore, by converting a linear task plan into a directed acyclic graph structure, nodes with "no prerequisite dependencies" (i.e., nodes with an in-degree of zero) are identified through the dependencies between nodes. These nodes do not depend on each other and can be scheduled for execution simultaneously. For example, if there are nodes A, B, and C in the task graph, where A has no prerequisite dependencies, and B and C both depend on A, then after A completes its execution, B and C can start in parallel without waiting for the other to finish.
[0043] Step S130: Construct a candidate node set based on nodes with a valid directed acyclic structure, and sort the nodes in the candidate node set according to a preset scheduling strategy to obtain a set of candidate nodes to be executed, and construct execution context information for the nodes to be executed.
[0044] As an example, the execution context information for the node to be executed includes at least: a unique node identifier, a scheduling round identifier, the source path of the required input data, the registration path of the target output, a preset exception handling strategy, and the address of the status callback interface.
[0045] In some embodiments, the nodes in the candidate node set are sorted according to a preset scheduling strategy to obtain a set of candidate nodes to be executed, including: estimating the execution time of each node based on historical execution data or a preset model, and scoring the nodes according to the execution time of each node; or, statistically analyzing the resource requirements of each node according to the current available system resource status, and scoring each node according to the matching degree between the node's resource requirements and the current available resources; and sorting all nodes in descending order of scores to obtain a set of candidate nodes to be executed.
[0046] Specifically, the time-consuming prediction prioritizes scheduling nodes with longer estimated execution times (based on historical data or preset models) to alleviate their role as bottlenecks in the overall graph execution. Resource constraints match the resource requirements of candidate nodes based on the current available system resources (including CPU, memory, API rate limits, etc.) to prevent excessive concentration of high-resource-consuming nodes in the short term, which could lead to resource congestion.
[0047] As an example, for each node in the set of schedulable candidate nodes (nodes with an in-degree of zero and not scheduled), a quantitative evaluation is first performed based on two factors to generate a corresponding score:
[0048] Time Elapsed Prediction Factor Score: Based on historical execution data or a preset model, the execution time of each node is estimated (e.g., node A is estimated to take 10 minutes, node B is estimated to take 5 minutes). The longer the execution time of a node, the higher the score of this factor (e.g., sorted by "time elapsed from longest to shortest", the longest gets 10 points, the second longest gets 8 points, and so on).
[0049] Resource constraint factor score: This score calculates the resource requirements of each node (e.g., CPU utilization, memory requirements, API call frequency limits, etc.) while simultaneously collecting the current system's available resource status (e.g., remaining CPU, memory, API quota). A higher score is awarded if a node's resource requirements closely match the available resources (i.e., it won't exceed resource limits and has minimal conflict with the resource requirements of other candidate nodes). For example, if node C requires 20% CPU, the current system has 30% remaining CPU, and other candidate nodes have lower resource requirements, then node C will have a high resource constraint factor score. Conversely, if node D requires 50% CPU, but only 30% of the CPU remains, its resource constraint factor score will be low.
[0050] Secondly, by combining the scores of the two factors, a priority ranking of nodes is generated. The scores of the two factors are merged using a preset weighting rule to obtain a comprehensive priority score for each node, which is then sorted from highest to lowest score. The basic weighting logic is as follows: Weights are assigned to the two factors (e.g., time-consuming prediction factor accounts for 60%, resource constraint factor accounts for 40%), and a comprehensive score is calculated (Comprehensive Score = Time-consuming Score × 0.6 + Resource Score × 0.4). If the system currently has sufficient resources (e.g., CPU and memory utilization are below 50%), the weight of the "time-consuming prediction factor" can be increased (e.g., 70%) to prioritize efficiency; if the system resources are strained (e.g., resource utilization exceeds 80%), the weight of the resource constraint factor is increased (e.g., 70%) to prioritize avoiding resource congestion.
[0051] Finally, the target node is selected for execution based on priority. According to the overall priority ranking, the node with the highest score is selected from the candidate node set as the target node, triggering execution. Each scheduling may select one or more nodes (depending on the allowed concurrency), but it must be ensured that the resource requirements of the selected nodes do not conflict. For example, if among the candidate nodes, node A (taking 10 minutes, high resource matching) has the highest overall score, and node B (taking 8 minutes, medium resource matching) is next, then node A will be scheduled first; if resources allow (e.g., remaining resources can support both A and B simultaneously), then both A and B will be scheduled simultaneously.
[0052] In this way, after sorting the nodes in the candidate node set according to a preset strategy (such as prioritizing the scheduling of nodes with longer execution times and balancing resource usage), execution requests can be sent to multiple nodes simultaneously. Resources can be allocated to these multiple nodes at the same time and execution can be started, rather than being processed one by one in sequence, thereby improving task execution efficiency.
[0053] Step S140: Receive and parse the pending scheduling request to obtain the execution context information, and start the corresponding pending node according to the execution context information; if the execution is successful, update the legal directed acyclic structure according to the successful execution result; if the execution fails, perform fault tolerance strategy processing on the execution node process.
[0054] In some embodiments, updating the legal directed acyclic structure based on the successful execution result includes: if the node to be executed is executed successfully, retrieving all successor nodes of the node to be executed and updating the in-degree count of the successor nodes; if the updated in-degree count of the successor node is zero, adding the successor node with an in-degree count of zero to the set of schedulable candidate nodes to update the legal directed acyclic structure.
[0055] As an example, a scheduling request containing execution context information is sent to trigger the actual execution of the target node. When the node executes successfully, all its successor nodes are retrieved, and their in-degree counts are updated (decreasing). If the updated in-degree count of a successor node is zero, it is dynamically added to the set of schedulable candidate nodes. This continuously updates the set of schedulable candidate nodes during execution, containing only nodes with a current in-degree of zero that have not yet been scheduled. Whenever a node executes successfully, the in-degree of all its successor nodes is immediately decremented; if the in-degree of a successor node becomes zero, it is dynamically added to the candidate set. This mechanism ensures that all nodes meeting the parallelism conditions are identified and scheduled in a timely manner, avoiding serial waiting.
[0056] In some embodiments, a fault-tolerance strategy is implemented for the execution node process, including: checking the retry configuration of the currently pending node; if the retry count of the currently pending node has not reached the upper limit and the failure reason is determined to be intermittent, then the current execution context is reloaded, the execution flow of the currently pending node is triggered again, and the retry count is updated. If the currently pending node executes successfully after retrying, the valid directed acyclic structure is updated according to the successful execution result; if the execution fails, a degradation strategy is executed; the degradation strategy includes one or more of the following: calling simplified logic, using cached historical data to replace real-time calculation, and reducing the output precision requirement; if the currently pending node executes successfully after executing the degradation strategy, the valid directed acyclic structure is updated according to the successful execution result; if the execution fails, it is queried whether there is a backup node in the valid directed acyclic structure; if a backup node exists, the backup node is executed, and the valid directed acyclic structure is updated according to the successful execution result; if the execution fails or there is no backup node, the task is aborted and marked as failed.
[0057] In some embodiments, the steps of terminating the task and marking the failure include: marking the status of the node that failed to execute, and recording the reason for the failure, the processing measures attempted, and the error stack information; identifying all downstream nodes that depend on the failed node based on the dependency relationship of a valid directed acyclic structure; terminating the scheduling of the downstream node if there are no other alternative dependency paths; and switching to the backup dependency branch node if there is a backup dependency branch node, and notifying the scheduling module to prioritize the scheduling of the backup dependency branch node.
[0058] As an example, during the task execution phase, a task scheduling request is received, which involves obtaining the execution context of the task node (including node ID, input / output paths, resource limits, fault tolerance strategies, etc.) and activating monitoring probes to collect data in real time: execution time (timeout detection), resource usage (CPU, memory, I / O), and external dependency status (API calls, data access). If a timeout, resource limit exceedance, or dependency failure occurs, the task is immediately interrupted and enters the error handling process, i.e., the fault tolerance strategy handling process. If the task succeeds, the in-degree of successor nodes in the directed acyclic graph structure is updated, and nodes with an in-degree of 0 are added to the schedulable candidate set. If the task fails, the affected downstream nodes are identified based on the dependency table, and preset strategies (such as aborting dependency paths or triggering backup branches) are executed.
[0059] During the aforementioned execution process, each node collects its status (such as resource usage and execution time) in real time through an independent monitoring probe, and the monitoring between nodes does not interfere with each other. Even when multiple nodes execute in parallel, their respective statuses can be tracked simultaneously, ensuring the independence of anomaly detection and result capture, further supporting the stable operation of the parallel mechanism. Therefore, this application achieves efficient parallel processing of multiple task nodes by resolving dependencies using a directed acyclic graph structure, dynamically identifying parallelizable nodes, concurrent scheduling execution, and independent monitoring, significantly shortening the overall task execution time.
[0060] According to the embodiments of this application, the following technical effects are achieved: A structured plan is obtained, the dependencies of the structured plan are identified, and a dependency table is generated; task steps are mapped to nodes, nodes are connected according to the dependency table to form a directed graph, and loop detection and verification are performed on the directed graph to obtain a valid directed acyclic structure; a task graph structure that conforms to semantic logic and has concurrent scheduling and execution status monitoring capabilities is automatically generated from natural language input, facilitating improved task execution efficiency and system resilience; then, a candidate node set is constructed based on the nodes of the valid directed acyclic structure, and nodes to be executed are selected from the candidate node set based on a preset scheduling strategy, and execution context information is constructed for the nodes to be executed; a scheduling request to be processed is received and parsed to obtain the execution context information, and the corresponding node to be executed is started according to the execution context information; if the execution is successful, the valid directed acyclic structure is updated according to the successful execution result; if the execution fails, a fault-tolerant strategy is applied to the execution node process, thereby constructing a complete closed loop from natural language task to structured scheduling, supporting efficient concurrent execution, and realizing real-time monitoring and dynamic feedback of the execution process.
[0061] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this disclosure.
[0062] The above is an introduction to the method embodiments. The following describes the present disclosure further through device embodiments.
[0063] The parallel task execution device for intelligent agent systems proposed in this application will be described in detail below.
[0064] Figure 2 A block diagram of a parallel task execution apparatus 200 for an intelligent agent system according to an embodiment of the present disclosure is shown. Figure 2As shown, the parallel task execution device 200 for intelligent agent systems includes: an acquisition module 210, a directed acyclic structure construction module 220, a node selection module 230, and a task execution module 240. The system comprises the following modules: **Acquisition Module:** This module acquires a structured plan containing multiple task steps. It identifies dependencies within the structured plan using language model reasoning, resource mapping analysis, and rule / keyword matching, generating a dependency table. **Directed Acyclic Structure (DAG) Construction Module:** This module maps task steps to nodes, connects nodes in the dependency table to form a directed graph, and performs loop detection and verification on the graph to obtain a valid DAG structure. **Execution Node Selection Module:** This module constructs a candidate node set based on the nodes in the valid DAG structure, sorts the nodes in the candidate set according to a preset scheduling strategy, obtains a set of candidate execution nodes, and constructs execution context information for the execution nodes. **Task Execution Module:** This module receives and parses pending scheduling requests to obtain execution context information and starts the corresponding execution node according to the execution context information. If execution is successful, the valid DAG structure is updated based on the success result; if execution fails, a fault-tolerant strategy is implemented for the execution node process. The system acquires a structured plan, identifies its dependencies, and generates a dependency table. Task steps are mapped to nodes, and nodes are connected according to the dependency table to form a directed graph. The directed graph is then checked for loops to obtain a valid directed acyclic structure (DAG). Starting from natural language input, the system automatically generates a task graph structure that conforms to semantic logic and possesses concurrent scheduling and execution status monitoring capabilities, improving task execution efficiency and system resilience. A candidate node set is then constructed based on the nodes in the valid DAG structure, and nodes to be executed are selected from this set based on a preset scheduling strategy. Execution context information is then built for each node. The system receives and parses pending scheduling requests to obtain execution context information and starts the corresponding node according to this information. If execution is successful, the valid DAG structure is updated based on the success result. If execution fails, a fault-tolerant strategy is implemented for the execution node process, thus constructing a complete closed loop from natural language task to structured scheduling, supporting efficient concurrent execution, and enabling real-time monitoring and dynamic feedback of the execution process.
[0065] In some embodiments, the acquisition module is used to receive natural language instructions; call a preset large language model, and combine it with a structured prompt template to guide the large language model to perform multi-step decomposition and analysis of the natural language instructions, and generate a structured task plan containing multiple task steps.
[0066] In some embodiments, the directed acyclic structure building module is used to map each task step to a node to be processed in the task graph, the node to be processed including a source node and an execution node; the starting point of each dependency edge is connected to the source node of the corresponding node to be processed, and the ending point of each dependency edge is connected to the execution node of the corresponding node to be processed, to form a directed connection relationship, so as to obtain a directed graph.
[0067] In some embodiments, the directed acyclic structure construction module is used to traverse the nodes to be processed and dependent edges in the directed graph using a topological sorting algorithm; if a directed cycle is detected in the directed graph, one or more dependent edges constituting the cycle are disconnected based on preset rules to eliminate the cycle; if the cycle cannot be automatically repaired, the graph structure of the directed graph is determined to be illegal, and an error message is generated; if the cycle is automatically repaired, the graph structure of the directed graph is determined to be legal, so as to construct a legal directed acyclic structure.
[0068] In some embodiments, the node selection module is used to estimate the execution time of each node based on historical execution data or a preset model, and score the nodes according to the execution time of each node; or, based on the current available system resource status, to count the resource requirements of each node, and score each node according to the matching degree between the resource requirements of the node and the current available resources; and to sort all nodes in descending order of scores to obtain a set of candidate nodes to be executed.
[0069] In some embodiments, the task execution module is used to retrieve all successor nodes of the node to be executed if the node to be executed is executed successfully, and update the in-degree count of the successor nodes; if the updated in-degree count of the successor node is zero, the successor node with an in-degree count of zero is added to the set of schedulable candidate nodes to update the legal directed acyclic structure.
[0070] In some embodiments, the task execution module includes a node update module 2401, used to check the retry configuration of the currently pending node. If the number of retries for the currently pending node has not reached the upper limit and the failure reason is determined to be intermittent, the current execution context is reloaded, the execution flow of the currently pending node is triggered again, and the retry count is updated. If the currently pending node executes successfully after retrying, the valid directed acyclic structure is updated according to the successful execution result; if the execution fails, a degradation strategy is executed; the degradation strategy includes one or more of calling simplified logic, using cached historical data to replace real-time calculation, and reducing the output precision requirement; if the currently pending node executes successfully after executing the degradation strategy, the valid directed acyclic structure is updated according to the successful execution result; if the execution fails, it queries whether there is a backup node in the valid directed acyclic structure; if there is a backup node, the backup node is executed, and the valid directed acyclic structure is updated according to the successful execution result; if the execution fails or there is no backup node, the task is aborted and marked as failed.
[0071] In some embodiments, the task execution module includes an exception handling module 2402, which is used to mark the status of the failed node and record the reason for failure, the processing measures attempted and the error stack information; based on the dependency relationship of a legal directed acyclic structure, identify all downstream nodes that depend on the failed node; if the downstream node has no other alternative dependency path, then the scheduling of the downstream node is terminated; if the downstream node has a backup dependency branch node, then switch to the backup dependency branch node and notify the scheduling module to schedule the backup dependency branch node first.
[0072] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0073] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0074] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0075] Figure 3 A schematic block diagram of an electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0076] Electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in ROM 302 or a computer program loaded into RAM 303 from storage unit 308. RAM 303 can also store various programs and data required for the operation of electronic device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via bus 304. I / O interface 305 is also connected to bus 304.
[0077] Multiple components in electronic device 300 are connected to I / O interface 305, including: input unit 306, such as keyboard, mouse, etc.; output unit 307, such as various types of displays, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows electronic device 300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0078] The computing unit 301 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as the parallel task method for intelligent agent systems. For example, in some embodiments, the parallel task method for intelligent agent systems can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the parallel task method for intelligent agent systems described above can be performed. Alternatively, in other embodiments, computing unit 301 may be configured to perform parallel task methods for intelligent agent systems by any other suitable means (e.g., by means of firmware).
[0079] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0080] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0081] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0082] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including voice input, speech input, or tactile input).
[0083] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0084] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0085] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0086] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for parallel task execution in intelligent agent systems, characterized in that, include: Obtain a structured plan, which contains multiple task steps; The dependencies of the structured plan are identified using language model reasoning, resource mapping analysis, and rule and keyword matching, and a dependency table is generated. The task steps are mapped to nodes, and the nodes are connected according to the dependency table to form a directed graph. The directed graph is then checked for loops to obtain a valid directed acyclic structure. A candidate node set is constructed based on the nodes of the legal directed acyclic structure, and the nodes in the candidate node set are sorted according to the preset scheduling strategy to obtain a set of candidate nodes to be executed, and execution context information is constructed for the nodes to be executed. Receive and parse the pending scheduling request to obtain the execution context information, and start the corresponding pending node according to the execution context information; If the execution is successful, update the legal directed acyclic structure based on the execution success result; If execution fails, a fault-tolerance strategy is applied to the execution node process.
2. The parallel task execution method for intelligent agent systems according to claim 1, characterized in that, Obtain a structured plan, including: Receive natural language commands; The system invokes a pre-defined large language model and combines it with a structured prompt template to guide the large language model to perform multi-step decomposition and analysis of the natural language instructions, generating a structured task plan containing multiple task steps.
3. The parallel task execution method for intelligent agent systems according to claim 1, characterized in that, Mapping the task steps to nodes and connecting the nodes according to the dependency table to form a directed graph includes: Each task step is mapped to a node to be processed in the task graph, and the node to be processed includes a source node and a node to be executed. Connect the starting point of each dependent edge to the source node of the corresponding node to be processed, and connect the ending point of each dependent edge to the execution node of the corresponding node to be processed, to form a directed connection relationship, so as to obtain a directed graph.
4. The parallel task execution method for intelligent agent systems according to claim 1, characterized in that, Loop detection and verification are performed on the directed graph to obtain a valid directed acyclic structure, including: The topological sorting algorithm is applied to traverse the nodes to be processed and the dependent edges in the directed graph; If a directed cycle is detected in the directed graph, one or more dependent edges constituting the cycle are disconnected based on a preset rule to eliminate the loop of the directed cycle. If the directed cycle cannot be automatically repaired, the graph structure of the directed graph is determined to be invalid, and an error message is generated; if the directed cycle is automatically repaired, the graph structure of the directed graph is determined to be valid, so as to construct the valid directed acyclic structure.
5. The parallel task execution method for intelligent agent systems according to claim 1, characterized in that, Based on the preset scheduling strategy, the nodes in the candidate node set are sorted to obtain a set of candidate nodes to be executed, including: Based on historical execution data or a pre-set model, estimate the execution time of each node, and score the nodes according to their execution time; or, Based on the current available system resources, the resource requirements of each node are calculated, and each node is scored according to the matching degree between the resource requirements of the node and the current available resources. Sort all nodes in descending order of their scores to obtain a set of candidate nodes to be executed.
6. The parallel task execution method for intelligent agent systems according to claim 1, characterized in that, Update the legal directed acyclic structure based on the successful execution result, including: If the node to be executed is executed successfully, retrieve all successor nodes of the node to be executed and update the in-degree count of the successor nodes; If the updated in-degree count of the successor node is zero, the successor node with an in-degree count of zero is added to the set of schedulable candidate nodes to update the legal directed acyclic structure.
7. The parallel task execution method for intelligent agent systems according to claim 1, characterized in that, Fault tolerance strategies are implemented for the execution node process, including: Check the retry configuration of the currently pending node. If the number of retries for the currently pending node has not reached the upper limit and the failure reason is determined to be intermittent, then reload the current execution context, trigger the execution process of the currently pending node again, and update the retry count. If the current node to be executed succeeds after retry, the legal directed acyclic structure is updated according to the successful execution result; if the execution fails, a degradation strategy is executed; the degradation strategy includes one or more of the following: calling a simplified version of the logic, using cached historical data to replace real-time calculation, and reducing the output precision requirement. If the current node to be executed succeeds after the downgrade strategy is implemented, the legal directed acyclic structure is updated according to the successful execution result; if the execution fails, it is queried whether there is a backup node in the legal directed acyclic structure. If a backup node exists, the backup node is executed, and the valid directed acyclic structure is updated based on the successful execution result; if the execution fails or no backup node exists, the task is aborted and marked as failed.
8. The parallel task execution method for intelligent agent systems according to claim 7, characterized in that, The steps to abort a task and mark it as failed include: Mark the status of nodes that failed to execute, and record the reason for the failure, the handling measures attempted, and the error stack information; Based on the dependency relationships of the legal directed acyclic structure, identify all downstream nodes that depend on the failed node; If the downstream node has no other alternative dependent paths, then the scheduling of the downstream node is terminated. If the downstream node has a backup dependent branch node, then switch to the backup dependent branch node and notify the scheduling module to schedule the backup dependent branch node first.
9. A parallel task execution device for intelligent agent systems, characterized in that, include: The acquisition module is used to acquire a structured plan, which contains multiple task steps; The dependencies of the structured plan are identified using language model reasoning, resource mapping analysis, and rule and keyword matching, and a dependency table is generated. A directed acyclic structure construction module is used to map the task steps as nodes, connect the nodes according to the dependency table to form a directed graph, and perform loop detection and verification on the directed graph to obtain a valid directed acyclic structure. The node selection module is used to construct a candidate node set based on the nodes of the legal directed acyclic structure, and sort the nodes in the candidate node set according to the preset scheduling strategy to obtain a set of candidate nodes to be executed, and to construct execution context information for the node to be executed. The task execution module is used to receive and parse the pending scheduling request, obtain the execution context information, and start the corresponding pending node according to the execution context information; If the execution is successful, update the legal directed acyclic structure based on the execution success result; If execution fails, a fault-tolerance strategy is applied to the execution node process.
10. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the parallel task execution method for intelligent agent systems as described in any one of claims 1-8.
Citation Information
Cited By
Task execution method and device based on agent and MCP collaborative optimization
CN121636122A
Task execution method and device based on agent and mcp collaborative optimization
CN121636122B
