Configuration type agent workflow construction method
By using a unified structured configuration carrier and scheduling engine to control node execution, the complexity and maintainability issues of intelligent agent workflow construction in existing technologies are resolved, realizing a flexible, scalable, and observable intelligent agent workflow system that can adapt to complex business scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-07
- Publication Date
- 2026-03-24
Smart Images

Figure CN121724397A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence application technology, and in particular to a method for constructing a configurable intelligent agent workflow. Background Technology
[0002] With the rapid development of Large Language Model (LLM) technology, agent-based automation systems are becoming an important paradigm for realizing complex task processing and intelligent business processes. While a single agent typically focuses on performing specific, atomic tasks, organically coordinating multiple agents to form workflows is key to solving complex, multi-step business needs across domains. Therefore, how to efficiently, flexibly, and maintainably build, orchestrate, and manage multi-agent workflows has become a significant engineering challenge in this field.
[0003] Currently, the common technical implementation methods in this field mainly include the following categories:
[0004] 1. Code-based development: Developers directly use intelligent agent development frameworks such as CrewAI, LangChain, and AutoGen, defining the behavioral logic of each agent and their interactions and coordination relationships by writing program code. While this approach offers high customizability and flexibility, enabling complex control logic, it has a high technical threshold, long development cycle, and high maintenance costs. Any change to business logic requires developers to modify the source code, retest, and redeploy, making it difficult to adapt to rapidly changing business needs. Furthermore, the complexity of the code increases dramatically with the scale of the workflow, hindering team collaboration and knowledge accumulation.
[0005] 2. Drag-and-drop interface (low-code / no-code platform): These platforms (such as Doubao Kouzi, Dify, and Alibaba Bailian) provide users with a visual graphical interface, allowing them to configure agents and their simple connections by dragging and dropping components and connecting lines. This method significantly lowers the barrier to entry, enabling non-technical personnel to quickly build basic single-chain or simple branching automated processes. However, its main drawback is its insufficient ability to handle complex logic. For advanced workflows requiring nested loops, fine-grained conditional judgments, dynamic path selection, deep context processing, or complex error recovery mechanisms, existing visual orchestrators often have limited expressive power, making them difficult to implement, or ultimately still requiring code injection, thus defeating the original purpose of low-code.
[0006] 3. Personalized Configuration File-Based Approach: Some systems attempt to describe workflows by writing configuration files in specific formats (such as JSON or YAML). This approach is slightly more flexible than hard-coding, but it is usually loosely designed and lacks unified standards. Different agent types and different node relationships often employ different configuration structures and semantics, making configuration files difficult to understand and lacking reusability. Furthermore, the configuration is tightly coupled with the execution engine; once the engine is upgraded or changed, the configuration files may become widely invalid. More importantly, existing configuration schemes typically fail to abstract the workflow itself into a unified, recursively invoked entity, limiting the ability to build hierarchical, modular, and complex systems.
[0007] Chinese patent CN120655234A discloses a method for building intelligent agents based on dynamic workflows. This method, guided by "dynamic adjustment at runtime," achieves real-time and automated reconstruction of the workflow structure (nodes and processes) through the collaboration of multiple dedicated functional modules. However, in practical applications, this method has the following shortcomings:
[0008] 1. Architectural complexity and high coupling: The modules are driven by "commands", which significantly increases the system complexity and internal communication overhead. The failure or performance bottleneck of any module may directly affect the dynamic adjustment capability of the entire workflow, resulting in a high risk of system stability and difficulty in deployment and maintenance.
[0009] 2. Rigid agent definition, insufficient reusability and scalability: Classifying workflow nodes according to fixed functional roles and defining them as agents hinders the cross-process reuse of agents as general functional units. When new functional combinations are needed, new role types must be created instead of flexibly configuring existing agents, limiting the system's scalability and construction efficiency.
[0010] 3. Centralized context management suffers from performance and reliability bottlenecks: It relies on "shared memory" as the sole storage and exchange hub for the global context. In high-concurrency or complex workflow scenarios, this can easily become a performance bottleneck and a single point of failure. Frequent read / write contention reduces system throughput, and the complexity of shared memory management also increases the risks to data consistency and concurrency control.
[0011] 4. Dynamic adjustments introduce uncertainty and debugging difficulties: Dynamically inserting, deleting nodes, or switching sub-processes during workflow execution, while enhancing flexibility, also makes the workflow execution path highly uncertain and unpredictable, sacrificing the system's observability and maintainability.
[0012] 5. Incomplete separation of configuration and logic, and development model not fundamentally simplified: While automation and adjustment are achieved through algorithms (such as MCTS) and strategy models, developers still need to focus on complex logic such as inter-module interaction and strategy formulation. This fails to effectively reduce the cognitive burden and development cost of the initial build, and falls short of the goal of "lowering the threshold through configuration".
[0013] Therefore, how to provide a method that can reduce development and maintenance costs, ensure system consistency and manageability, build hierarchical complex systems, and guarantee data isolation, state synchronization, and process observability during workflow execution has become an urgent technical problem to be solved. Summary of the Invention
[0014] In view of this, in order to overcome the shortcomings of the prior art, the present invention aims to provide a method for constructing a configurable intelligent agent workflow.
[0015] This invention provides a method for constructing a configurable intelligent agent workflow, the method comprising:
[0016] Step S1: Define independent intelligent agents and workflow intelligent agents using a unified structured configuration carrier. A workflow intelligent agent is a logical entity that completes a composite task by arranging multiple nodes. The nodes are associated with independent intelligent agents or other workflow intelligent agents.
[0017] Step S2: By defining the execution order and jump logic between nodes within the workflow agent, configure the node flow rules, including fixed jump rules based on preset purposes and conditional jump rules based on context state judgment.
[0018] Step S3: Instantiate each agent associated with the workflow agent, assemble a workflow execution unit that integrates a scheduling engine and node execution logic. The scheduling engine controls the execution order of nodes according to the flow rules between nodes, and the node execution logic is used to drive the operation of the agents associated with each node and manage their input and output.
[0019] Step S4: Provide a unified calling interface for the workflow agent that is compatible with the independent agents associated with its internal nodes. Trigger the workflow execution unit to run through this calling interface. Under the unified global context management, schedule each node to execute in sequence according to the flow rules, and summarize the execution results of each node.
[0020] Optionally, in the method for constructing the configurable agent workflow of the present invention, in step S1, the unified structured configuration carrier adopts a JSON format file, a YAML format file, or a record in a database table. For each defined agent, its configuration information includes basic configuration items and type-specific configuration items. The basic configuration items include at least the agent number, agent name, type identifier, whether it is a root agent, whether it is enabled, description text, model output identifier, and model output structure definition.
[0021] Optionally, in the method for constructing a configurable intelligent agent workflow of the present invention, the set of values for the type identifier in the basic configuration items is limited to the agent value used to identify ordinary intelligent agents, the custom value used to identify customized intelligent agents, and the workflow value used to identify workflow intelligent agents. Among them, intelligent agents with the type identifier of agent or custom are independent intelligent agents, and their type-specific configuration items include model name, model service address, model access key, and model instructions; intelligent agents with the type identifier of workflow are workflow intelligent agents, and their type-specific configuration items include the path of the node relationship configuration file and the list of associated nodes.
[0022] Optionally, in the method for constructing the configurable intelligent agent workflow of the present invention, step S2 defines the flow rules between nodes in the following manner:
[0023] Create a node relationship configuration file for the workflow agent. In this configuration file, configure a source node identifier for each node connection edge that needs to be defined, and configure the jump logic of each connection edge using a fixed jump method or a conditional jump method.
[0024] When configuring the jump logic of a connection edge using a fixed jump method, a specific destination node identifier is directly configured for the connection edge;
[0025] When configuring the jump logic of a connection edge using conditional jump, a condition judgment function identifier, a set of conditional rules, and a default route node identifier are configured for the connection edge. The set of conditional rules is a collection of one or more "redirection identifier-destination node identifier" mapping pairs. The condition judgment function is set to receive the global context as input and output a redirection identifier when it is executed. Based on the redirection identifier, the conditional rule set is queried to determine the destination node. If no match is found, the jump is made to the default route node.
[0026] Optionally, in the method for constructing a configurable intelligent agent workflow of the present invention, the workflow execution unit is assembled in step S3 as follows:
[0027] Parse the list of nodes associated in the workflow agent configuration, instantiate the independent agents associated with each node in sequence according to the corresponding agent configuration, generate executable agent instance objects, and build a mapping table with node name as key and agent instance object as value;
[0028] For each node in the workflow intelligence body, a node executor is created. When the node executor is scheduled, it obtains the current global context data from the system runner and creates an independent copy of the data. It queries the mapping table according to the node name to obtain the corresponding intelligence agent instance object, calls the execution method of the intelligence agent instance object, and passes the independent copy to drive the task execution. After the intelligence agent instance completes execution, it extracts its output result, uses the model output identifier defined in the intelligence agent configuration as the key, and stores or updates the result in the state storage area of the global context maintained by the system runner.
[0029] Create a scheduling engine, register the node executors to the scheduling engine, read and parse the flow rules between nodes, and build the connection relationship between nodes in the scheduling engine. Specifically, for fixed jump rules, build a fixed connection edge from the source node executor to the destination node executor, and for conditional jump rules, build a logical connection edge that associates the corresponding condition judgment function and the set of condition rules.
[0030] Optionally, the method for constructing the configurable agent workflow of the present invention, before the node executor starts calling the agent instance object, integrates the OpenTelemetry component and calls its start_as_current_span method to manually create a Span tracking unit bound to the execution cycle of the node. During the entire execution of the node, the running status of the agent instance, message interaction content and context data change information are recorded in this Span. When the node execution ends, the life cycle of this Span ends.
[0031] Optionally, the method for constructing the configurable intelligent agent workflow of the present invention initializes the internal logic of the created scheduling engine in the following manner: the entry point of the workflow execution unit is set as the source node of the first connection edge in the node relationship configuration file. At the same time, all nodes that are the end points of the process are configured with a connection edge pointing to a specific termination symbol node. The scheduling engine determines whether the entire workflow has been completed by detecting whether the execution has reached the termination symbol node.
[0032] Optionally, in the method for constructing the configurable intelligent agent workflow of the present invention, the unified calling interface in step S4 is implemented through inheritance and polymorphism mechanisms in object-oriented programming in the following manner:
[0033] Define an abstract base class that declares the standard execution interface of the agent. Independent agents encapsulate their own model invocation logic by inheriting from this abstract base class and implementing its standard execution interface.
[0034] The workflow agent inherits from this abstract base class and internally holds a workflow execution unit as its core member. By implementing the standard execution interface of the abstract base class, it forwards the response to external calls to its internal workflow execution unit.
[0035] Optionally, in the method for constructing the configurable intelligent agent workflow of the present invention, the unified interface in step S4 is executed in the following manner:
[0036] External systems initiate the process by calling the unified execution interface of the workflow agent and passing in the initial session parameters;
[0037] The workflow agent initializes an executor, which creates and maintains a global context object containing a global state and a list of messages;
[0038] The scheduling engine in the workflow execution unit is activated, starting from its entry node, and passes the global context to the executor of that node;
[0039] The executor of a node drives the associated agent instance to complete the task according to its encapsulated logic and synchronizes the result back to the global context;
[0040] After the current node finishes execution, the scheduling engine makes a decision based on the node's output and node flow rules, and then jumps to the next node.
[0041] Repeat the above node execution and jump process until the scheduling engine determines that the process has been executed to the end node, and the workflow agent returns the final execution result through a unified interface.
[0042] Optionally, the method for constructing a configurable intelligent agent workflow of the present invention further includes the recursive nested definition and execution of workflow intelligent agents:
[0043] In step S1, it is permissible to configure a workflow agent of type "workflow" as one of the associated nodes of another workflow agent;
[0044] In step S3, when the system instantiates a node associated with a nested workflow agent, it recursively triggers the assembly process of the nested workflow agent, ultimately assembling it into a composite node executor.
[0045] In step S4, when the scheduling engine reaches this composite node, it will call the lower-level workflow execution unit encapsulated within it. This lower-level unit also runs its internal nodes in an independent context copy and returns the final result to the upper layer.
[0046] The method for constructing a configurable intelligent agent workflow of the present invention has the following beneficial technical effects:
[0047] I. Achieving a highly standardized, flexible, and scalable system architecture
[0048] 1. Unified architecture and standardized interfaces: greatly reduces the complexity of system integration. Upper-layer applications do not need to distinguish whether the calling object is a single model or a complex process, simplifying the system architecture and improving the interoperability between modules.
[0049] 2. Achieve composability and recursive expansion capabilities: greatly enhance the system's architectural potential to cope with ultra-complex scenarios, enabling system design to map multi-layered and step-by-step business logic in the real world.
[0050] 3. Achieve high reusability and maintainability: A well-defined independent intelligent agent can serve as a reusable component, referenced by multiple different workflows. When the agent needs upgrading, only its own configuration needs to be modified, and all workflows referencing it will automatically take effect. Simultaneously, adjustments to business processes only require editing the relationship configuration file, without affecting the agent's implementation code. This significantly improves code and configuration reusability, simplifies maintenance, and makes business process iteration fast, secure, and low-cost.
[0051] II. Significantly reduce technical barriers and improve system reliability
[0052] 1. Improved development efficiency and reduced costs: Enables ordinary developers to participate in the design and construction of complex workflows, effectively reducing the technical threshold and human resource costs of developing intelligent agent systems, and shortening the cycle from design to deployment.
[0053] 2. Reliable and observable execution: Effectively prevents the pollution of the entire process's context data due to abnormal execution or side effects of a single node, enhancing the process's robustness and fault tolerance. The execution path, time consumption, status, and message passing from the workflow entry point to each internal agent call are clearly visible, improving the system's observability in debugging, performance monitoring, and root cause analysis.
[0054] III. Enhance adaptability and scenario coverage capabilities
[0055] 1. High business flexibility and rapid response to changes: When business rules need to be adjusted, operations and maintenance personnel usually only need to modify and reload the corresponding configuration files, without the need for code development, testing and service restart.
[0056] 2. Wide range of application scenarios: It can support the construction of everything from simple automated tasks to complex business systems. It is not only suitable for common AI scenarios, but also effectively serves fields that require multiple steps, multiple roles, conditional judgments and long-term context maintenance. It is especially suitable for depicting real-world business with features such as sub-processes and cyclical approvals. Attached Figure Description
[0057] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is a schematic diagram of agent configuration information in a method for constructing a configurable agent workflow according to an exemplary embodiment of the present invention.
[0059] Figure 2 This is a schematic diagram of a node relationship configuration file for a method of constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention;
[0060] Figure 3 This is a schematic diagram of the assembly process of the workflow execution unit of the method for constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention.
[0061] Figure 4 This is a schematic diagram of the execution architecture of a method for constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention;
[0062] Figure 5 This is a schematic diagram of the execution flow of the workflow execution unit of the method for constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention. Detailed Implementation
[0063] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0064] It should be noted that, in the absence of conflict, the following embodiments and features can be combined with each other; and, based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0065] It should be noted that various aspects of embodiments within the scope of the appended claims are described below. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this disclosure, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using structures and / or functionalities other than one or more of the aspects set forth herein.
[0066] An exemplary embodiment of the present invention provides a method for constructing a configurable intelligent agent workflow. The method in this embodiment is implemented in the following manner:
[0067] Step S1: Define independent intelligent agents and workflow intelligent agents using a unified structured configuration carrier. A workflow intelligent agent is a logical entity that completes a composite task by arranging multiple nodes. The nodes are associated with independent intelligent agents or other workflow intelligent agents.
[0068] In this embodiment, the unified structured configuration carrier adopts a JSON format file, a YAML format file, or a record in a database table. For each defined agent, its configuration information includes basic configuration items and type-specific configuration items. The basic configuration items include at least the agent number, agent name, type identifier, whether it is a root agent, whether it is enabled, description text, model output identifier (i.e., the storage key name of the model output content in the State), and model output structure definition (i.e., the schema definition of the model output). The structured configuration carrier in this embodiment can also adopt other format files, and there is no limitation on this.
[0069] In this embodiment, "whether it is a root agent" indicates whether the agent can serve as a system entry point. If "no", the agent can only serve as a sub-agent of other agents or a workflow node. "Whether it is" can be used to control whether the agent's configuration participates in instantiation. If "no", the system ignores the configuration during instantiation.
[0070] It should be noted that, in this embodiment, the set of values for the type identifier in the basic configuration items is limited to the agent value used to identify ordinary intelligent agents, the custom value used to identify customized intelligent agents, and the workflow value used to identify workflow intelligent agents. Among them, intelligent agents with the type identifier of agent or custom are independent intelligent agents, and their type-specific configuration items include model name, model service address (URL), model access key (Key), and model instructions; intelligent agents with the type identifier of workflow are workflow intelligent agents, and their type-specific configuration items include the path of the node relationship configuration file and the list of associated nodes. Figure 1 This is a schematic diagram of agent configuration information for a method of constructing a configurable agent workflow according to an exemplary embodiment of the present invention.
[0071] Step S2: By defining the execution order and jump logic between nodes within the workflow agent, configure the node flow rules, including fixed jump rules based on preset purposes and conditional jump rules based on context state judgment.
[0072] This step configures the node association logic for the workflow agent, defining the flow rules between nodes. Required configuration information is the source node identifier; optional configuration information includes condition judgment identifier, condition rule set, default route node, and destination node identifier. The configuration logic constraints are as follows: if the "condition judgment identifier" is configured, then the "condition rule set" and "default route node" are required; if the "condition judgment identifier" is not configured, then the "destination node identifier" is required.
[0073] This embodiment creates a node relationship configuration file for the workflow agent. In this configuration file, a source node identifier is configured for each node connection edge that needs to be defined, and the jump logic of each connection edge is configured using a fixed jump method or a conditional jump method.
[0074] When configuring the jump logic of a connection edge using a fixed jump method, a specific destination node identifier is directly configured for the connection edge. When configuring the jump logic of a connection edge using a conditional jump method, a condition judgment function identifier, a set of conditional rules, and a default route node identifier are configured for the connection edge. The set of conditional rules consists of one or more "redirection identifier-destination node identifier" mapping pairs. The condition judgment function is set to receive the global context as input and output a redirection identifier when it is executed. Based on the redirection identifier, the conditional rule set is queried to determine the destination node. If no match is found, the jump is made to the default route node. Figure 2 This is a schematic diagram of a node relationship configuration file for a method of constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention.
[0075] Step S3: Instantiate each agent associated with the workflow agent, and assemble a workflow execution unit that integrates a scheduling engine and node execution logic. The scheduling engine controls the execution order of nodes according to the flow rules between nodes, and the node execution logic is used to drive the operation of the agents associated with each node and manage their input and output.
[0076] In this embodiment, the workflow execution unit is assembled through node instantiation and mapping, node execution logic encapsulation, and scheduling engine construction and integration. Specifically:
[0077] 1. Node Instantiation and Mapping: Parse the list of nodes associated in the workflow agent configuration, instantiate the independent agents associated with each node in sequence according to the corresponding agent configuration, generate executable agent instance objects, and build a mapping table with node name as key and agent instance object as value;
[0078] 2. Encapsulation of Node Execution Logic: For each node in the workflow intelligence body, a node executor is created. When the node executor is scheduled, it obtains the current global context data from the system runner and creates an independent copy of the data. It queries the mapping table based on the node name to obtain the corresponding intelligence agent instance object, calls the execution method of the intelligence agent instance object, and passes in the independent copy to drive the task execution. After the intelligence agent instance completes execution, it extracts its output result, uses the model output identifier defined in the intelligence agent configuration as the key, and stores or updates the result in the state storage area of the global context maintained by the system runner.
[0079] It should be noted that in this embodiment, the node execution logic encapsulation also integrates a full-link tracing function, which is implemented as follows: before the node executor starts calling the agent instance object, the OpenTelemetry component is integrated, and its start_as_current_span method is called to manually create a Span tracing unit bound to the execution cycle of the node. During the entire execution of the node, the running status of the agent instance, message interaction content, and changes in context data are recorded in this Span. When the node execution ends, the life cycle of this Span ends, thereby forming an observable data chain from the workflow level to the individual agent execution level.
[0080] 3. Scheduling Engine Construction and Integration: Create a scheduling engine, register the node executors to the scheduling engine, read and parse the flow rules between nodes, and build the connection relationship between nodes in the scheduling engine. For fixed jump rules, build a fixed connection edge from the source node executor to the destination node executor. For conditional jump rules, build a logical connection edge that associates the corresponding condition judgment function and the set of condition rules.
[0081] It should be noted that the scheduling engine created in this embodiment is initialized internally in the following way: the entry point of the workflow execution unit is set as the source node of the first connection edge in the node relationship configuration file. At the same time, all nodes that are the end points of the process are configured with a connection edge pointing to a specific termination symbol node. The scheduling engine determines whether the entire workflow has been completed by detecting whether the execution has reached the termination symbol node.
[0082] The following describes the assembly of the workflow execution unit in the method of this embodiment in a specific scenario. Figure 3 This is a schematic diagram illustrating the assembly process of the workflow execution unit in a method for constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention. Figure 3 As shown, in this scenario, based on the agent configuration and node relationship configuration, the specific steps for assembling an executable workflow execution unit are as follows:
[0083] 1. Configure agent information: Obtain the list of associated agent nodes and the node relationship configuration file.
[0084] 2. Constructing Agent Instances: Based on the basic and proprietary configurations of an independent agent (including model instructions and model service information: name, URL, and key), construct agent instances. Instantiation methods are unrestricted; it can be implemented using agent frameworks such as CrewAI, ADK, and LangChain, or by manually constructing large model request and response processing logic. Establish an "Agent Name-Instance" mapping table to support direct indexing of agent instances by name.
[0085] 3. Construct workflow nodes: Retrieve the corresponding independent agent instance from the mapping table based on the node name; extract global context information (including session data, message records, global state, etc.) from the node input parameters; create an independent copy of the global context, and only operate on this copy during node execution to avoid polluting global data; enable thread metric tracking: Manually create a Span and manage its lifecycle using OpenTelemetry's start_as_current_span method to achieve full-link tracking of agent execution, state transitions, and message delivery; call the agent asynchronous execution interface to obtain the execution result message; after the node completes execution, update the global state management with the configured "model output identifier" as the key; and append the output message to the global message list.
[0086] 4. Build the workflow scheduling engine: Add all the nodes built in step 3 to the scheduling engine.
[0087] 5. Construct workflow edges (node connection relationships):
[0088] 5.1 Read the node relationship configuration file and traverse all edge configurations (supporting both fixed edges and conditional edges).
[0089] 5.2 Conditional Edge Processing: Load the configured conditional check function. The input of this function is the global state object of the preceding node, and the output is the node turning identifier. Register the conditional edge in the scheduling engine according to the configured "identifier-node name" mapping relationship.
[0090] 5.3 Fixed edge processing: Directly register the fixed connection relationship between the source node and the destination node in the scheduling engine;
[0091] 5.4 Special Configuration: Set the source node of the first edge as the workflow entry node; all final nodes must be manually configured to the termination edge of the __end_ node.
[0092] 6. Complete the assembly of the workflow execution unit to form the core components of the workflow intelligent agent that can operate independently.
[0093] Step S4: Provide a unified calling interface for the workflow agent that is compatible with the independent agents associated with its internal nodes. Trigger the workflow execution unit to run through this calling interface. Under the unified global context management, schedule each node to execute in sequence according to the flow rules, and summarize the execution results of each node.
[0094] In this embodiment, the unified calling interface is implemented using inheritance and polymorphism mechanisms in object-oriented programming in the following way:
[0095] Define an abstract base class that declares the standard execution interface of the agent. Independent agents encapsulate their own model call logic by inheriting from this abstract base class and implementing its standard execution interface. The workflow agent inherits from this abstract base class and holds a workflow execution unit as its core member. By implementing the standard execution interface of the abstract base class, it forwards the response to external calls to its internal workflow execution unit.
[0096] In this embodiment, the unified interface is implemented in the following manner:
[0097] External systems initiate the process by calling the unified execution interface of the workflow agent and passing in the initial session parameters;
[0098] The workflow agent initializes an executor, which creates and maintains a global context object containing a global state and a list of messages;
[0099] The scheduling engine in the workflow execution unit is activated, starting from its entry node, and passes the global context to the executor of that node;
[0100] The executor of a node drives the associated agent instance to complete the task according to its encapsulated logic and synchronizes the result back to the global context;
[0101] After the current node finishes execution, the scheduling engine makes a decision based on the node's output and node flow rules, and then jumps to the next node.
[0102] Repeat the above node execution and jump process until the scheduling engine determines that the process has been executed to the end node, and the workflow agent returns the final execution result through a unified interface.
[0103] It should be noted that the method in this embodiment also includes the recursive nested definition and execution of workflow agents. Specifically, in step S1, a workflow agent with the type identifier "workflow" can be configured as one of the associated nodes of another workflow agent. In step S3, when the system instantiates a node associated with a nested workflow agent, the assembly process of the nested workflow agent is recursively triggered, ultimately assembling it into a composite node executor. In step S4, when the scheduling engine executes this composite node, it calls the lower-level workflow execution unit encapsulated within it. This lower-level unit also runs its internal nodes in an independent context copy and returns the final result to the upper level. Through this mechanism, a multi-layered, recursively complex agent collaborative system can be constructed.
[0104] The execution of the workflow execution unit in this embodiment will be further explained below in a specific scenario. Figure 4 This is a schematic diagram of the execution architecture of a method for constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention. Figure 5 This is a schematic diagram of the execution flow of the workflow execution unit in the method for constructing a configurable intelligent agent workflow according to an exemplary embodiment of the present invention. Figure 4 and Figure 5 As shown, in this scenario, the specific execution steps of the workflow execution unit are as follows:
[0105] To ensure interface consistency between workflow agents and independent agents, an inheritance mechanism is used to encapsulate execution logic. The specific steps are as follows:
[0106] 1. Class structure definition: Use the ordinary intelligent agent (Agent) as the parent class and define the subclass WorkflowAgent (workflow intelligent agent); assign the assembled workflow execution unit as a member variable of WorkflowAgent.
[0107] 2. Set up the runner: The runner for the entire workflow agent and ordinary agents, which internally stores the global context shared by multiple agents in this session.
[0108] 3. Implementation of asynchronous execution logic:
[0109] 3.1 Context Initialization: Initialize the runner of the current workflow agent and initialize its context parameters, passing the workflow execution unit as the initial running context;
[0110] 3.2 Workflow Scheduling and Execution: Based on the initial context, the scheduling engine initiates the collaborative execution process according to the node relationship configuration.
[0111] a. Entry node execution: Load the initial context and run the associated independent agents; if a "model output identifier" is configured, the execution result is stored in the global state of the context with the identifier as the key.
[0112] b. Conditional edge transition: If the outgoing edge of the current node is a conditional edge, the condition check function is triggered, and the next hop node is determined based on the returned identifier;
[0113] c. Fixed edge transition: If the outgoing edge of the current node is a fixed edge, directly jump to the preset next hop node and execute;
[0114] d. Execute in a loop: Repeat steps a to c until the __end__ node is reached, at which point the workflow execution ends.
[0115] The method for constructing a configurable intelligent agent workflow of the present invention has the following beneficial technical effects:
[0116] I. Achieving a highly standardized, flexible, and scalable system architecture
[0117] 1. Unified Architecture and Standardized Interfaces: A unified configuration paradigm manages ordinary intelligent agents, customized intelligent agents, and workflow intelligent agents. Workflow intelligent agents are designed with execution interfaces fully compatible with independent intelligent agents, ensuring that a complex workflow behaves identically to a single intelligent agent from the perspective of external callers. This significantly reduces system integration complexity; upper-layer applications do not need to distinguish between single-model and complex processes, simplifying system architecture and improving interoperability between modules.
[0118] 2. Achieving composability and recursive expansion capabilities: The workflow itself is defined as a type of intelligent agent, and workflow intelligent agents are allowed to nest and reference other workflow intelligent agents as their nodes, forming a recursive and hierarchical construction pattern. Starting from simple atomic intelligent agents, it can be combined layer by layer to build business processes of arbitrary complexity, and each layer maintains a consistent interface, which greatly enhances the system's architectural potential to cope with ultra-complex scenarios, and enables the system design to map multi-layered and step-by-step business logic in the real world.
[0119] 3. Achieve high reusability and maintainability: Separate "agent configuration" from "workflow orchestration configuration (node relationships)". A predefined independent agent (such as a "text summarizer") can be used as a reusable component and referenced by multiple different workflows. When the agent needs to be upgraded (e.g., changing the model), only its own configuration needs to be modified, and all workflows referencing it will automatically take effect. Simultaneously, adjustments to the business process (e.g., adding or removing steps, modifying flow conditions) only require editing the relationship configuration file, without affecting the agent's implementation code. This significantly improves code and configuration reusability, simplifies maintenance, and makes business process iteration fast, secure, and low-cost.
[0120] II. Significantly reduce technical barriers and improve system reliability
[0121] 1. Improved development efficiency and reduced costs: By providing a declarative and structured configuration scheme, a large amount of intelligent agent collaboration logic that originally required writing code is transformed into editing configuration files such as JSON and YAML. This enables ordinary developers to participate in the design and construction of complex workflows, effectively reducing the technical threshold and human resource costs of intelligent agent system development, and shortening the cycle from design to deployment.
[0122] 2. Reliable and Observable Execution: Based on a context management mechanism, each independent agent, running as a workflow node, operates on an independent copy of the global context, only synchronizing the specified result back to the global state after successful execution. This "copy isolation, result synchronization" model effectively prevents the pollution of the entire process's context data due to abnormal execution or side effects of a single node, enhancing the process's robustness and fault tolerance. Integration with standards such as OpenTelemetry enables end-to-end tracing, making the execution path, time consumption, status, and message passing from the workflow entry point to each internal agent's call clearly visible, improving the system's observability in debugging, performance monitoring, and root cause analysis.
[0123] III. Enhance adaptability and scenario coverage capabilities
[0124] 1. High business flexibility and rapid response to changes: Since the business process logic is defined by configuration files, when business rules need to be adjusted (for example, adding a compliance check node in the customer service process or modifying the approval routing conditions), operations and maintenance personnel usually only need to modify and reload the corresponding configuration files, without the need for code development, testing and service restart. This enables systems built on this solution to quickly respond to market changes and internal business optimization needs.
[0125] 2. Wide Range of Application Scenarios: It can support the construction of everything from simple automated tasks to complex business systems. It is not only suitable for common AI scenarios such as intelligent dialogue and content generation, but also effectively serves fields requiring multi-step, multi-role, conditional judgment, and long-term context maintenance, such as the entire intelligent customer service chain, automated R&D and operations (DevOps), complex decision support systems, and industrial process automation. Its recursive nesting characteristics are particularly suitable for characterizing real-world businesses with features such as sub-processes and cyclical approvals.
[0126] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0127] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for constructing a configurable intelligent agent workflow, characterized in that, The method includes: Step S1: Define independent intelligent agents and workflow intelligent agents using a unified structured configuration carrier. A workflow intelligent agent is a logical entity that completes a composite task by arranging multiple nodes. The nodes are associated with independent intelligent agents or other workflow intelligent agents. Step S2: By defining the execution order and jump logic between nodes within the workflow agent, configure the node flow rules, including fixed jump rules based on preset purposes and conditional jump rules based on context state judgment. Step S3: Instantiate each agent associated with the workflow agent, assemble a workflow execution unit that integrates a scheduling engine and node execution logic. The scheduling engine controls the execution order of nodes according to the flow rules between nodes, and the node execution logic is used to drive the operation of the agents associated with each node and manage their input and output. Step S4: Provide a unified calling interface for the workflow agent that is compatible with the independent agents associated with its internal nodes. Trigger the workflow execution unit to run through this calling interface. Under the unified global context management, schedule each node to execute in sequence according to the flow rules, and summarize the execution results of each node.
2. The method for constructing a configurable intelligent agent workflow according to claim 1, characterized in that, In step S1, the unified structured configuration carrier adopts JSON format files, YAML format files, or records in database tables. For each defined agent, its configuration information includes basic configuration items and type-specific configuration items. The basic configuration items include at least the agent number, agent name, type identifier, whether it is a root agent, whether it is enabled, description text, model output identifier, and model output structure definition.
3. The method for constructing a configurable intelligent agent workflow according to claim 2, characterized in that, The set of values for the type identifier in the basic configuration items is limited to the agent value used to identify ordinary intelligent agents, the custom value used to identify customized intelligent agents, and the workflow value used to identify workflow intelligent agents. Among them, intelligent agents with the type identifier of agent or custom are independent intelligent agents, and their type-specific configuration items include model name, model service address, model access key, and model instructions; intelligent agents with the type identifier of workflow are workflow intelligent agents, and their type-specific configuration items include the path of the node relationship configuration file and the list of associated nodes.
4. The method for constructing a configurable intelligent agent workflow according to claim 1, characterized in that, In step S2, the flow rules between nodes are defined as follows: Create a node relationship configuration file for the workflow agent. In this configuration file, configure a source node identifier for each node connection edge that needs to be defined, and configure the jump logic of each connection edge using a fixed jump method or a conditional jump method. When configuring the jump logic of the connection edge using a fixed jump method, a specific destination node identifier is directly configured for the connection edge; When configuring the jump logic of a connection edge using conditional jump, a condition judgment function identifier, a set of conditional rules, and a default route node identifier are configured for the connection edge. The set of conditional rules is a collection of one or more "redirection identifier-destination node identifier" mapping pairs. The condition judgment function is set to receive the global context as input and output a redirection identifier when it is executed. Based on the redirection identifier, the conditional rule set is queried to determine the destination node. If no match is found, the jump is made to the default route node.
5. The method for constructing a configurable intelligent agent workflow according to claim 1, characterized in that, In step S3, the workflow execution unit is assembled in the following manner: Parse the list of nodes associated in the workflow agent configuration, instantiate the independent agents associated with each node in sequence according to the corresponding agent configuration, generate executable agent instance objects, and build a mapping table with node name as key and agent instance object as value; For each node in the workflow intelligence body, a node executor is created. When the node executor is scheduled, it obtains the current global context data from the system runner and creates an independent copy of the data. It queries the mapping table according to the node name to obtain the corresponding intelligence agent instance object, calls the execution method of the intelligence agent instance object, and passes the independent copy to drive the task execution. After the intelligence agent instance completes execution, it extracts its output result, uses the model output identifier defined in the intelligence agent configuration as the key, and stores or updates the result in the state storage area of the global context maintained by the system runner. Create a scheduling engine, register the node executors to the scheduling engine, read and parse the flow rules between nodes, and build the connection relationship between nodes in the scheduling engine. Specifically, for fixed jump rules, build a fixed connection edge from the source node executor to the destination node executor, and for conditional jump rules, build a logical connection edge that associates the corresponding condition judgment function and the set of condition rules.
6. The method for constructing a configurable intelligent agent workflow according to claim 5, characterized in that, Before the node executor starts calling the agent instance object, by integrating the OpenTelemetry component and calling its start_as_current_span method, a Span tracking unit bound to the execution cycle of the node is manually created. During the entire execution of the node, the running status of the agent instance, message interaction content, and changes in context data are recorded in this Span. When the node execution ends, the life cycle of this Span ends.
7. The method for constructing a configurable intelligent agent workflow according to claim 5, characterized in that, The scheduling engine is initialized internally as follows: the entry point of the workflow execution unit is set to the source node of the first connection edge in the node relationship configuration file. At the same time, all nodes that are the end points of the process are configured with a connection edge pointing to a specific termination symbol node. The scheduling engine determines whether the entire workflow has been completed by detecting whether the execution has reached the termination symbol node.
8. The method for constructing a configurable intelligent agent workflow according to claim 1, characterized in that, The unified calling interface in step S4 is implemented using inheritance and polymorphism mechanisms in object-oriented programming in the following way: Define an abstract base class that declares the standard execution interface of the agent. Independent agents encapsulate their own model invocation logic by inheriting from this abstract base class and implementing its standard execution interface. The workflow agent inherits from this abstract base class and internally holds a workflow execution unit as its core member. By implementing the standard execution interface of the abstract base class, it forwards the response to external calls to its internal workflow execution unit.
9. The method for constructing a configurable intelligent agent workflow according to claim 1, characterized in that, The unified interface in step S4 is executed as follows: External systems initiate the process by calling the unified execution interface of the workflow agent and passing in the initial session parameters; The workflow agent initializes an executor, which creates and maintains a global context object containing a global state and a list of messages; The scheduling engine in the workflow execution unit is activated, starting from its entry node, and passes the global context to the executor of that node; The executor of a node drives the associated agent instance to complete the task according to its encapsulated logic and synchronizes the result back to the global context; After the current node finishes execution, the scheduling engine makes a decision based on the node's output and node flow rules, and then jumps to the next node. Repeat the above node execution and jump process until the scheduling engine determines that the process has been executed to the end node, and the workflow agent returns the final execution result through a unified interface.
10. The method for constructing a configurable intelligent agent workflow according to claim 1, characterized in that, The method also includes the recursive nested definition and execution of workflow agents: In step S1, it is permissible to configure a workflow agent of type "workflow" as one of the associated nodes of another workflow agent; In step S3, when the system instantiates a node associated with a nested workflow agent, it recursively triggers the assembly process of the nested workflow agent, ultimately assembling it into a composite node executor. In step S4, when the scheduling engine reaches this composite node, it will call the lower-level workflow execution unit encapsulated within it. This lower-level unit also runs its internal nodes in an independent context copy and returns the final result to the upper layer.
Citation Information
Patent Citations
Intelligent agent building method based on dynamic workflow
CN120655234A