Multi-agent long-period task orchestration system based on directed acyclic graph and state machine
Patent Information
- Application Number
- CN202610855616.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2046-06-15
AI Technical Summary
[0005]为了弥补以上不足,本发明提供了基于有向无环图与状态机的多智能体长周期任务编排系统,旨在改善传统的任务编排大多采用静态阈值熔断,由于无法识别隐式语义死锁且需全量重载历史上下文,从而造成资源极度浪费与任务崩溃的问题
[0015]1、本发明中,通过包络动态阻断异常进程并提取清洗摘要进行续跑,进而精准熔断智能体死循环,从而改善了传统的任务编排大多采用静态阈值熔断,由于无法识别隐式语义死锁且需全量重载历史上下文,从而造成资源极度浪费与任务崩溃的问题。
Smart Images

Figure CN122387634B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and distributed scheduling, and in particular to a multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines. Background Technology
[0002] When multi-agent systems handle complex, long-cycle tasks involving large language models, the industry commonly uses directed acyclic graphs combined with multi-agent collaboration frameworks for the orchestration and scheduling of business flows.
[0003] In the actual execution of long-cycle tasks, due to the uncertainty of external interface data or the reasoning limitations of the large model itself, some agent nodes are prone to falling into implicit semantic dead loops when receiving non-standard data. The network request at the physical level does not report errors or the program crashes, but the agent repeatedly outputs homogeneous, hallucinatory text in micro-interactions and continuously triggers internal repetitive calls.
[0004] To address the aforementioned anomalies, existing task orchestration and scheduling frameworks generally rely on setting static physical thresholds for task circuit breaking. This type of static threshold circuit breaking mechanism has a critical technical flaw: if the static threshold is set too high, the system cannot detect implicit infinite loops in time, causing large models to rapidly exhaust massive API billing within the infinite loop, and repeatedly generated invalid interaction logs severely pollute the system's runtime stack; if the static threshold is set too low, it easily misjudges complex inference processes that normally take a long time for large models as abnormal and forcibly terminates them. Furthermore, after triggering a static block, existing recovery mechanisms often require reloading the global historical context, which contains a large amount of illusory dirty data, to the large model for retrying. This not only significantly increases the risk of memory overflow but also induces the large model to fall into the same logical deadlock again based on the polluted context. Summary of the Invention
[0005] To overcome the above shortcomings, this invention provides a multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines. It aims to improve the problem that traditional task orchestration mostly uses static threshold circuit breaking, which cannot identify implicit semantic deadlocks and requires full reloading of historical context, resulting in extreme resource waste and task crashes.
[0006] In a first aspect, the present invention provides the following technical solution: a multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines, comprising the following modules:
[0007] The task parsing module is used to decompose business instructions into a directed acyclic graph model and configure semantic verification operators on the communication edges of adjacent agent nodes;
[0008] A state mapping module is used to nest finite state machines within the agent nodes and define state transition boundary conditions.
[0009] The concurrent scheduling module is used to start independent subprocesses to generate output data according to the topological sequence of the directed acyclic graph model; if the output data fails the semantic verification operator, the finite state machine is driven to transition to the retry state, and the semantic confidence and cumulative token quantity are collected.
[0010] The envelope blocking module is used to derive the reward process value based on the semantic confidence and the cumulative token quantity, and to use backward induction combined with conditional expectation to inversely derive and solve the Snell envelope value; when the reward process value is equal to the Snell envelope value, the independent subprocess is blocked, and the degradation vector and cross timestamp are output.
[0011] The linkage cleaning module is used to tighten the confidence threshold and token budget threshold of downstream nodes based on the degradation vector; slice the execution stack of the independent subprocess with the cross timestamp as the boundary, remove the interaction history after the cross timestamp, and output the cleaning context.
[0012] The continuation module is used to start the lightweight extraction model to perform semantic feature compression on the cleaned context to generate summary checkpoints; disconnect the inference route of the communication edge, start the logical node containing static rule code to load the summary checkpoints and execute the breakpoint continuation.
[0013] By adopting the above technical solution, the abnormal process is dynamically blocked and the cleaned summary is extracted for continued running, thereby accurately breaking the dead loop of the intelligent agent. This improves the problem that traditional task orchestration mostly uses static threshold circuit breaking, which cannot identify implicit semantic deadlocks and requires a full reload of historical context, resulting in extreme waste of resources and task crashes.
[0014] The present invention has the following beneficial effects:
[0015] 1. In this invention, abnormal processes are blocked by envelope dynamics and cleaned summaries are extracted for continued running, thereby accurately breaking the dead loop of the intelligent agent. This improves the problem that traditional task orchestration mostly uses static threshold circuit breaking, which cannot identify implicit semantic deadlocks and requires a full reload of historical context, resulting in extreme waste of resources and task crashes.
[0016] 2. In this invention, semantic verification operators are generated by encapsulating dual-dimensional assertion constraints based on structure and confidence and pre-binding them to the communication edge, thereby achieving physical-level data format and logic interception. This improves the problem that traditional multi-agent systems mostly adopt unidirectional scheduling with post-event manual review, which causes dirty data to spread disorderly to downstream nodes of the topology due to the lack of active identification capability at the communication boundary.
[0017] 3. In this invention, by configuring hard retry state transition boundaries for contract failure events in the discrete state transition matrix, illegal execution flows are blocked and looped within micro-nodes. This improves the problem of unreliable output data leakage caused by the lack of rigid routing branches for semantic deviations, which is mostly adopted by the loose transition mechanism without boundaries in traditional workflow state management.
[0018] 4. In this invention, downstream nodes are accurately located by parsing the degradation vector and a signal is sent to them by a preset coefficient to proportionally shrink and lower the token budget threshold. This enables adaptive limitation of computing power quota at the global topology level, thereby improving the traditional task scheduling method that mostly uses isolated faulty nodes. Due to the lack of dynamic early warning and quota feedback from faulty points to downstream dependent nodes, residual dirty data infiltration causes cascading crashes. Attached Figure Description
[0019] Figure 1 This is an architecture diagram of the multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines proposed in this invention.
[0020] Figure 2 This is a detailed flowchart of the task parsing and state mapping rule construction for the multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines proposed in this invention.
[0021] Figure 3 This invention presents a concurrent scheduling and underlying parameter acquisition flow graph for a multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines.
[0022] Figure 4 The flowchart of Snell envelope decision-making and kernel-level anomaly blocking for the multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines proposed in this invention is shown.
[0023] Figure 5 This invention relates to the linkage cleaning, context physical pruning, and breakpoint resume control flow of the multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines. Detailed Implementation
[0024] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] Example 1:
[0026] In a first embodiment of the present invention, the present invention provides a multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines, such as... Figures 1-2 As shown, it includes the following modules:
[0027] The task parsing module is used to decompose business instructions into a directed acyclic graph model and configure semantic verification operators on the communication edges of adjacent agent nodes;
[0028] Furthermore, the task parsing module is used for execution:
[0029] Parse the business constraint file in the business instructions to obtain the structural assertion constraints and confidence assertion constraints;
[0030] Based on structural assertion constraints, the format protocol of the agent node output is parsed to establish field integrity verification rules.
[0031] Log-likelihood probability extraction rules are obtained based on confidence assertion constraints in the natural language generation process.
[0032] The field integrity verification rules and the log-likelihood probability extraction rules are encapsulated to generate semantic verification operators, and the semantic verification operators are bound to the communication edge.
[0033] Specifically, the task parsing module plays a core role in the initial topology construction and boundary rule deployment in the multi-agent long-cycle task orchestration system. The data input end of this module receives long-cycle business instructions with business constraint files, and the data output end generates a directed acyclic graph model with semantic boundary control weights.
[0034] The system first uses a parsing engine to unpack the business constraint file attached to the business instructions, separating the structural assertion constraints and confidence assertion constraints. Based on the obtained structural assertion constraints, the system parses the format protocol to be output by the upstream agent node, clarifying the key-value pair requirements for each data field, and constructing field integrity verification rules accordingly. This step establishes a defense at the data structure level, responsible for intercepting physically corrupted data with missing fields or incorrect data types.
[0035] Based on the extracted confidence assertion constraints, the system establishes log-likelihood probability extraction rules for the natural language generation process. When the large language model performs an autoregressive generation task, the system intercepts the handle returned by the large language model interface, extracts the probability distribution matrix of each text tag, and calculates the semantic confidence index using the following mathematical formula:
[0036] ;
[0037] in The log-likelihood average semantic confidence of the output text sequence of the target agent is used as a dimensionless scalar to measure the quality of large model generation, and its value ranges from negative infinity to zero. This represents the total number of text tags contained in the output text sequence, and its value is a natural number greater than zero. The large language model is represented in the first... The current text marker generated by the decoding step. This indicates the sequence of preceding text tags that were output before the current tag was generated. This represents the context sequence of prompt words input into the large language model. This indicates that, given a context sequence of prompt words and a preceding sequence of text tags, the large language model generates the current text tag. The autoregressive conditional probability is strictly constrained to the real number range of 0 to 1.
[0038] The task parsing module encapsulates the field integrity verification rules generated by structural assertion constraints and the log-likelihood probability extraction rules generated by confidence assertion constraints into a unified semantic verification operator according to the series short-circuit judgment logic. Within the semantic verification operator, a two-stage data verification pipeline is configured. The first-stage pipeline loads the field integrity verification rules and performs key-value pair structure comparison on the output data. If the comparison fails, an interrupt is triggered directly, and an interception signal is output. If the comparison succeeds, the output data is passed to the second-stage pipeline. The second-stage pipeline loads the log-likelihood probability extraction rules to calculate the semantic confidence score, and outputs an interception signal if the calculated semantic confidence score is lower than a preset safety threshold. The task parsing module binds the encapsulated semantic verification operator to the directed communication edges between adjacent agent nodes in the directed acyclic graph model.
[0039] By deploying semantic verification operators at the node communication boundary in advance, the system changes the traditional one-way scheduling mode of multi-agent systems that relies solely on post-event manual review. During the agent task handover phase, the communication edge has the ability to actively identify and intercept implicit semantic illusion data generated by agents in the microscopic physical process by relying on the two-dimensional rules of structure and probability, thus cutting off the path of erroneous context spreading to downstream nodes of the long-cycle task graph.
[0040] The state mapping module is used to nest finite state machines within agent nodes and define the boundary conditions for state transitions.
[0041] Furthermore, the state mapping module is used to perform:
[0042] Initialize a discrete set of states in a finite state machine, including a start state, an external wait state, a retry state, and a termination state.
[0043] Define the transition trigger matrix between discrete state sets;
[0044] Configure an asynchronous suspension event for the external waiting state in the transition trigger matrix, and drive the current state to transition to the external waiting state when the asynchronous suspension event is detected;
[0045] Configure a contract failure event for the retry state in the transition trigger matrix, and drive the current state to the retry state when an interception signal is detected that the output data has not passed the semantic check operator.
[0046] Specifically, the state mapping module receives the agent nodes instantiated in the directed acyclic graph model as data input, and assembles finite state machines nested inside the agent nodes, ultimately outputting the agent's running process controlled by discrete lifecycles.
[0047] The module first establishes a set of discrete states within the finite state machine. This set includes a start state, an external wait state, a retry state, and a termination state. For this set of discrete states, the system's underlying layer constructs a transition trigger matrix to control the flow of states. The state transitions at the microscopic level within the agent are determined by the following mathematical state transition equations:
[0048] ;
[0049] in It represents the target discrete state reached after the state transition determination, and its value range is strictly constrained within the set interval formed by the start state, external waiting state, retry state and termination state. Indicates the target agent at the current moment The initial discrete state in which it is located. This represents the vector of input events that the system listens for and captures in the current operation step. This represents the state transition mapping function defined by the transition trigger matrix.
[0050] In actual process flow, the transition trigger matrix configures rigid routing branches for different input event vectors. The module configures the asynchronous suspension event corresponding to the external waiting state into the transition trigger matrix. When an asynchronous suspension event caused by a long-cycle task interaction is detected, the state transition mapping function drives the current state to forcibly transition to the external waiting state. The agent node in the external waiting state relinquishes the underlying computing resources and maintains suspension listening.
[0051] The module configures the corresponding contract failure event for the retry state in the transition trigger matrix. When an interception signal is received indicating that the output data has failed the semantic verification operator, the system instantiates the interception signal as a contract failure event. After capturing the contract failure event, the state transition mapping function directly drives the current state to transition to the retry state.
[0052] By encapsulating micro-finite state machines within macro-level task nodes of a directed acyclic graph (DAG) model and defining state transition mapping functions, the system isolates illegal execution paths at the independent sub-process level. In scenarios where semantic deviations occur in the output of the large language model, triggering interception signals, contract failure events rigidly confine the execution flow within a retry state loop, preventing unreliable output data from leaking to downstream nodes of the graph model across topological boundaries. For long-cycle business instructions, asynchronous suspension events are configured, and process flow is controlled to transition to an external waiting state, avoiding resource exhaustion and blocking caused by meaningless memory occupation during asynchronous cross-system interactions.
[0053] like Figure 3 As shown, the concurrent scheduling module is used to start independent subprocesses to generate output data according to the topological sequence of the directed acyclic graph model; if the output data fails the semantic verification operator, the finite state machine is driven to transition to the retry state, and the semantic confidence and cumulative token quantity are collected.
[0054] Furthermore, the concurrent scheduling module is used to execute:
[0055] Listen for the return handle of the large language model interface in the runtime environment of an independent subprocess;
[0056] Parse the autoregressive conditional probabilities corresponding to the text tags from the returned handle and calculate the average probability value to generate semantic confidence;
[0057] The lengths of the input text sequences submitted by the independent subprocesses in the current iteration step are summed with the lengths of the received output text sequences.
[0058] The summed length value is added to the token count value of the historical iteration steps to generate the cumulative token amount.
[0059] Specifically, the concurrent scheduling module is responsible for distributing specific computational tasks and collecting micro-state runtime indicators within the multi-agent long-cycle task orchestration system. The data input to this module is a directed acyclic graph model carrying directed dependency topology and transition boundary conditions; the data output is the semantic confidence and cumulative token count for the current iteration step.
[0060] The system requests computing resources from the operating system kernel according to the topological partial order sequence defined by the directed acyclic graph model, and isolates and launches an independent child process corresponding to the target agent in memory. The independent child process loads the specific prompt word context and utility functions, and is responsible for initiating non-blocking asynchronous network requests to the large language model service interface to generate output data.
[0061] During the execution of an independent subprocess, if the output data generated by the target agent fails to meet the constraints of the preset semantic verification operator, the system will drive the finite state machine encapsulated within the agent node to transition, forcing the current execution state to enter the retry state. During the iterative loop of the retry state, the concurrency scheduling module starts a background daemon process to continuously monitor the return handles generated when the independent subprocess interacts with the large language model interface.
[0062] The concurrent scheduling module reads the probability distribution matrix of the large language model in the autoregressive generation process from the captured return handle, parses the autoregressive conditional probability corresponding to the text tag, and calculates the average probability value of the log-likelihood probability using the following formula to calculate the semantic confidence under the current iteration step:
[0063] ;
[0064] in Indicates the first The average probability value calculated in the next iteration step, i.e. the semantic confidence, takes the range of real numbers from 0 to 1. Indicates the first In each iteration step, the total number of text tags contained in the output text sequence generated by the large language model is a natural number greater than 0. This represents the natural logarithm of the autoregressive conditional probability output by the large language model. Indicates the first A specific text tag generated by each decoding step. This represents the sequence of preceding text tags that preceded the generation of the current text tag. Indicates the first The input prompt word context sequence submitted to the large language model interface in the next iteration step. This represents the autoregressive conditional probability value output by the large language model.
[0065] In addition to calculating semantic confidence, the concurrent scheduling module synchronously counts the lengths of the input and output text sequences in the current iteration step, obtains the number of input text tokens and the number of output text tokens, and sums them to obtain the token consumption for the current step. Subsequently, the system generates the cumulative token amount from the first execution to the current iteration step using the following accumulation formula:
[0066] ;
[0067] in Indicates up to the number The cumulative token count in each iteration step is a natural number. Indicates the first At the end of the next iteration step, the system records the historical token count value, when The value should be 0 at that time. Indicates the first The length of the input text sequence submitted in the next iteration step. Indicates the first The length of the output text sequence received in the next iteration step.
[0068] In the concurrent scheduling module, the system does not simply rely on fixed timeout retry logic at the physical layer. By listening for return handles and parsing the underlying probability matrix in an independent subprocess, the system outputs a semantic confidence index reflecting the current generation quality of the large language model in each retry iteration. Combined with a precisely accumulated token quantity index, this provides the subsequent blocking decision engine with underlying runtime parameters that reflect the two-dimensional evolution trend of inference benefits and computing power costs.
[0069] like Figure 4 As shown, the envelope blocking module is used to derive the reward process value based on semantic confidence and cumulative token quantity, and to reversely derive the Snell envelope value using backward induction combined with conditional expectation; when the reward process value is equal to the Snell envelope value, the independent subprocess is blocked, and the degradation vector and cross timestamp are output.
[0070] Furthermore, the process of deriving the reward process value and solving the Snell envelope value using the envelope blocking module is used to perform:
[0071] Extract the semantic confidence of the current iteration step and calculate the difference between the semantic confidence of the previous iteration step to obtain the quality difference value;
[0072] Extract the difference between the cumulative token amount in the current iteration step and the cumulative token amount in the previous iteration step to obtain the cost difference;
[0073] Divide the quality difference by the cost difference to generate the reward process value for the current iteration step;
[0074] Initialize the terminal envelope value within the preset maximum token consumption step limit;
[0075] Starting from the terminal envelope value, the Markov conditional expectation is derived in reverse using backward induction combined with the time smoothing coefficient for each iteration step, and the Snell envelope value corresponding to each iteration step is obtained sequentially.
[0076] The envelope blocking module blocks the execution of independent child processes.
[0077] In each iteration step, the numerical values of the reward process value and the Snell envelope value are compared synchronously.
[0078] When the comparison confirms that the reward process value and the Snell envelope value are equal for the first time, the time node corresponding to the current iteration step is marked as a cross timestamp;
[0079] A forced interrupt instruction is sent to the operating system kernel's process scheduler to block the independent child process, and a degradation vector containing the identifier of the source node of the routing anomaly is extracted simultaneously.
[0080] Specifically, the envelope blocking module is responsible for core stop time decisions and abnormal circuit breaker interception in the multi-agent long-cycle task orchestration system. The module's data input receives semantic confidence and accumulated token quantity from the preceding links, and its data output generates a degradation vector and cross-timestamp to trigger subsequent topology reconfiguration logic.
[0081] The system extracts the semantic confidence of the current iteration step and performs a difference operation with the semantic confidence of the previous iteration step to obtain the quality difference. It also extracts the cumulative token quantity of the current iteration step and performs a difference operation with the cumulative token quantity of the previous iteration step to obtain the cost difference. The system divides the obtained quality difference by the cost difference to generate the reward process value for the current iteration step. The relevant core calculations are based on the following formula:
[0082] ;
[0083] in Indicates the first The reward process value calculated in the next iteration step is used to quantify the marginal semantic gain generated by the agent under the unit token consumption cost. Indicates the current number The semantic confidence is obtained by statistical analysis in the next iteration step. Indicates the previous time The semantic confidence is obtained by statistical analysis in the next iteration step. Indicates the current number as of now. The cumulative token amount in each iteration step. Indicates up to the previous number The cumulative token amount in each iteration step.
[0084] To solve for the Snell envelope value, the system configures a parallel asynchronous prediction thread outside of an independent child process. The system extracts a preset maximum token consumption step count as the limit step count. Calculate the first The reward process value of each step and in the limit number of steps Initialize the terminal envelope value Using the terminal envelope value as the calculation reference point, the asynchronous prediction thread generates multiple simulated execution paths using the least squares Monte Carlo algorithm. It then employs backward induction combined with a time smoothing coefficient to perform inverse derivation, pre-calculating and caching the Snell envelope values corresponding to each iteration step in memory. The system's built-in inverse derivation control equations are as follows:
[0085] ;
[0086] in Indicates the first The Snell envelope value corresponding to the next iteration step. This represents a statistical operator that extracts the maximum value from the set of elements within the curly braces. Indicates the first The reward process value for each iteration step. This represents the preset time smoothing coefficient, with its value range limited to real numbers greater than 0 and less than 1. Indicates the first The Snell envelope value corresponding to the next iteration step. This indicates that up to the [number]th ...year] Historical running state flow of the next iteration step Given the given information, what is the process value of the reward for the next step? Markov conditional expectation prediction.
[0087] During the forward propagation of each physical execution cycle, the main process calculates the currently generated reward process value in real time and performs a tolerance-based equality check between it and the Snell envelope value cached in memory. The control inequality for this check is as follows:
[0088] ;
[0089] in This indicates the preset floating-point number determination tolerance threshold, with a value of [value to be filled in]. When the above inequality holds, the system determines that the reward process value is equal to the Snell envelope value.
[0090] When the system detects that the reward process value and the Snell envelope value are equal for the first time during the entire process lifecycle, it immediately marks the absolute time node of the intersection and records it as a cross-timestamp. For execution flows that meet the intersection conditions, the system invokes low-level permissions to send a forced interrupt command to the operating system kernel's process scheduler, forcibly blocking and destroying the independent child process residing in the target agent at the physical system level. The module synchronously captures abnormal process environments, extracts the degradation vector containing the identifier of the routing anomaly source node, and outputs the recorded cross-timestamp and degradation vector side by side to subsequent business links.
[0091] The envelope blocking module abandons the coarse-grained circuit breaker logic that relies on hard resource limits or fixed response timeouts. In long-term multi-agent collaborative environments, local infinite loops trapped in large language models often disguise themselves as valid output sequences, leading to massive concurrent computations and causing a computing power black hole. This module uses Snell's envelope theorem to dynamically optimize the stopping boundary, transforming the generation quality difference and cost of large models into a multi-dimensional marginal benefit evaluation. The system uses a rigorous backward expectation derivation model to perform kernel-level truncation the instant the expected marginal benefit first falls to the decay threshold, cutting off the continuous expansion path of ineffective inference overhead and setting a rigid time scale for the precise memory pruning of subsequent damaged nodes.
[0092] like Figure 5 As shown, the linkage cleaning module is used to tighten the confidence threshold and token budget threshold of downstream nodes based on the degradation vector; it slices the execution stack of independent subprocesses by the cross timestamp, removes the interaction history after the cross timestamp, and outputs the cleaning context.
[0093] Furthermore, the process of tightening the confidence threshold and token budget threshold in the linkage cleaning module is used to execute:
[0094] Parse the degradation vector to obtain the identifier of the source node of the routing anomaly;
[0095] Send a shrink signal to the task parsing module to locate the downstream node in the directed acyclic graph model;
[0096] The initial confidence threshold of the downstream node is multiplied by the preset confidence amplification factor to generate an increased value as the confidence threshold.
[0097] The initial token budget threshold of the downstream node is multiplied by the preset resource reduction coefficient and then proportionally reduced to generate a lower value as the token budget threshold.
[0098] The process of the linked cleaning module slicing the execution stack of independent child processes is used for execution:
[0099] Read the execution stack of the independent child process before it was truncated;
[0100] Extract a complete list of interaction history, including dialogue records, from the runtime stack;
[0101] Inject the cross timestamps as slice cursors into the complete interaction history list;
[0102] Slicing operations are performed on the complete interaction history list based on the slice cursor, physically deleting the interaction history after the time pointed to by the slice cursor, and extracting the valid historical data before the time pointed to by the slice cursor and assembling it into a clean context.
[0103] Specifically, the coordinated cleaning module primarily performs dynamic feedback of topology network parameters and physical stripping of abnormal node runtime contexts within the overall system architecture. The module's data input port receives the degradation vector and cross-timestamp triggered by interception in the preceding stages. For the macro-level topology structure, the module outputs the increased confidence threshold and decreased token budget threshold to the task parsing module. For the micro-level process environment, the module outputs the assembled cleaning context to the subsequent storage medium.
[0104] For the tightening action of the dynamic threshold, the module first performs inverse parsing on the input degradation vector to extract the identifier of the routing anomaly source node that triggered the interception action. Based on the extracted source node identifier, the system constructs a contraction signal at the instruction level and sends it to the task parsing module. Upon receiving the signal, the task parsing module traverses the directed acyclic graph model to accurately locate the affected downstream nodes.
[0105] After identifying specific downstream nodes, the system performs quantitative adjustments to the testing criteria and computing power quotas. New confidence limits are generated based on the following formula:
[0106] ;
[0107] in This represents the increased value generated through calculation, which serves as the confidence threshold for restricting the admission of subsequent data. This represents the initial confidence threshold issued to downstream nodes in a directed acyclic graph model. This represents the preset confidence level amplification factor, whose value is rigidly limited to a real number greater than one.
[0108] The system generates new budget quotas based on the following formula:
[0109] ;
[0110] in This represents the lowered value generated after calculation, which serves as the token budget threshold for intercepting calculation requests. This represents the initial token budget threshold initially allocated to downstream nodes in a directed acyclic graph model. This represents the preset resource reduction coefficient, whose value is limited to a real number range greater than 0 and less than 1.
[0111] At the low-level micro-memory allocation level, the module intervenes in the operating system's process control block, reading the execution stack of the independent child process before it was forcibly truncated. The system scans the local variable call frames within the execution stack, extracting heap memory pointers pointing to the large language model context object. Using these heap memory pointers, the system performs cross-region addressing, locating the global history buffer allocated by the independent child process in the heap memory, and extracting a complete interaction history list covering previous rounds of dialogue from the global history buffer. The system extracts the input cross-timestamps, converts them into time-dimensional slice cursors, and forcibly injects these slice cursors into the timeline sequence of the complete interaction history list. Using the time node where the cursor is located as the boundary, the system performs physical slicing operations on the complete interaction history list in the heap memory. Interaction history generated after the time pointed to by the slice cursor is physically overwritten and deleted within the heap memory block. Valid historical data retained before the time pointed to by the slice cursor is extracted by the system and assembled into a clean context according to the chronological order.
[0112] The module cuts off the fault continuation link when a long-cycle task experiences abnormal flow. Instead of isolating faulty nodes, the system directly locates downstream dependent tasks by identifying the fault source and raises the semantic verification threshold in advance, forcibly reducing the available token resources. This blocks the channel for cascading crashes caused by residual dirty data infiltration at the global graph level. The module uses absolute timestamps derived through calculus to physically truncate the system's underlying execution stack, removing toxic interference text repeatedly generated when the large language model is stuck in an infinite loop, while retaining pre-inference logs with real business value. This avoids the technical flaw of fully loading historical context, which could cause the agent to fall into a logical deadlock again.
[0113] like Figure 5 As shown, the continuation module is used to start the lightweight extraction model to perform semantic feature compression on the cleaned context to generate summary checkpoints; disconnect the inference route of the communication edge, start the logical node containing static rule code to load the summary checkpoint and execute the breakpoint continuation;
[0114] Furthermore, the continuation module extracts and generates summary checkpoints for execution:
[0115] The cleaning context is input into the lightweight extraction model to perform semantic feature compression and key information extraction, generating summary checkpoints that include the previous execution progress;
[0116] Perform serialization encoding based on a distributed storage protocol on the digest checkpoint;
[0117] Write the serialized and encoded digest checkpoints into the distributed storage medium.
[0118] The resume module executes the breakpoint resume process, which is used to perform:
[0119] Send a communication edge blocking command to the directed acyclic graph model to cut off the inference route from the current node to the downstream node;
[0120] Insert pre-defined logical nodes containing static rule codes into a directed acyclic graph model;
[0121] Redirect the communication edge to the logical node containing the static rule code;
[0122] The deserialization function is called to read the digest checkpoint from the distributed storage medium and load it into the memory space of the logical node containing the static rule code, so as to drive the logical node containing the static rule code to execute the breakpoint resume based on the digest checkpoint.
[0123] Specifically, the continuation module in the multi-agent long-cycle task orchestration system is responsible for state takeover and backup logic takeover after abnormal interruption. The module's data input port receives the cleaning context passed from the preceding steps, and its data output port outputs a deterministic task instruction stream based on rule-based takeover to the system's main execution process.
[0124] The system wakes up the DistilBERT sequence labeling network, a lightweight extraction model, outside of an independent subprocess. The system loads the cleaned context as input into the DistilBERT sequence labeling network, utilizing its feedforward neural network layers to perform semantic feature compression and key business entity information extraction, generating structured summary checkpoints arranged in key-value pair format. The feature compression and structure transformation process is defined by the following state mapping space equation:
[0125] ;
[0126] in This represents the summary checkpoint vector data generated after dimensionality reduction and compression. This represents a nonlinear mapping function that enables the lightweight extraction model to perform semantic feature compression and information extraction. This represents the input cleaning context sequence matrix. This represents the pre-defined encoding weight matrix within the lightweight extraction model.
[0127] After obtaining the digest checkpoint, the module performs serialization encoding according to the underlying distributed storage protocol of the system. The system converts the structured memory object into a continuous binary byte stream, and then writes the byte stream into the distributed storage medium of the cluster for persistent storage, thus preventing the risk that the underlying context data will be reclaimed and cleared by the system due to abnormal process destruction.
[0128] Upon entering the breakpoint resume execution phase, the module issues a communication edge blocking command to the directed acyclic graph model. The system's underlying controller responds to this command, forcibly severing the inference route from the currently faulty node to the originally intended downstream large language model node within the graph model topology. The module retrieves a logical node containing static rule code from a pre-built library and inserts it into the current graph model network topology, redirecting the previously severed communication edge to the data receiving port of this logical node. The set evolution logic of the above topology route redirection actions is shown in the following formula:
[0129] ;
[0130] in This represents the set of communication edges in the entire graph after the redirection operation is completed. This represents the set of communication edges in the original graph before the blocking instruction was executed. This represents the inference route communication edge that has been physically severed from the current node to the originally intended downstream large language model node. This represents a newly created directional communication edge that points from the current node to a logical node containing static rule code.
[0131] After the route redirection is established, the system calls a deserialization function to read the digest checkpoint byte stream from the distributed storage medium, reverse-engineer it into a JSON object, and load it into the memory space of the logic node containing static rule code. The logic node containing static rule code has built-in hard-coded conditional branch statements, which trigger corresponding branches by parsing and reading the values of specific key-value pairs in the structured digest checkpoint. For example, in the government approval workflow, the logic node reads the registered capital key value from the JSON object. The judgment logic is: if the registered capital value is greater than one million yuan, it outputs a low risk level and triggers a route jump to the downstream certificate generation node; if the registered capital value is not greater than one million yuan, it intercepts automatic transfer and outputs a flag indicating transfer to the manual review queue. The system continues to advance the blocked task flow process based on the above-mentioned underlying deterministic rule engine.
[0132] The module establishes a fallback channel for the evolution from uncertain probability generation to deterministic rules in complex scheduling networks. The system abandons the reliance on full high-dimensional memory snapshots for restoring the inference state of large language models, instead using highly dimensionality-reduced and compressed summary checkpoints as the sole state credential, thus breaking the closed loop caused by repeated loading of the full context, which leads to a geometric increase in token billing. The underlying directed acyclic graph directly truncates model routing paths trapped in implicit infinite loops, and logical nodes containing static rule code forcibly deprive faulty agents of their business execution rights, eliminating the global system stagnation caused by local semantic verification failures.
[0133] Example 2:
[0134] In the scenario of automated cross-system approval in government affairs, involving multiple agents and long cycles, the system often needs to orchestrate multiple agents using a directed acyclic graph (DAG) to sequentially execute dependent nodes such as business information extraction, tax risk screening, official seal legality verification, and final certificate generation. A core technical problem exists in this scenario: due to the inconsistent quality of data interfaces across different government subsystems, the agent responsible for tax risk screening is highly susceptible to falling into an implicit semantic illusion loop when receiving incomplete or non-standard data—that is, the physical process does not crash, the interface does not report errors, but the agent repeatedly calls the tool to retry within the state machine and outputs invalid, homogenized screening reports. Traditional static resource interception methods (such as setting a fixed number of retries or a uniform token limit) are insufficient to handle this situation: if the interception threshold is too low, it may mistakenly kill normal long-running inference processes that are handling complex tax bills, causing the entire enterprise setup task to be interrupted; if the threshold is too high, it will not only rapidly exhaust massive API billing data in an infinite loop (wasting tokens), but once a hard block is triggered, a full restart of the agent will reload all the previously accumulated invalid phantom interaction records into the context, causing memory overflow or inducing a new round of infinite loops, resulting in extremely low efficiency and high cost for long-cycle government approval pipelines. To solve the above problems, this invention provides a multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines, the structure of which is as follows: Figure 1 As shown. The specific implementation process of this system is as follows:
[0135] The system establishes the topological order of macro-level tasks through the task parsing module and deploys verification logic at node junctions to intercept data with substandard format or confidence levels. The state mapping module regulates the agent's operational cycle at the micro-level, preventing illegal state transitions. During the execution phase, the concurrent scheduling module wakes up the agent in isolated processes and monitors its output quality and resource consumption in real time. When an agent gets stuck in a loop that cannot produce effective results, the envelope blocking module determines the optimal blocking time based on precisely derived reward process values and Snell envelope values, forcibly truncating the process and outputting anomaly location data. Subsequently, the linkage cleaning module dynamically raises the security threshold and reduces quotas for subsequent nodes based on this data, while precisely pruning useless context that causes failures along the timeline. Finally, the continuation module extracts the simplified effective historical generation checkpoints, cuts off the original dependency paths, and uses deterministic rule nodes to take over the task, avoiding the computational waste and deadlock recurrence caused by restarting large models in traditional solutions, ensuring the determinism and continuity of the overall business flow.
[0136] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines, characterized in that, Includes the following modules: The task parsing module is used to decompose business instructions into a directed acyclic graph model and configure semantic verification operators on the communication edges of adjacent agent nodes; A state mapping module is used to nest finite state machines within the agent nodes and define state transition boundary conditions. The concurrent scheduling module is used to start independent subprocesses to generate output data according to the topological sequence of the directed acyclic graph model; if the output data fails the semantic verification operator, the finite state machine is driven to transition to the retry state, and the semantic confidence and cumulative token quantity are collected. The envelope blocking module is used to derive the reward process value based on the semantic confidence and the cumulative token amount, and to use backward induction combined with conditional expectation to inversely derive and solve the Snell envelope value. When the reward process value equals the Snell envelope value, the independent subprocess is blocked, and a degradation vector and cross timestamp are output. The process of deriving the reward process value and solving the Snell envelope value by the envelope blocking module is used to perform: Extract the semantic confidence of the current iteration step and calculate the difference between the semantic confidence of the previous iteration step to obtain the quality difference value; Extract the difference between the cumulative token amount in the current iteration step and the cumulative token amount in the previous iteration step to obtain the cost difference; Divide the quality difference by the cost difference to generate the reward process value for the current iteration step; Initialize the terminal envelope value within the preset maximum token consumption step limit; Starting from the terminal envelope value, the backward induction method combined with the time smoothing coefficient is used to perform the Markov conditional expectation inverse derivation for each iteration step, and the Snell envelope value corresponding to each iteration step is obtained sequentially. The envelope blocking module blocks the process of the independent sub-process, for the purpose of executing: In each iteration step, the numerical values of the reward process value and the Snell envelope value are compared synchronously. When the comparison confirms that the reward process value and the Snell envelope value are equal for the first time, the time node corresponding to the current iteration step is marked as the cross timestamp; A forced interrupt instruction is sent to the process scheduler of the operating system kernel to block the independent child process, and the degradation vector containing the identifier of the routing anomaly source node is extracted simultaneously. The linkage cleaning module is used to tighten the confidence threshold and token budget threshold of downstream nodes based on the degradation vector. The execution stack of the independent subprocess is sliced using the cross timestamp as the boundary, the interaction history after the cross timestamp is removed, and the cleaned context is output. The continuation module is used to start the lightweight extraction model to perform semantic feature compression on the cleaned context to generate summary checkpoints; disconnect the inference route of the communication edge, start the logical node containing static rule code to load the summary checkpoints and execute the breakpoint continuation.
2. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 1, characterized in that, The task parsing module is used to execute: Parse the business constraint file in the business instruction to obtain the structural assertion constraint and the confidence assertion constraint; Based on the structural assertion constraints, the format protocol output by the agent node is parsed to establish field integrity verification rules. Based on the confidence assertion constraints, the log-likelihood probability extraction rules in the natural language generation process are obtained. The field integrity verification rule and the log-likelihood probability extraction rule are encapsulated to generate the semantic verification operator, and the semantic verification operator is bound to the communication edge.
3. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 1, characterized in that, The state mapping module is used to perform: In the finite state machine, initialize a discrete set of states including a start state, an external wait state, a retry state, and a termination state; Define the transition trigger matrix between the discrete state sets; An asynchronous suspension event is configured for the external waiting state in the transition trigger matrix, and the current state is driven to transition to the external waiting state when the asynchronous suspension event is detected; Configure a contract failure event for the retry state in the transition trigger matrix, and drive the current state to the retry state when the output data fails to pass the interception signal of the semantic verification operator.
4. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 1, characterized in that, The concurrent scheduling module is used to execute: Listen for the return handle of the large language model interface in the runtime environment of the independent subprocess; The autoregressive conditional probability corresponding to the text tag is parsed from the returned handle, and the average probability value is calculated to generate the semantic confidence. The lengths of the input text sequences submitted by the independent subprocess in the current iteration step are summed with the lengths of the received output text sequences. The cumulative token amount is generated by adding the summed length value to the token count value of the historical iteration steps.
5. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 1, characterized in that, The process by which the linkage cleaning module tightens the confidence threshold and the token budget threshold is used to perform: Parse the degradation vector to obtain the identifier of the source node of the routing anomaly; Send a shrinkage signal to the task parsing module to locate the downstream node in the directed acyclic graph model; The initial confidence threshold of the downstream node is multiplied by a preset confidence amplification factor to generate an increased value, which is then used as the confidence threshold. The initial token budget threshold of the downstream node is multiplied by a preset resource reduction coefficient and then proportionally reduced to generate a lowered value as the token budget threshold.
6. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 1, characterized in that, The process by which the linkage cleaning module slices the execution stack of the independent sub-process is used to execute: Read the execution stack of the independent child process before it was truncated; Extract a complete list of interaction history, including dialogue records, from the runtime stack; The cross timestamp is injected as a slice cursor into the complete interaction history list; Based on the slice cursor, a slice operation is performed on the complete interaction history list to physically delete the interaction history after the time pointed to by the slice cursor, and the valid historical data before the time pointed to by the slice cursor is extracted and assembled into the cleaning context.
7. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 1, characterized in that, The process by which the continuation module extracts and generates the summary checkpoint is used to execute: The cleaning context is input into the lightweight extraction model to perform semantic feature compression and key information extraction, generating the summary checkpoint containing the previous execution progress; Perform serialization encoding based on a distributed storage protocol on the digest checkpoint; The serialized and encoded digest checkpoints are written into the distributed storage medium.
8. The multi-agent long-cycle task orchestration system based on directed acyclic graphs and state machines according to claim 7, characterized in that, The resume module executes the resume process from the breakpoint, which is used to perform: Send a communication edge blocking command to the directed acyclic graph model to cut off the inference route from the current node to the downstream node; Insert a preset logical node containing static rule code into the directed acyclic graph model; Redirect the communication edge to the logical node containing the static rule code; The deserialization function is invoked to read the digest checkpoint from the distributed storage medium and load it into the memory space of the logical node containing the static rule code, so as to drive the logical node containing the static rule code to execute the breakpoint resume based on the digest checkpoint.
Citation Information
Patent Citations
Multi-agent dynamic arrangement and security scheduling system based on modeling software
CN122087801A
AI-based large-scale computer room computing power resource dynamic scheduling operation and maintenance system
CN122173238A