Method and system for visual arrangement and flexible expansion of AI agents
By constructing a five-operator DAG topology and a dual-wheel data flow management system, the AI Agent's visual orchestration and flexible expansion are realized. This solves the problem that non-technical personnel cannot adjust the execution process and modify the session state in existing technologies, and improves the modularity and scalability of the system.
Patent Information
- Application Number
- CN202611423726.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-11-24
AI Technical Summary
Existing AI Agent implementations are primarily based on high-code models, making it difficult for non-technical personnel to flexibly adjust the execution flow. Furthermore, the lack of clear boundaries for modifying session states leads to development and maintenance difficulties, hindering the flexible expansion of various AI Agent models.
By constructing a five-operator DAG topology and employing a dual-wheel data flow management and loop scheduler, the AI Agent can be visualized and flexibly expanded. The "inference → execution → observation" loop is decomposed into five visualized operators, supporting operator addition, deletion, replacement, and topology adjustment, ensuring the independence of data transmission and state management.
It enables non-technical personnel to adjust the AI Agent process through drag-and-drop configuration, supports flexible expansion of multiple AI Agent modes, improves the modularity and scalability of the system, and avoids data competition and unauthorized read/write issues for state variables.
Smart Images

Figure CN123159394A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, specifically to a method and system for the visual arrangement and flexible expansion of AI agents. Background Technology
[0002] AI Agents represent a significant development direction in the field of artificial intelligence. Their core idea is to transform large language models not merely into question-and-answer systems, but into intelligent agents capable of autonomous decision-making, tool invocation, and the completion of complex tasks. With technological advancements, various implementation models of AI Agents have emerged: (1) "ReAct" mode: Proposed by Google in 2022, it is currently the most mainstream AI Agent execution mode. Its core process is as follows: Planning / Reasoning: The large language model reasons based on the user's question and the current context to determine the next action—either calling external tools to obtain information or directly generating the final answer.
[0003] Execution: If it is decided to call a tool, the specific external tool call (such as an interface request, database query, code execution, etc.) is executed, and the execution result is obtained.
[0004] Observing: The large language model observes the execution results of the tool, evaluates the task completion rate, and determines whether to continue to the next round of iteration.
[0005] These three stages are executed in a cycle, forming an autonomous loop of "reasoning → action → observation → further reasoning" until the task is completed or the preset maximum number of iterations is reached.
[0006] (2) "Chain-of-Thought" mode: proposed by Wei et al. in 2022, this mode allows large language models to demonstrate their internal reasoning process by including prompts such as "Let's think step by step" in the input prompts. This mode is usually combined with "ReAct" to form an enhanced version of "Reasoning with Thought".
[0007] (3) "ReWOO" mode: proposed by Yao et al. in 2023, it completely decouples the reasoning and planning stages. Its execution process is as follows: first, a complete plan tree is generated by a large language model, and then the workflow engine executes the generated plan, avoiding frequent alternation between reasoning and execution.
[0008] (4) "Task-and-Tool" pattern: Complex tasks are broken down into multiple subtasks (Tasks), each equipped with a specific tool (Tool) or data source, and execution is dynamically allocated through a task scheduler. For example, Manus uses a similar task decomposition and tool binding mechanism.
[0009] (5) "Reflection" mode: After a single round of execution, a reflection phase is introduced, allowing the large language model to evaluate its own decisions and execution results, identify problems, and self-correct. For example, OpenAI's GPT-4o has the ability to self-evaluate and optimize.
[0010] (6) "Mixture-of-Agents" mode: For complex tasks, multiple specialized small agents (such as data retrieval agent, code generation agent, text summarization agent) are deployed and integrated through a coordinator to form a collaborative mode of "agent set".
[0011] Despite the diversification of AI agent technology, current mainstream products still primarily employ a high-code implementation model. (1) Manus: It provides a visual workflow orchestration interface, but its underlying core execution logic is still based on a hard-coded loop framework. Although task decomposition and tool scheduling can be configured through the interface, it cannot replace and extend the core loop body of "reasoning → execution → observation" at the operator level.
[0012] (2) OpenClaw: Although it provides powerful code generation capabilities, its AI Agent orchestration still relies on developers to write code to implement loop logic, and does not support non-technical personnel to directly configure and modify the execution process.
[0013] (3) Dify: It provides a visual Agent orchestration interface. Its core adopts the "tool call + context management" model, but the "inference → execution → observation" loop process is encapsulated in a black box. Users can only adjust the parameters and cannot flexibly add or remove operators or replace the implementation of specific steps.
[0014] (4) Alibaba Cloud Refinement: It provides a rich tool library and prompt word templates, but the execution flow of the AI Agent is still implemented by hard coding. Users cannot dynamically adjust the operator topology in the loop body by dragging and dropping.
[0015] (5) Button (ByteDance): Although it provides a relatively flexible workflow configuration, its core Agent execution engine is still closed, and the "inference → execution → observation" loop is abstracted into an unmodifiable fixed process.
[0016] (6) LangChain / SpringAI / LlamaIndex: These mainstream AI development frameworks provide various Agent templates, but their implementation is still essentially high-code - developers need to write loop logic, state management and tool calls through programming. The underlying architecture is tightly coupled and difficult to extend flexibly.
[0017] The technical problem to be solved by the present invention High-code AI agents hardcode the execution flow of various patterns (such as "ReAct", "Chain-of-Thought", "ReWOO") into the code. If it is necessary to adjust the execution order (such as inserting a manual approval node before execution), replace the implementation of a certain step (such as replacing the observer based on a large language model with a rule-based evaluator), or add loop branches (such as skipping execution steps based on conditions), the source code must be modified and recompiled and deployed. This fixed approach cannot support non-technical personnel to adjust the agent's execution flow through configuration.
[0018] While existing products offer visualized workflow orchestration, the core "reasoning → execution → observation" loop remains a "black box"—non-technical personnel cannot intuitively see the agent's execution flow, how data is transferred between steps, or how the state changes in each iteration. This results in the development and maintenance of AI agents being highly dependent on technical personnel, excluding business personnel (those who understand the business best) from the agent development process.
[0019] Within the loop, the session state is read and written as a global state variable by the planner, executor, and observer steps. There are no clear boundary constraints on modifications to the session state by each step: the planner might accidentally overwrite utility messages appended by the executor, and the observer might modify helper messages generated by the planner. When adding new fields, developers struggle to determine which step should write and which should read them, leading to difficult code maintenance and frequent defects.
[0020] The planner, executor, and observer are coupled together in the code through a direct chain of function calls: the planner must produce a data structure that matches the executor's input, and the executor must produce a data structure that matches the observer's input. This tight coupling makes it impossible for the three steps to be reused independently—for example, the executor cannot be directly extracted for use in other non-ReAct scenarios, nor can it be replaced with another execution engine without modifying the executor code. Summary of the Invention
[0021] The purpose of this invention is to provide a method for visual arrangement and flexible expansion of AI agents, in order to solve the technical problems existing in the prior art.
[0022] Specifically, it includes: Step 1: Construction of the basic loop body -- By defining five operator units, constructing the DAG topology and configuring the execution logic of each operator, the construction of the basic loop body is completed; Step 2, Dual-wheel data flow management -- Based on the basic loop body of the constructed five-operator topology, establish a dual-wheel data transmission channel, standardize the flow rules, lifecycle and transmission range of different types of data, and control the data transmission and data interaction of the dual-wheel data transmission channel. At the same time, perform single-wheel data transmission verification and context consistency comparison. Step 3, Five-operator topology arrangement and expansion -- Based on the basic loop body and dual-wheel data transmission channel of the constructed five-operator topology, operators are dynamically added or removed, heterogeneous operators are replaced, and the topology is adjusted within the loop body between the Agent entry operator and the Agent exit operator; Step 4: Cyclic Scheduling of Topology -- Based on the basic loop body and dual-wheel data transmission channel, as well as the extension and optimization of the topology, the acyclic iterative operation of the SubDag subgraph is realized through the built-in cyclic scheduler. Cyclic semantics are realized without violating the definition of acyclic DAG, and the entire lifecycle execution of the five operator topology is uniformly managed.
[0023] Optionally, step 1 specifically involves constructing a standardized DAG basic loop with five operators, splitting the traditional loop into five independent DAG operators, with LoopStart as the only iteration entry point and LoopEnd as the only exit point, and connecting the planning, execution, and observation operators in between to form a basic unidirectional topology, fully reproducing the original ReAct execution logic, and all operators can be independently developed, replaced, and reused.
[0024] Optionally, the dual-wheel data transmission channel in step 2 includes a side data channel and a loop body context channel; The edge data channel connects the directed edges of the above operators and is used to transmit the temporary data payload of the current single iteration. The data flows strictly along the topological direction and does not support reverse data transmission. The loop context channel connects each operator to the shared data channel of the global context storage area. It is used to transmit system state variables that are persisted across rounds. The data runs through the entire lifecycle of the task and is retained when the loop is reset.
[0025] Optionally, the single-round data transmission verification is as follows: for each edge data, the execution engine performs verification before sending, specifically including four rules; The context consistency comparison is performed as follows: before the operator reads the loop body context, the execution engine calculates the context consistency hash.
[0026] Optionally, the dynamic addition and removal of operators in step 3 includes: adding intermediate operators and deleting operators; the replacement of heterogeneous operators includes: replacing planners, replacing observers, and replacing executors; the adjustment of topology includes: parallel branches, conditional branches, and nested loops.
[0027] Optionally, the five-operator topology arrangement extension in step 3 specifically includes the following steps: (1) DAG topology initialization and cycle domain analysis: After constructing the canvas meta-model, the canvas to DAG conversion is performed, and the sub-DAG is automatically initialized and the cycle domain is identified after the conversion. The canvas-based DAG conversion and sub-DAG initialization are completed, and the cycle domain hierarchy is divided. (2) Standardized heterogeneous operator replacement: By utilizing operator compatibility verification and loop detection based on in-degree subtraction, the entire chain of edge extraction, contract migration, type verification, ownership verification, topology reconstruction, and regression verification is completed, realizing accurate replacement and compliance verification of various heterogeneous operators; (3) Dynamic topology adaptive adjustment: Based on the basic graph addition and deletion operations, using sub-algorithms TB1, TB2 and TB3, sub-DAG initialization and operator compatibility verification and cycle detection rules based on in-degree subtraction are performed simultaneously to realize fine-grained topology reconstruction and contract update of parallel branches, conditional branches and nested loops.
[0028] Optionally, the specific execution process of the DAG topology initialization and cyclic domain analysis is as follows: Construct the canvas metamodel: Read the canvas model and map the canvas nodes, connections, and subgraph containers to DAG operators, DAG edges, and sub-DAG nodes, respectively, and complete the definition of the carrying capacity of node multi-class numbering, operator type, configuration, dependency, port, and metadata set.
[0029] Perform the canvas to DAG transformation: traverse the canvas nodes and connect them to construct the initial graph structure, mark the cyclic domain nodes and assign them numbers, distinguish between ordinary edges and loop edges within the sub-DAG, and generate operator contract instances containing read / write sets and port mappings.
[0030] Perform operator compatibility checks and loop detection: sequentially perform operator compatibility checks for type, topology, port, configuration read / write, and lifecycle; use the in-degree subtraction loop detection algorithm to detect loops, and loop closures are not included in the topology sorting.
[0031] Automatic initialization of sub-DAG: When creating sub-DAG operator nodes, a default five-operator topology is automatically generated, and parameter, node, canvas graph, and output configuration processing are completed. The standard DAG topology description is then output to the execution engine for loading.
[0032] Perform loop domain identification: identify loop start and end operators, filter loop dependency edges to construct loop domains, determine loop bodies and exit successor nodes; register nested loops to form a loop domain tree, verify nesting depth during orchestration, and determine illegal nesting if the threshold is exceeded.
[0033] Optionally, the standardized heterogeneous operator replacement process is specifically executed as follows: Edge extraction: Extract the set of input and output edges of the operator to be replaced, and sort out the data structure, port structure and data dependency relationship of its upstream and downstream edges.
[0034] Compliance verification: Conduct operator compatibility verification, verifying the five major constraints of port type, subgraph topology, port connection, field read / write, and global lifecycle in sequence, while completing the adaptation verification of operator contract and cyclic domain field ownership.
[0035] Contract migration: Customized adaptation rules are set for three types of heterogeneous operator replacement scenarios. The ports and read / write sets of the planning operator, observation operator and general execution operator are adapted and configured respectively. The exclusive parameters are injected through node configuration items to avoid loop body context.
[0036] Topology Reconstruction: Remove the operator to be replaced and its associated edges from the DAG topology, insert the new operator, and reconnect the upstream and downstream input and output edges to the corresponding ports of the new operator to complete the topology update.
[0037] Regression verification: Re-perform compatibility verification and in-degree subtraction cycle detection on the replaced topology. Valid loop back edges are not included in the verification. If the verification passes, submit the new topology. If there are conflicts, roll back the entire topology and output the error details.
[0038] Optionally, the cyclic scheduling of the topology in step 4 specifically includes the following steps: (1) Construct a basic cyclic scheduling model: Construct a standardized cyclic scheduling base adapted to acyclic DAG, realize iterative state persistence and temporary data isolation based on dual-wheel data channels, and realize business cyclic semantics through runtime reset mechanism; (2) Runtime DAG dependency edge type classification: DAG dependency edges are finely classified during execution to adapt to the differentiated dependency calculation rules of scenarios such as loop iteration, branch pruning, and nested scheduling, and to provide standardized constraint basis for node readiness determination and adjacency list scheduling; (3) Hierarchical executor scheduling: A hierarchical parallel execution mechanism is adopted to distinguish between ordinary topology and cyclic topology and adapt different adjacency lists. The hierarchical iterative scheduling is completed by multi-threaded parallelism and the underlying adjacency list algorithm is linked to achieve efficient execution. (4) Circular adjacency list scheduling: Maintain a circular doubly linked list, ready nodes and stable dependency states, accurately determine the ready state of nodes according to dependency type rules, and support iterative reset and branch pruning capabilities; (5) Loop Forced Exit Mechanism: The two-condition forced exit rule is used to prevent infinite loops, and the exit status and reason marking are standardized to ensure that the iterative scheduling is safe and controllable; (6) Nested loop scheduling mechanism: Based on the single-layer loop scheduling capability, combined with the loop domain tree and nested sub-DAG, the inner and outer loop states are isolated, independently scheduled, and exited in layers, supporting complex multi-layer nested topology iteration.
[0039] This invention also provides a system for the visual orchestration and flexible expansion of AI agents, specifically including: a basic loop body construction module, a dual-wheel data flow module, a five-operator topology structure orchestration expansion module, and a topology structure loop scheduling module; The basic loop body construction module is used to construct a DAG topology by defining five operator units, and to complete the construction of the basic loop body after configuring the execution logic of each operator. The dual-wheel data flow management module, based on the constructed five-operator topology, establishes a dual-wheel data transmission channel, standardizes the flow rules, lifecycle, and transmission range of different types of data, and controls the data transmission and interaction within the dual-wheel data transmission channel. Simultaneously, it performs single-wheel data transmission verification and context consistency comparison. The five-operator topology arrangement extension module, based on the basic loop body of the constructed five-operator topology and the dual-wheel data transmission channel, performs dynamic addition and subtraction of operators, replacement of heterogeneous operators, and adjustment of topology within the loop body between the Agent entry operator and the Agent exit operator; The cyclic scheduling module of the topology structure, based on the basic loop body and dual-wheel data transmission channel, as well as the extension and optimization of the topology structure, realizes the acyclic iterative operation of the SubDag subgraph through the built-in cyclic scheduler, realizes the cyclic semantics without violating the definition of DAG acyclicity, and uniformly manages the entire life cycle execution of the five operator topology structure.
[0040] The method of the present invention has the following advantages: (1) The "reasoning → execution → observation" loop, which is fixed in the code, is opened and broken down into five operators that can be visualized and configured on the "DAG" canvas. Business personnel (non-technical personnel) can intuitively understand and adjust the execution flow of AI-Agent by dragging and dropping operators and configuring parameters, without writing code.
[0041] (2) Through the design of five basic operator framework + flexible arrangement extension, while ensuring the availability of the basic "ReAct" mode, it supports adding, subtracting, replacing and adjusting the topology of operators in the loop body, realizing various AI Agent modes such as "Chain-of-Thought", "ReWOO", "Task-and-Tool", "Reflection" and "Mixture-of-Agents" without modifying the source code.
[0042] (3) By using a dual-wheel data flow of edge data and loop body context, parameter passing between each step and cross-wheel state management are separated. Each operator can be reused and replaced independently through explicit operator contract interaction, which improves the modularity and scalability of the system.
[0043] (4) The loop body context is uniformly maintained by the "DAG" engine, and each operator reads and writes as needed, avoiding data races and unauthorized read / write problems caused by multiple reads and writes of state variables in high code. Attached Figure Description
[0044] Figure 1 A flowchart illustrating the visual orchestration and flexible expansion methods for AI intelligent agents; Figure 2 This is a schematic diagram of the basic framework of the five operators; Figure 3 Extended diagrams for flexible arrangement; Figure 4 This is a schematic diagram of a dual-wheel data flow. Figure 5 This is a flowchart of Example 2; Figure 6 This diagram illustrates the visual arrangement and flexible expansion of AI agents. Detailed Implementation
[0045] The technical solution of the present invention will be clearly and completely described below with reference to specific embodiments. However, those skilled in the art should understand that the embodiments described below are only for illustrating the present invention and should not be regarded as limiting the scope of the present invention. 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.
[0046] To address the aforementioned shortcomings of high-code AI agent implementations, this invention provides a system for the visual orchestration and flexible expansion of AI agents. This system improves the loop of the high-code "ReAct" method into a programmable method based on a five-operator DAG. Simultaneously, it achieves cyclic semantics while maintaining the acyclic constraint of the DAG. Furthermore, the visual orchestration mode of the AI agent supports the integration of various other operators.
[0047] First, a basic loop operator architecture is constructed. Then, data transmission is achieved through a dual-wheel data flow. Subsequently, based on the basic architecture and data flow capabilities, operators and topologies are flexibly expanded. Finally, the overall iterative lifecycle is managed through a loop scheduler, forming a complete, scalable, and visually configurable AI Agent operating system.
[0048] Specifically, the method for improving the high-code "ReAct" loop into a programmable five-operator DAG involves a fixed topology consisting of five operators (functional modules): "LoopStart," "ReactPlanner," "ReactExecutor," "ReactObserver," and "LoopEnd." This method migrates the loop control logic from the operator layer to the DAG engine scheduling layer. This fixed structure of five operators implements a basically usable "ReAct" pattern while providing a foundation for flexible orchestration. The "LoopStart" and "LoopEnd" operators must remain unchanged and cannot be added to or removed.
[0049] The method for achieving cyclic semantics while maintaining the acyclic constraint of the DAG is as follows: through subgraph ("SubDag") wrapping and loop scheduling at the engine scheduling layer, the iterative execution of the AI Agent can run on the standard DAG orchestration framework without violating the acyclic definition of the DAG. Acyclic unidirectional data flow is maintained at the operator layer, and loop control is driven by the scheduler outside the subgraph boundary, with the two completely decoupled.
[0050] The visual orchestration mode of the AI Agent supports the access of various other operators. Specifically, within the loop body between "LoopStart" and "LoopEnd", five operators can be flexibly added, removed, and replaced. Various AI Agent modes can be orchestrated and controlled through a dual-wheel data flow of edge data and loop body context, transforming the AI Agent from a "high-code black box" into a "visual and configurable" form.
[0051] This invention provides a method for visual orchestration and flexible expansion of AI agents. The method first constructs a basic loop operator architecture, then realizes data transmission through a dual-wheel data flow, and then realizes flexible expansion of operators and topology based on the basic architecture and data flow capabilities. Finally, the overall iterative lifecycle is managed through a loop scheduler, forming a complete, scalable, and visually configurable AI Agent operation system.
[0052] like Figure 1 As shown, it specifically includes: Step 1: Building the basic loop body
[0053] By defining five operator units, constructing a DAG topology, and configuring the execution logic of each operator, the basic loop body is constructed.
[0054] Specifically, a standardized DAG basic loop with five operators is constructed. The traditional loop is broken down into five independent DAG operators, with LoopStart as the only iteration entry point and LoopEnd as the only exit point. The planning, execution, and observation operators are connected in between to form a basic unidirectional topology, which fully reproduces the original ReAct execution logic. All operators can be developed, replaced, and reused independently.
[0055] The loop body module includes an Agent entry operator (LoopStart), a planning operator (ReactPlanner), an execution operator (ReactExecutor), an observation operator (ReactObserver), and an Agent exit operator (LoopEnd).
[0056] The five operators are unidirectionally connected via directed edges (data flow channels) in the order of LoopStart → ReactPlanner → ReactExecutor → ReactObserver → LoopEnd.
[0057] The Agent entry operator is the unique entry node of the subgraph (SubDag), responsible for initializing the working memory at the beginning of each iteration and constructing the data payload for this round.
[0058] The Agent entry operator reads the persistent global state data across rounds from the loop body context channel and writes the assembled payload into the LoopStart→ReactPlanner edge data channel for downstream planning operators to read. Simultaneously, it writes the updated iteration counter back to the context shared channel.
[0059] The planning operator corresponds to the "planning" stage in the traditional ReAct model, and it is the decision node of the AI Agent.
[0060] The planning operator reads the payload of the current round from the edge data channel. The payload is constructed by the upstream LoopStart. It reads the session history (Message list) accumulated across rounds and the tool schema definition from the loop body context channel, and writes the tool call instruction list and / or the final answer into the ReactPlanner→ReactExecutor edge data channel for downstream execution operators to read. If the tool call list is empty (i.e., no tool call is required), the final answer is also written into the edge data channel as pass-through data when the executor is short-circuited.
[0061] The execution operator corresponds to the "Acting / Execution" stage in the traditional ReAct mode. It is the specific executor that AIAgent calls external tools to obtain data.
[0062] The execution operator reads the tool call list (ToolCalls) output by the upstream planning operator from the edge data channel. If the planning operator determines that no tool call is needed, the list is empty, and the encapsulated tool execution result list is written to the edge data channel of ReactExecutor→ReactObserver for downstream observation operators to read and evaluate.
[0063] The observation operator corresponds to the "Observing" phase in the traditional ReAct model. It is the decision node where the AI Agent evaluates the execution results and decides on the next action.
[0064] The observation operator reads the tool execution result list (ToolResults) output by the upstream execution operator or the final answer passed through (short-circuit mode) from the edge data channel. The observation operator also reads the current iteration number and the maximum iteration number from the loop body context channel. Then, it writes the evaluation flag (exit_flag, with the value "success" / "continue" / "failure") and evaluation description into the edge data channel of ReactObserver→LoopEnd.
[0065] The Agent exit operator is the sole exit node of the subgraph (AgentCycle SubDag), responsible for iteratively terminating arbitration and exiting data assembly.
[0066] The Agent exit operator reads the evaluation flag (exit_flag, with values of "success" / "continue" / "failure") and evaluation description output by the upstream observer operator from the edge data channel. In the termination path, the Agent exit operator returns the assembled exit data to the parent process (external caller). In the continue path, the Agent exit operator sends a loopback signal to the loop scheduler.
[0067] The loop from LoopEnd to LoopStart is scheduled by the loop scheduler of the "DAG" engine, serving as an implicit special edge between two special operators. This is key to achieving loop semantics while maintaining the acyclic definition of "DAG": loop transitions are handled by the engine scheduling layer, while the operator layer only perceives unidirectional data flow. Step 2: Dual-wheel data flow management
[0068] like Figure 4 As shown, based on the constructed five-operator topology, a dual-wheel data transmission channel is established to standardize the flow rules, lifecycle, and transmission range of different types of data, and to control the data transmission and interaction within the dual-wheel data transmission channel. Simultaneously, single-wheel data transmission verification and context consistency comparison are performed.
[0069] Specifically, a dual-wheel data flow is employed for hierarchical data management. The edge data channel carries temporary payloads between operators in a single wheel, propagating unidirectionally along the topology. The loop body context is uniformly managed by the engine, storing persistent global data such as session history, iteration counts, and intermediate results across wheels. Based on the constructed five-operator topology, a dual-wheel data transmission channel is established to standardize the flow rules, lifecycles, and transmission ranges of different data types, and to control the data transmission and interaction within the dual-wheel data transmission channel.
[0070] The dual-wheel data transmission channel includes a side data channel and a loop context channel.
[0071] The edge data channel connects the directed edges of the aforementioned operators and is used to transmit the temporary data payload for the current single iteration. Data flows strictly along the topological direction (LoopStart→Planner→Executor→Observer→LoopEnd) and reverse data transmission is not supported. The specific data content transmitted by the edge data channel at each stage includes: the current payload, tool invocation instructions, tool execution results, evaluation information, etc.
[0072] The edge data carries temporary data passed between adjacent operators during the current iteration and is stored in the DAG intermediate result table as a structured data array. Edge data includes fields such as edge identifier, source node identifier, target node identifier, payload type, data content, creation time, and link tracing identifier. The data content is a structured data object carrying actual business data. The content carried by each type of edge data is as follows: the loop start operator payload carries fields such as iteration count, maximum iteration count, context, task objective, session state, and tools; the planning output carries tool calls, final answers, assistant messages, and session state version numbers; the execution output carries tool execution results, workflow, and statistics; and the observation output carries evaluation conclusions, answers, suggestions, and the next round of tool calls.
[0073] The loop body context channel is a shared data channel connecting each operator to the global context storage area. It is used to transmit system state variables that are persisted across rounds. The data runs throughout the entire lifecycle of the Agent task and is retained when the loop is reset. The specific data transmitted by the loop body context channel includes: control information, reflux data, user information, token statistics, etc.
[0074] The loop body context is maintained by the DAG execution engine according to the loop domain identifier, carrying persistent state variables across rounds. This is recorded as the loop runtime state, including: loop domain number, current iteration count, maximum iteration count, exit flag, forced exit flag, exit reason, external data, context data, exit data, query content, system prompts, tool and MCP service identifiers, session state, etc. The session state update mechanism automatically backs up old values and increments the version number when writing session state, and supports reverting to the previous version of session state when reading session state.
[0075] Meanwhile, ownership and read / write permissions are defined for each field in the loop runtime state, with the following specific rules: (1) The loop field number and the current iteration number are written by the DAG engine, and the five operators are read-only; (2) The maximum iteration number is written by the loop start operator in the first round, and the remaining operators are read-only; (3) Exit-related data is written only by the loop end operator, and the DAG engine can read it; (4) The initial loop external data is read and written by the loop start operator in the first round, and the planning operator is read-only; (5) The context data is read by the loop start operator and written by the loop end operator; (6) The task objective is written by the loop start operator in the first round, and the planning operator and execution operator are read-only. (7) System prompts are written in the first round by the loop start operator, while the planning and observation operators are read-only; (8) Tool and external tool service identifiers are written in the first round by the loop start operator, while the planning, execution, and observation operators are read-only; (9) Session state is written in the first round by the loop start operator, while the planning and observation operators are conditionally written, meaning that only one of them is actually executed within the same iteration. During orchestration, the operator contract declares the writer for this round and verifies its uniqueness according to rule 4. During runtime, the execution engine uses field-level write locks for mutual exclusion, the execution operator is transparently read-only, and the loop end operator is read-only. The above rules follow the single writer principle for session state: at most one operator writes per round.
[0076] In addition, the single-round data transmission verification is as follows: for each edge data, the execution engine performs verification before sending. Specifically, it includes four rules: non-empty verification, type verification, version verification, and size verification: Rule E1 (non-empty verification): data content fields cannot be empty, and required fields must exist; Rule E2 (type verification): the type of each field in the data content must be consistent with the type declared by the target operator input port; Rule E3 (version verification): the version number of edge data containing the session state version number must not be less than the previous version to prevent out-of-order processing; Rule E4 (size verification): the size of the edge data must not exceed a preset threshold.
[0077] The context consistency comparison is as follows: Before the operator reads the loop body context, the execution engine calculates the context consistency hash: First, it extracts the set of fields to be compared, F={f_1,...,f_k}, from the loop runtime state; second, it calculates the normalized string representation of each field f_i; then, it concatenates the normalized strings of each field sequentially and calculates the hash to obtain the consistency hash value H; finally, it compares H with the hash value recorded when the operator last wrote. If they are equal or the field version number increments, the consistency is passed; otherwise, a context inconsistency exception is triggered. Step 3: Five-operator topology arrangement and expansion
[0078] Based on the basic loop body of the constructed five-operator topology and the dual-wheel data transmission channel, the loop body between the Agent entry operator and the Agent exit operator performs dynamic addition and subtraction of operators, replacement of heterogeneous operators, and adjustment of the topology.
[0079] This allows users to complete the arrangement by dragging and configuring a visual DAG canvas, with the underlying layer automatically generating the corresponding topology definition file. Users do not need to write code, enabling personalized and scenario-based customization of the AI Agent.
[0080] Specifically, such as Figure 3 As shown, the following flexible orchestration extensions are supported within the loop body between the loop start (Agent entry) operator and the loop end (Agent exit) operator: dynamic addition and removal of operators, replacement of heterogeneous operators, and adjustment of topology.
[0081] The dynamic addition and subtraction of the operator includes: Add intermediate operators: Other operators provided by the Agent can be added. For example, a human approval operator can be inserted after "ReactPlanner" and before "ReactExecutor"; a reflection optimization operator can be inserted after "ReactObserver" and before "LoopEnd".
[0082] Remove Operator: For simple scenarios (such as single-round question and answer, where no external tools need to be called), you can directly short-circuit "ReactExecutor" and "ReactObserver", and configure the edge data to flow directly from "ReactPlanner" to "LoopEnd". In this case, the output of Planner is directly used as the final answer.
[0083] The heterogeneous operator replacement includes: Planner replacement: Replace the large language model-based "ReactPlanner" with a rule-based planner, suitable for deterministic tasks with fixed processes.
[0084] Observer replacement: Replacing the large language model-based "ReactObserver" with a regular expression matching-based evaluator can improve evaluation efficiency and accuracy.
[0085] Executor replacement: Replace the generic "ReactExecutor" with a domain-specific executor, such as a data processing domain-specific executor or a parallel executor that supports concurrent calls.
[0086] The topology adjustment includes: Parallel branching: Multiple independent tool calls are distributed to multiple parallel "ReactExecutor" instances for simultaneous execution, and finally, all execution results are aggregated through the Merger operator and sent to "ReactObserver". This adjustment can significantly reduce the total execution time in multi-tool call scenarios.
[0087] Conditional branching: Based on the intent classification results output by "ReactPlanner", it dynamically routes to different execution paths. For example: simple queries take the fast path - answer directly and skip tool calls; complex queries take the standard path - execute all three stages.
[0088] Nested Loops: Inside "ReactExecutor", another loop body (AgentCycle) consisting of five operators is deployed to handle complex tool calls that require multiple rounds of execution. In each iteration of the outer loop, the inner subgraph may execute multiple sub-iterations, forming a two-layer loop semantics.
[0089] The five-operator topology arrangement and extension specifically includes the following steps: 1. DAG Topology Initialization and Cyclic Domain Analysis After constructing the canvas metamodel, the canvas-to-DAG conversion is performed, and after the conversion, the sub-DAGs are automatically initialized and the cyclic domains are identified. This completes the canvas-based DAG conversion and sub-DAG initialization, and performs the cyclic domain hierarchy partitioning.
[0090] Specific execution process: (1) Constructing the canvas meta-model: Read the canvas model, map the canvas nodes to DAG operators, the canvas connections to DAG edges, the canvas subgraph containers to sub-DAG nodes, and the node configuration parameters to the configuration items in the operator configuration; Each canvas node contains the node number at the execution level, the image node number at the canvas level, the operator type, the operator configuration items, the dependency configuration set, the output port, and the metadata set; (2) Perform canvas to DAG transformation: Traverse all nodes and connections in the canvas model to construct the initial graph structure; identify Loop subgraph operators, mark the nodes in the sub-DAG corresponding to the operator as cycle domain nodes and assign cycle domain numbers; classify the edges in the sub-DAG, distinguishing between ordinary edges pointing from the loop start operator through the planning operator, execution operator, and observation operator to the loop end operator and loop edges pointing from the loop end operator to the loop start operator; generate an operator contract instance for each operator node containing read set, write set, input port mapping, and output port mapping; (3) Perform operator compatibility verification and cycle detection: Call the operator compatibility verification algorithm and execute type matching verification, operator topology verification, port connection verification, configuration read / write verification and lifecycle verification in sequence; call the cycle detection algorithm based on in-degree subtraction, calculate the in-degree of each node, and traverse layer by layer starting from the node with an in-degree of zero. If the number of nodes traversed is equal to the total number of nodes, it is determined that the topology is acyclic. Among them, loop edges are not used as ordinary edges in the topology sorting. (4) Automatic initialization of sub-DAG: When creating sub-DAG operator nodes, the default five-operator topology is automatically generated, parameters are created in sequence, nodes are created in a fixed order, a canvas graphic description is generated, the output configuration is saved, and a standard DAG topology description is output for the execution engine to load. (5) Perform loop domain identification: identify the node set of the loop start operator and the loop end operator, construct the downstream node mapping, filter the loop dependency edges and construct the loop domain for each pair of valid loop edges, calculate the loop body node and the exit successor node; for nested loops, register the sub-loop domain to the outer loop domain and record the parent loop domain number to form a loop domain tree, and check whether the nesting depth exceeds the preset threshold during the orchestration period. If it exceeds the threshold, it is determined to be an illegal nesting.
[0091] 2. Standardized Heterogeneous Operator Replacement By utilizing operator compatibility verification and loop detection based on in-degree subtraction, the entire chain of edge extraction, contract migration, type verification, ownership verification, topology reconstruction, and regression verification is completed, enabling accurate replacement and compliance verification of various heterogeneous operators.
[0092] Specific execution process: (1) Edge extraction: Extract the set of input edges and the set of output edges of the operator to be replaced, and sort out the data structure, port structure and data dependency relationship of the upstream and downstream edges of the operator to be replaced; (2) Compliance verification: Perform operator compatibility verification, and verify the five major constraint rules of port type matching, subgraph topology, port connection, field read and write, and global life cycle in sequence to complete the adaptation verification of operator contract and cyclic domain field ownership; (3) Contract migration: Adapt replacement rules for three types of replacement scenarios respectively. When replacing the planning operator based on the large language model with the rule-based planner, declare the input port and output port with the same name. The read set contains the task target, tool and read-only session state, and the write set is empty. When replacing the observation operator based on the large language model with the rule-based evaluator, declare the input port and output port with the same name. The read set is the read-only session state, the write set is the conditional write session state, and declare that it is mutually exclusive with the planning operator. When replacing the general execution operator with the domain-specific execution engine, declare the input port and output port with the same name. The read set is the read-only tool and external tool service identifier. Domain-specific credentials and connection parameters are injected through node configuration items and do not enter the loop body context. (4) Topology reconstruction: Delete the operator to be replaced and its associated edges in the DAG topology, insert a new operator and reconnect the source end of the input edge to the corresponding input port of the new operator, and reconnect the target end of the output edge to the corresponding output port of the new operator; (5) Regression verification: Re-execute operator compatibility verification and cycle detection based on in-degree subtraction on the replaced topology to determine that the topology has no static loops and that legal loop back edges are not included in the verification; if the verification passes, submit the replaced topology; if there is a conflict, roll back the entire amount and output the error details.
[0093] 3. Dynamic topology adaptive adjustment Based on the basic graph addition and deletion operations, sub-algorithms TB1 (parallel branch addition), TB2 (conditional branch addition), and TB3 (nested loop addition) are used to simultaneously perform sub-DAG initialization, operator compatibility verification, and cycle detection rules based on in-degree subtraction, thereby achieving refined topology reconstruction and contract update of parallel branches, conditional branches, and nested loops.
[0094] Specific execution process: For standard orchestration scenarios, node and edge addition, deletion, and modification operations are directly executed, and operator contracts are updated synchronously. For three types of complex topology expansion scenarios, a standardized sub-algorithm is executed: (1) Parallel branch expansion: Execute the parallel branch to add sub-algorithm TB1, verify the fan-out capability of the source operator, construct multiple parallel branches and port mapping, summarize the results by merging operators, and ensure that there is no conflict in branch reading and writing according to the port connection rules and contract reading and writing rules.
[0095] The parallel branch addition sub-algorithm TB1 is as follows: The inputs are a branch source operator u (e.g., a planning operator), a set of parallel operators {v_1,...,v_k} (e.g., multiple execution operators), and a merging operator m. Step TB1-1: Verify that the output port of u meets the port connection rules, allowing k outgoing edges. Step TB1-2: Establish an input port mapping for each v_i, fanning out the corresponding output port of u to the input ports of each v_i, generating k parallel edges carrying the same planning output copy. Step TB1-3: Insert the merging operator m, connecting the output ports of each v_i to different input ports of m (one incoming edge per port), and m merges the tool execution results of each v_i according to the edge identifier into a summary execution output. Step TB1-4: Update the contract: the contract of u remains unchanged, the read set of each v_i is a read-only tool, and the write set is empty; the read set of m is the union of the output fields of each v_i, and the write set is empty. Step TB1-5: Perform compatibility checks and loop detection; if successful, commit; otherwise, rollback.
[0096] The port connection rule states that each input port can be connected to at most one incoming edge, and each output port can be connected to multiple outgoing edges (for parallel branching).
[0097] The contract read / write rules check the writer set and reader set of each field in the loop body context to prevent multiple operators from writing to the same field at the same time (unless explicitly declared as aggregate write). For fields declared as conditional writes (such as session state), the uniqueness of the writer is verified within the same round of iteration.
[0098] (2) Conditional branch expansion: Execute the conditional branch to add sub-algorithm TB2, insert conditional judgment operators and mark branch predicates to realize fast and slow path splitting and short-circuit execution, mark conditional dependency attributes to adapt to runtime pruning, and ensure port type compatibility according to type matching rules. Third, nested loop expansion: Execute the nested loop to add sub-algorithm TB3, perform sub-DAG initialization to generate inner standard topology, construct a loop domain tree based on the nested loop domain identification method, and configure inner and outer context isolation and outer field read-only shared constraints. After all topology adjustments are completed, uniformly update operator contracts, field dependencies, and ownership constraints.
[0099] The conditional branch addition sub-algorithm TB2 is specifically defined as follows: the input consists of a branch source operator u (such as a planning operator), a condition judgment operator c, a set of branch operators (fast branch operator and standard branch operator), and a branch condition expression. Step TB2-1: Insert a conditional operator c after u, and reconnect the original output edge of u to the input port of c; Step TB2-2: Connect each conditional output port of c to the input ports of the fast branch operator and the standard branch operator respectively, and label each outgoing edge with a conditional predicate (e.g., if the output type is a simple query, take the fast path; if it is a complex query, take the standard path); Step TB2-3: Reconnect the branch ends: the fast path short-circuit execution operator and the observation operator are directly connected to the loop termination operator, and the standard path maintains the original operator chain; Step TB2-4: Contract update and dependency marking: the write set of c is empty, the output contains the branch selection flag, the input dependencies of the short-circuited operators are marked as conditional dependencies, and the scheduler prunes the branches according to the branch selection results during runtime; Step TB2-5: Verify that the output type of each branch end is compatible with the input type of the subsequent operator, perform compatibility checks and cycle detection, and commit if successful, otherwise roll back.
[0100] The nested loop addition sub-algorithm TB3 is specifically defined as follows: the input is the host operator h (such as the execution operator) and the inner sub-DAG definition. Step TB3-1: Create inner sub-DAG nodes and call the sub-DAG automatic initialization service to generate a default five-operator topology; Step TB3-2: Assign independent cycle domain numbers to the inner cycle domains, register the parent cycle domain number as the outer cycle domain identifier, and form a cycle domain tree; Step TB3-3: Reconnect the input edge at position h to the input port of the inner sub-DAG, and connect the exit port of the inner loop termination operator to the target operator of the original output edge at position h; Step TB3-4: Context isolation and read-only sharing: The inner loop runtime state is maintained independently, and the inner operator can access specified fields of the outer loop body context (such as read-only copies of task targets and session states) in read-only mode, but cannot directly write outer fields. This constraint is recorded in the operator contract and verified by the contract read / write rules; Step TB3-5: Perform compatibility verification and cycle detection on the inner subgraph, and participate in the outer topology verification as a single node. If successful, commit; otherwise, rollback.
[0101] The nested loop domain identification method is as follows: If a pair of loop start operators and loop end operators are both located in the loop body node set of another loop domain, the newly constructed loop domain is registered as a subdomain of the outer loop domain and the parent loop domain number is recorded. Each loop domain forms a loop domain tree. During the orchestration period, the nesting depth is checked to ensure that it does not exceed a preset threshold (such as 3 levels). If it exceeds the threshold, it is determined to be an illegal nesting and conflict information is output.
[0102] The type matching rule is that the type of the source operator output port of any edge must be consistent with the type of the target operator input port or can be implicitly converted. Step 4: Circular scheduling of the topology
[0103] Based on the basic loop body and dual-wheel data transmission channel, as well as the expansion and optimization of the topology, the acyclic iterative operation of the SubDag subgraph is realized through the built-in loop scheduler. The loop semantics are realized without violating the definition of acyclic DAG, and the execution of the five operator topology structure is uniformly managed throughout its entire life cycle.
[0104] Specifically, when the subgraph starts, the context sharing channel is initialized and the loop entry operator is activated. Each operator is scheduled to execute in the topological order. When the loop exit operator's loop closure event is received, the loop closure reset operation is performed—all persistent data of the loop body context channel is retained, all temporary data of the edge data channel is cleared, and then the loop entry operator is reactivated to enter the next iteration.
[0105] The cyclic scheduling of the topology specifically includes the following steps: 1. Construct a basic round-robin scheduling model A standardized cyclic scheduling base adapted to acyclic DAG is constructed. It achieves iterative state persistence and temporary data isolation based on dual-wheel data channels, and realizes business cyclic semantics through a runtime reset mechanism.
[0106] Specifically, during subgraph initialization, a context-shared channel and a temporary edge data channel are created, node dependencies are initialized, and the loop entry operator is activated. After a single iteration, a loop reset is performed, preserving the global iteration context data, clearing the temporary edge transmission data for this round, and restarting the entry operator to achieve sustainable iterative execution of acyclic topologies.
[0107] 2. Runtime DAG Dependency Edge Type Partitioning During execution, DAG dependency edges are finely classified to adapt to different dependency calculation rules in scenarios such as loop iteration, branch pruning, and nested scheduling, providing standardized constraints for node readiness determination and adjacency list scheduling.
[0108] During system runtime, topology dependencies are categorized into five core types, with each type participating in scheduling computation differently: Ordinary DAG dependency: Regular node dependency, participating in readiness determination and adjacency list scheduling throughout the process.
[0109] Cyclic backflow edges: Cyclic port dependencies between start and end operators, only carrying iterative semantics, not participating in ordinary dependency calculations, ensuring that the DAG is statically acyclic.
[0110] Intra-loop dependency: Same as node dependency within the same loop domain, only takes effect in a single iteration, and the state is reset and updated with each iteration.
[0111] Stable dependencies across loops: Dependencies of outer nodes on inner loop nodes remain in a ready state across loops without repeated validation.
[0112] Exit gate dependency: A dependency where the loop exit points to a node outside the domain. It is only activated after the loop has completely exited.
[0113] 3. Hierarchical Executor Scheduling A hierarchical parallel execution mechanism is adopted, which distinguishes between ordinary topology and cyclic topology and adapts different adjacency lists. It relies on multi-threaded parallelism to complete hierarchical iterative scheduling and links the underlying adjacency list algorithm to achieve efficient execution.
[0114] Specific steps: (1) Adaptively select a normal adjacency list or a circular adjacency list based on whether the topology contains a circular structure.
[0115] (2) Initialize the thread pool and the main execution loop, and continuously monitor the ready node.
[0116] (3) Execute all currently ready executable nodes in batches at each layer in parallel.
[0117] (4) The control logic for determining whether to continue the loop or exit the loop based on the execution result of this round.
[0118] (5) Dynamically construct sub-adjacency lists and schedule external associated nodes that depend on the circular node.
[0119] (6) Process the branch pruning logic, update the node dependency state and the next round of ready set.
[0120] (7) Continue to iterate in layers until the topology is completed or the task is terminated.
[0121] 4. Circular adjacency list scheduling It maintains a circular doubly linked list, ready nodes, and stable dependency states, accurately determines the ready state of nodes based on dependency type rules, and supports iterative reset and branch pruning capabilities.
[0122] Specific steps: (1) The first execution selects all starting nodes with an in-degree of 0 as the first execution set.
[0123] (2) After the node is executed, update the stable dependency ready state and handle the pruned nodes; reset the intra-domain dependency or open the exit gate and release the extra-domain node according to the loop result.
[0124] (3) Aggregate all fully ready but uncommitted nodes and deliver them to the top-level scheduler as executable nodes for the next round.
[0125] 5. Looping forced exit mechanism By using a two-condition forced exit rule to prevent infinite loops and standardizing exit status and reason markers, iterative scheduling can be made safe and controllable.
[0126] Specific rules: Iteration Exceeds Limit: When the number of iterations reaches the maximum threshold, the iteration is forcibly terminated and marked as "Maximum number of iterations reached".
[0127] Custom exit condition: When the forced exit function is enabled and the running status meets the preset conditions, the program will exit automatically and mark the corresponding reason.
[0128] Both mechanisms unify and solidify the cycle termination state, avoiding the risk of a dead loop.
[0129] 6. Scheduling mechanism for nested loops Based on single-layer loop scheduling capability, combined with loop domain tree and nested sub-DAG, it realizes the isolation of inner and outer loop states, independent scheduling, and layered exit, supporting complex multi-layer nested topology iteration.
[0130] Specific mechanisms: The nested sub-DAG is generated by the TB3 algorithm. During the orchestration period, the parent-child relationship of the loop domain is registered, the nesting depth is checked, and illegal multi-level nesting is blocked.
[0131] The inner and outer loops maintain their runtime states independently, and the inner output is shared controllably with the outer context according to field ownership rules, thus achieving state isolation.
[0132] Layered independent scheduling and exit: Inner layer iteration, reset, and forced exit only apply to the inner layer and do not affect the outer layer; outer layer iteration will reset the state of the entire domain, including the inner layer. Each layer independently manages the iteration and exit logic.
[0133] This approach progresses through four steps: infrastructure construction, data capability support, flexible functional expansion, and full-process scheduling and control. It fully realizes the visualization, low-code, scalability, and iterative upgradeability of the traditional high-code ReAct AI Agent.
[0134] This invention also provides a system for the visual orchestration and flexible expansion of AI agents, such as... Figure 6 As shown, it specifically includes: a basic loop body construction module, a dual-wheel data flow module, a five-operator topology structure arrangement extension module, and a topology structure loop scheduling module.
[0135] The basic loop body construction module is used to construct a DAG topology by defining five operator units, and then configure the execution logic of each operator to complete the construction of the basic loop body.
[0136] Specifically, a standardized DAG basic loop with five operators is constructed. The traditional loop is broken down into five independent DAG operators, with LoopStart as the only iteration entry point and LoopEnd as the only exit point. The planning, execution, and observation operators are connected in between to form a basic unidirectional topology, which fully reproduces the original ReAct execution logic. All operators can be developed, replaced, and reused independently.
[0137] The dual-wheel data flow management module, based on the constructed five-operator topology, establishes a dual-wheel data transmission channel, standardizes the flow rules, lifecycle, and transmission range of different types of data, and controls the data transmission and interaction within the dual-wheel data transmission channel. Simultaneously, it performs single-wheel data transmission verification and context consistency comparison.
[0138] Specifically, a dual-wheel data flow is employed for hierarchical data management. The edge data channel carries temporary payloads between operators in a single wheel, propagating unidirectionally along the topology. The loop body context is uniformly managed by the engine, storing persistent global data such as session history, iteration counts, and intermediate results across wheels. Based on the constructed five-operator topology, a dual-wheel data transmission channel is established to standardize the flow rules, lifecycles, and transmission ranges of different data types, and to control the data transmission and interaction within the dual-wheel data transmission channel.
[0139] The five-operator topology arrangement extension module, based on the basic loop body of the constructed five-operator topology and the dual-wheel data transmission channel, performs dynamic addition and subtraction of operators, replacement of heterogeneous operators, and adjustment of topology within the loop body between the Agent entry operator and the Agent exit operator.
[0140] The five-operator topology arrangement extension module specifically executes the following process: 1. DAG Topology Initialization and Cyclic Domain Analysis After constructing the canvas metamodel, the canvas-to-DAG conversion is performed, and after the conversion, the sub-DAGs are automatically initialized and the cyclic domains are identified. This completes the canvas-based DAG conversion and sub-DAG initialization, and performs the cyclic domain hierarchy partitioning.
[0141] 2. Standardized Heterogeneous Operator Replacement By performing operator compatibility checks and ring detection based on in-degree subtraction, the entire chain of edge extraction, contract migration, type verification, ownership verification, topology reconstruction, and regression verification is completed, enabling accurate replacement and compliance verification of various heterogeneous operators.
[0142] 3. Dynamic topology adaptive adjustment Based on the basic graph addition and deletion operations, sub-algorithms TB1 (parallel branch addition), TB2 (conditional branch addition), and TB3 (nested loop addition) are used to simultaneously perform sub-DAG initialization, operator compatibility verification, and cycle detection rules based on in-degree subtraction, thereby achieving refined topology reconstruction and contract update of parallel branches, conditional branches, and nested loops.
[0143] The cyclic scheduling module of the topology structure, based on the basic loop body and dual-wheel data transmission channel, as well as the extension and optimization of the topology structure, realizes the acyclic iterative operation of the SubDag subgraph through the built-in cyclic scheduler, realizes the cyclic semantics without violating the definition of DAG acyclicity, and uniformly manages the entire life cycle execution of the five operator topology structure.
[0144] The cyclic scheduling module of the topology structure specifically executes the following process: 1. Construct a basic round-robin scheduling model A standardized cyclic scheduling base adapted to acyclic DAG is constructed. It achieves iterative state persistence and temporary data isolation based on dual-wheel data channels, and realizes business cyclic semantics through a runtime reset mechanism.
[0145] 2. Runtime DAG Dependency Edge Type Partitioning During execution, DAG dependency edges are finely classified to adapt to different dependency calculation rules in scenarios such as loop iteration, branch pruning, and nested scheduling, providing standardized constraints for node readiness determination and adjacency list scheduling.
[0146] 3. Hierarchical Executor Scheduling A hierarchical parallel execution mechanism is adopted, which distinguishes between ordinary topology and cyclic topology and adapts different adjacency lists. It relies on multi-threaded parallelism to complete hierarchical iterative scheduling and links the underlying adjacency list algorithm to achieve efficient execution.
[0147] 4. Circular adjacency list scheduling It maintains a circular doubly linked list, ready nodes, and stable dependency states, accurately determines the ready state of nodes based on dependency type rules, and supports iterative reset and branch pruning capabilities.
[0148] 5. Looping forced exit mechanism By using a two-condition forced exit rule to prevent infinite loops and standardizing exit status and reason markers, iterative scheduling can be made safe and controllable.
[0149] 6. Scheduling mechanism for nested loops Based on single-layer loop scheduling capability, combined with loop domain tree and nested sub-DAG, it realizes the isolation of inner and outer loop states, independent scheduling, and layered exit, supporting complex multi-layer nested topology iteration.
[0150] The following section provides a further explanation of the system and method described in this application through specific data processing experiments.
[0151] Example 1: Single-round direct response (end of round scenario) Scenario: A user asks "How's the weather today?" The planner determines that there's no need to call any tools and provides an answer directly.
[0152] "DAG" orchestration execution process: "LoopStart" initialization: Write query content and system prompts, and initialize session state; "LoopStart" constructs the payload and sends it to the planner via C2; The planner calls the large language model and outputs the final answer; The planner updates the session state (appends assistant message) and constructs output (tool call is empty); The actuator identification tool is empty, so it is short-circuited and outputs a message. The observer evaluates and outputs "success"; If "LoopEnd" is successful, assemble the exit data and exit the sub-"DAG"; The value of the above improvements lies in the fact that even in a single-round direct response scenario, the "DAG" orchestration can clearly display the execution status and input / output of each operator, making it easier to track and debug.
[0153] like Figure 5 As shown in Example 2: "RAG" retrieval enhancement query generation customer information technology innovation implementation cycle Scenario: A user asks, "Please inquire about the implementation cycle of domestic IT innovation for a certain bank." This question cannot be answered directly by a large language model and requires multiple rounds of retrieval using external knowledge bases and project management tools.
[0154] "DAG" orchestration execution process: Round 1 iteration: "LoopStart" initialization: Write the query content "the customer's bank's domestic IT innovation implementation cycle" and system prompt words, and initialize the session state; "LoopStart" constructs the payload and sends it to the planner via C2; The planner calls the large language model to analyze the customer information that needs to be queried and outputs a list of tools to be called. The executor calls the external customer knowledge base interface and returns the query result: A certain bank currently has 3 domestic IT innovation projects; Observer evaluation: Information is incomplete, output "Continue"; If the "LoopEnd" condition is met, the list of items to be queried is written into the loop body context, triggering a loop recurrence.
[0155] Second iteration: "LoopStart" reads the list of items to be queried from the loop body context and constructs the second round of load; The planner calls the large language model to determine the implementation cycle of each project and outputs a list of tool calls. The executor makes batch calls to the project management interface and returns the start and end times of each project. Observer evaluation: All required information has been obtained, output "success", and summarize the answer. If "LoopEnd" is successful, assemble the exit data and exit the sub-"DAG"; The value of the above improvements is reflected in: Multi-round state traceability: The load and output of each iteration are stored in the database by node ID, and business personnel can view the complete evolution process of the query round by round on the "DAG" canvas. The loop body context constraints are clear: the first round observer writes the list of items to be checked into the loop body context, and the second round "LoopStart" reads the loop body context and constructs a new round of payload, with clear permission boundaries.
[0156] Unified exception fallback: If the second round of project management interface times out, the observer can output "failure", and "LoopEnd" will uniformly assemble the exit data according to the fallback strategy.
[0157] Example 3: Visual orchestration to implement "ReWOO" mode Scenario: Transform the "ReAct" mode into the "ReWOO" mode, that is, first generate a complete plan tree, and then execute according to the plan.
[0158] "DAG" arrangement scheme: Remove deployments within the loop of "ReactPlanner", "ReactExecutor", and "ReactObserver".
[0159] New addition: After "LoopStart", insert the "PlanGenerator" operator (to generate the complete plan tree); After "PlanGenerator", insert the "PlanExecutor" operator (executes according to the plan tree, containing multiple sub-execution steps); After "PlanExecutor", insert the "ResultSummarizer" operator (to summarize the execution results); Connections: Edge data connects each operator; the loop body context stores the plan tree and execution state. The value of this improvement lies in the fact that, through visual drag-and-drop, business personnel can transform the "ReAct" mode into the "ReWOO" mode in minutes without writing any code, fully demonstrating the flexibility of this invention.
[0160] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A method for the visual orchestration and flexible expansion of AI agents, specifically including: Step 1: Construction of the basic loop body -- By defining five operator units, constructing the DAG topology and configuring the execution logic of each operator, the construction of the basic loop body is completed; Step 2, Dual-wheel data flow management -- Based on the basic loop body of the constructed five-operator topology, establish a dual-wheel data transmission channel, standardize the flow rules, lifecycle and transmission range of different types of data, and control the data transmission and data interaction of the dual-wheel data transmission channel. At the same time, perform single-wheel data transmission verification and context consistency comparison. Step 3, Five-operator topology arrangement and expansion -- Based on the basic loop body and dual-wheel data transmission channel of the constructed five-operator topology, operators are dynamically added or removed, heterogeneous operators are replaced, and the topology is adjusted within the loop body between the Agent entry operator and the Agent exit operator; Step 4: Cyclic Scheduling of Topology -- Based on the basic loop body and dual-wheel data transmission channel, as well as the extension and optimization of the topology, the acyclic iterative operation of the SubDag subgraph is realized through the built-in cyclic scheduler. Cyclic semantics are realized without violating the definition of acyclic DAG, and the entire lifecycle execution of the five operator topology is uniformly managed.
2. The method according to claim 1, characterized in that, Specifically, step 1 involves constructing a standardized DAG basic loop with five operators. The traditional loop is divided into five independent DAG operators, with LoopStart as the only iteration entry point and LoopEnd as the only exit point. The planning, execution, and observation operators are connected in the middle to form a basic unidirectional topology, which fully reproduces the original ReAct execution logic. All operators can be developed, replaced, and reused independently.
3. The method according to claim 1, characterized in that, The dual-wheel data transmission channel in step 2 includes a side data channel and a loop context channel; The edge data channel connects the directed edges of the above operators and is used to transmit the temporary data payload of the current single iteration. The data flows strictly along the topological direction and does not support reverse data transmission. The loop context channel connects each operator to the shared data channel of the global context storage area. It is used to transmit system state variables that are persisted across rounds. The data runs through the entire lifecycle of the task and is retained when the loop is reset.
4. The method according to claim 1, characterized in that, The single-round data transmission verification is as follows: for each edge data, the execution engine performs verification before sending, which specifically includes four rules; The context consistency comparison is performed as follows: before the operator reads the loop body context, the execution engine calculates the context consistency hash.
5. The method according to claim 1, characterized in that, The dynamic addition and removal of operators in step 3 includes: adding intermediate operators and deleting operators; the replacement of heterogeneous operators includes: replacing planners, replacing observers, and replacing executors; the adjustment of topology includes: parallel branches, conditional branches, and nested loops.
6. The method according to claim 1, characterized in that, Step 3, the five-operator topology arrangement and expansion, specifically includes the following steps: (1) DAG topology initialization and cycle domain analysis: After constructing the canvas meta-model, the canvas to DAG conversion is performed, and the sub-DAG is automatically initialized and the cycle domain is identified after the conversion. The canvas-based DAG conversion and sub-DAG initialization are completed, and the cycle domain hierarchy is divided. (2) Standardized heterogeneous operator replacement: By utilizing operator compatibility verification and loop detection based on in-degree subtraction, the entire chain of edge extraction, contract migration, type verification, ownership verification, topology reconstruction, and regression verification is completed, realizing accurate replacement and compliance verification of various heterogeneous operators; (3) Dynamic topology adaptive adjustment: Based on the basic graph addition and deletion operations, using sub-algorithms TB1, TB2 and TB3, sub-DAG initialization and operator compatibility verification and cycle detection rules based on in-degree subtraction are performed simultaneously to realize fine-grained topology reconstruction and contract update of parallel branches, conditional branches and nested loops.
7. The method according to claim 6, characterized in that, The specific execution process of DAG topology initialization and cyclic domain analysis is as follows: Constructing the Canvas Metamodel: Read the canvas model and map canvas nodes, connections, and subgraph containers to DAG operators, DAG edges, and sub-DAG nodes, respectively. Define the node multi-class numbers, operator types, configurations, dependencies, ports, and metadata sets. Performing Canvas-to-DAG Conversion: Traverse the canvas nodes and connections to construct the initial graph structure, mark and assign numbers to cycle domain nodes, distinguish between ordinary edges and loop edges within the sub-DAG, and generate operator contract instances containing read / write sets and port mappings. Performing Operator Compatibility Verification and Cycle Detection: Perform operator compatibility verification for type, topology, port, configuration read / write, and lifecycle in sequence; use an in-degree subtraction cycle detection algorithm to detect cycles; loop edges are not included in the topology sorting. Performing Automatic Sub-DAG Initialization: Automatically generate a default five-operator topology when creating sub-DAG operator nodes, complete parameter, node, canvas graph, and output configuration processing, and output a standard DAG topology description for the execution engine to load. Perform loop domain identification: identify loop start and end operators, filter loop dependency edges to construct loop domains, and determine the loop body and exit successor nodes; Nested loops are registered to form a loop domain tree. The nesting depth is checked during the orchestration period, and illegal nesting is determined if the threshold is exceeded.
8. The method according to claim 6, characterized in that, The specific execution process of the standardized heterogeneous operator replacement is as follows: Edge Extraction: Extract the input and output edge sets of the operator to be replaced, and sort out the data structure, port structure, and data dependencies of its upstream and downstream edges. Compliance Verification: Conduct operator compatibility verification, verifying the five constraints of port type, subgraph topology, port connection, field read / write, and global lifecycle in sequence, while completing the adaptation verification of operator contract and loop domain field ownership. Contract Migration: Customize adaptation rules for three types of heterogeneous operator replacement scenarios, and adapt and configure the ports and read / write sets of the planning operator, observation operator, and general execution operator respectively. Specific parameters are injected through node configuration items to avoid loop body context. Topology Reconstruction: Remove the operator to be replaced and its associated edges from the DAG topology, insert the new operator, and reconnect the upstream and downstream input and output edges to the corresponding ports of the new operator to complete the topology update. Regression Verification: Re-execute compatibility verification and in-degree subtraction cycle detection on the replaced topology. Legitimate loop back edges are not included in the verification. If the verification passes, a new topology is submitted; if a conflict exists, a full rollback is performed and error details are output.
9. The method according to claim 1, characterized in that, The cyclic scheduling of the topology in step 4 specifically includes the following steps: (1) Construct a basic cyclic scheduling model: Construct a standardized cyclic scheduling base adapted to acyclic DAG, realize iterative state persistence and temporary data isolation based on dual-wheel data channels, and realize business cyclic semantics through runtime reset mechanism; (2) Runtime DAG dependency edge type classification: DAG dependency edges are finely classified during execution to adapt to the differentiated dependency calculation rules of scenarios such as loop iteration, branch pruning, and nested scheduling, and to provide standardized constraint basis for node readiness determination and adjacency list scheduling; (3) Hierarchical executor scheduling: A hierarchical parallel execution mechanism is adopted to distinguish between ordinary topology and cyclic topology and adapt different adjacency lists. The hierarchical iterative scheduling is completed by multi-threaded parallelism and the underlying adjacency list algorithm is linked to achieve efficient execution. (4) Circular adjacency list scheduling: Maintain a circular doubly linked list, ready nodes and stable dependency states, accurately determine the ready state of nodes according to dependency type rules, and support iterative reset and branch pruning capabilities; (5) Loop Forced Exit Mechanism: The two-condition forced exit rule is used to prevent infinite loops, and the exit status and reason marking are standardized to ensure that the iterative scheduling is safe and controllable; (6) Nested loop scheduling mechanism: Based on the single-layer loop scheduling capability, combined with the loop domain tree and nested sub-DAG, the inner and outer loop states are isolated, independently scheduled, and exited in layers, supporting complex multi-layer nested topology iteration.
10. A system for the visual orchestration and flexible expansion of AI agents, specifically comprising: Basic loop body construction module, dual-wheel data flow module, five-operator topology structure arrangement extension module, and topology structure loop scheduling module; The basic loop body construction module is used to construct a DAG topology by defining five operator units, and to complete the construction of the basic loop body after configuring the execution logic of each operator. The dual-wheel data flow management module, based on the constructed five-operator topology, establishes a dual-wheel data transmission channel, standardizes the flow rules, lifecycle, and transmission range of different types of data, and controls the data transmission and interaction within the dual-wheel data transmission channel. Simultaneously, it performs single-wheel data transmission verification and context consistency comparison. The five-operator topology arrangement extension module, based on the basic loop body of the constructed five-operator topology and the dual-wheel data transmission channel, performs dynamic addition and subtraction of operators, replacement of heterogeneous operators, and adjustment of topology within the loop body between the Agent entry operator and the Agent exit operator; The cyclic scheduling module of the topology structure, based on the basic loop body and dual-wheel data transmission channel, as well as the extension and optimization of the topology structure, realizes the acyclic iterative operation of the SubDag subgraph through the built-in cyclic scheduler, realizes the cyclic semantics without violating the definition of DAG acyclicity, and uniformly manages the entire life cycle execution of the five operator topology structure.
