method for operating a hierarchical AI agent system with interactive planning and self-correction capabilities based on dynamic code generation / execution
Patent Information
- Authority / Receiving Office
- KR · KR
- Patent Type
- Patents
- Current Assignee / Owner
- LLOYDK CO LTD
- Filing Date
- 2025-11-13
- Publication Date
- 2026-08-03
Smart Images

Figure 112025126770835-PAT00002_ABST
Abstract
Description
Technology Field
[0001] The present invention relates to a method of operation for a hierarchical AI agent system having a self-correcting function based on interactive planning and dynamic code generation / execution, and more specifically, to an AI agent system and a method of operation thereof in which a plurality of agents are hierarchically configured to stably perform complex tasks, and each agent performs tasks through dynamic code execution and self-corrects errors that occur. Background Technology
[0002] With the recent advancement of Large-Scale Language Models (LLMs), AI agent technology that autonomously formulates plans and utilizes tools to achieve given goals is garnering attention. Notably, the ReAct (Reasoning and Acting) framework has demonstrated the ability to solve complex problems through iterative reasoning and action. Meanwhile, active research is also underway on Multi-Agent Systems, where multiple specialized agents collaborate to solve problems rather than relying on a single large agent.
[0003] In addition, the emergence of standard communication formats such as Model Context Protocol (MCP), which enable AI agents to communicate with external data sources and tools in a standardized manner, has improved the autonomy, reliability, and functional scalability of agents. With the advancement of the aforementioned AI agent technology, AI agent systems are being utilized in the automation of various existing IT services.
[0004] However, existing AI agent technology has the following limitations. First, when assigned complex, multi-step tasks, single agents or multi-agents with a flat structure frequently lose consistency in task execution, such as deviating from the initial plan (Task Deviation) or repeating meaningless tasks. This is attributed to unpredictable interactions between agents or hallucinations by a single agent, and is a major cause of reduced reliability in the entire system. Second, the action methods for problem-solving are limited to "calling predefined tools," resulting in poor flexibility and efficiency. While the emergence of standard communication protocols like MCP (Model Context Protocol) has increased the possibility of interoperability with various external tools, fundamentally, agent behavior does not go beyond a simple transaction form of "calling a tool according to a fixed input format and receiving a single result." Consequently, it is inefficient to perform complex logic—such as processing and combining the outputs of multiple tools at once, repeatedly performing similar tasks, or using different tools depending on conditions—as it requires repeating unnecessary LLM inference and tool calls multiple times. Thirdly, when unexpected errors occur during task execution, they are often not handled effectively, leading to the entire process coming to a halt. This acts as a factor that significantly undermines system stability.
[0005] Accordingly, the present invention aims to discuss a more empirical method regarding an AI agent system and its operation, wherein a plurality of agents are hierarchically organized to stably perform complex tasks, and each agent performs tasks through dynamic code execution and self-corrects errors that occur.
[0006] The aforementioned background technology is technical information that the inventor possessed for the derivation of the present invention or acquired during the process of deriving the present invention, and it cannot be considered technology that was known to the general public prior to the filing of the present invention. The problem to be solved
[0007] The problem to be solved through the disclosure of the present invention is to introduce a hierarchical structure with clear hierarchy and operating rules into a multi-agent system to fundamentally prevent the phenomenon of work deviation occurring during the performance of complex tasks and to secure structural predictability.
[0008] In addition, another objective is to maximize the efficiency and flexibility of complex logic processing and data flow control by enabling all agents to perform tasks by dynamically generating and executing code blocks directly, going beyond the limitations of 'tool calling'.
[0009] Furthermore, another objective is to provide a robust and stable AI agent system capable of completing tasks without interruption, even in the event of changes in the external environment or unpredictable exceptions, through a self-correction mechanism in which the agent recognizes errors occurring during code execution and modifies its solution strategy. means of solving the problem
[0010] The problem to be solved by the disclosure of the present invention may include a method performed by a hierarchical AI agent system, comprising the steps of: analyzing a task input from a user terminal and breaking it down into a plurality of sub-tasks, selecting a sub-node suitable for each sub-task, and establishing an execution plan; performing a top-down delegation step in which an upper agent node delegates a task to a lower agent node or a tool node according to the execution plan; performing a cyclic feedback loop of thought, action, and observation to perform the delegated task by the lower agent node, and dynamically generating and executing Python-based executable code in the action step; obtaining observation data including success output or error tracking information from the code execution result, and performing self-correction by feeding the said observation data as input to the next thought step; and, when the lower node completes the task, transmitting only the final result to the upper node through a bottom-up reporting mechanism.
[0011] In one embodiment, the step of analyzing a task input from a user terminal and breaking it down into a plurality of sub-tasks, and selecting a sub-node suitable for each sub-task to establish an execution plan may further include the step of subdividing the request of the user terminal into clear sub-goals.
[0012] In one embodiment, the step of analyzing a task input from a user terminal, breaking it down into a plurality of sub-tasks, and selecting a sub-node suitable for each sub-task to establish an execution plan may further include the step of determining the order and responsibility node of each sub-task by referring to the roles and input variables of the sub-nodes.
[0013] In one embodiment, the step of performing a circular feedback loop of thought, action, and observation to perform a delegated task by a subordinate agent node, and dynamically generating and executing Python-based executable code in the action step, may further include a step in which the code is executed in an execution environment independently embedded in each agent node and in which the state of other agent nodes is isolated.
[0014] In one embodiment, the step of performing a circular feedback loop of thought, action, and observation for a subordinate agent node to perform a delegated task, and dynamically generating and executing Python-based executable code in the action step, may further include a step of restricting the execution environment so that the code is executed according to a predefined list of allowed libraries.
[0015] In one embodiment, the step of obtaining observation data including success output or error tracking information from the code execution result and feeding the said observation data as input to the next incident step to perform self-correction may further include the step of analyzing an error message that occurred during code execution and inferring the cause of the error.
[0016] In one embodiment, the step of obtaining observation data including success output or error tracking information from the code execution result and feeding the said observation data as input to the next accident step to perform self-correction may further include the step of generating and re-executing modified code or an alternative strategy according to the inferred cause of error.
[0017] In one embodiment, the step of transmitting only the final result to the upper node through a bottom-up reporting mechanism when the lower node completes the task may further include the step of the lower node reporting only the key results of the delegated task to the upper agent, excluding intermediate logs or error records of the execution process.
[0018] In one embodiment, the 'think-act-observe' feedback loop may be characterized by operating as a closed loop that stably completes tasks even in unpredictable external environments by feeding back error information collected in the observation stage to the next thinking stage to dynamically modify the plan.
[0019] In one embodiment, the hierarchical structure of the hierarchical AI agent system is,
[0020] It may be characterized by forming a hierarchical structure in which a higher-level agent is responsible for strategic planning and resource allocation, and a lower-level agent autonomously performs detailed tasks, thereby improving the predictability and stability of the system. Effects of the invention
[0021] According to the means for solving the problem of the present invention described above, system stability and reliability are maximized through structural predictability. By arranging AI agents and tools in a hierarchical structure, the present invention applies strict rules of 'unidirectional task delegation from a higher agent to a lower agent' and 'reporting the results of a lower agent's work to a higher agent.' By fundamentally blocking indiscriminate horizontal interaction between agents, each agent is granted autonomy only within the scope of its role. This 'controlled autonomy' acts as a guardrail to prevent cascading error propagation or deviation from work that may occur during the performance of complex tasks, thereby ensuring that the entire system performs tasks stably without deviating from the user's initial goals.
[0022] Furthermore, according to the present invention, flexibility and scalability in problem solving are secured through dynamic code execution. Instead of calling predefined external tools, the agent directly generates and executes Python code. Through this, all tasks expressible by programming, such as file input / output, data processing, and the execution of complex logic through conditional statements and loops, can be performed immediately without the development of separate tools. This enables highly flexible responses to new requirements or changing environments. Existing external tools are treated as Python functions and can be freely called according to the generated code.
[0023] In addition, according to the present invention, the robustness of the system is enhanced through error feedback-based self-correction. When code generated by an agent is executed and an error (e.g., syntax error, API access failure, file absence, etc.) occurs, the system provides the relevant error information to the agent as feedback. Based on this feedback, the agent infers the cause of the problem and completes the task by modifying the code itself or attempting an alternative approach. This significantly increases the autonomy and stability of the system in a manner similar to the debugging process of a human developer. This is a characteristic feature that can be derived from the dynamic code generation and execution structure of the present invention, and can be naturally implemented by providing error messages from a Python interpreter executing the generated code to the agent.
[0024] In addition, according to the present invention, development productivity is increased through the modularization and reuse of agents and tools. The main agent, sub-agents responsible for specific specialized fields such as web browsing and database searching, and tools that may be dependent on the main agent or sub-agents are all designed as independent modules (nodes). Once developed, nodes can form a hierarchical structure through a simple process of specifying the hierarchical relationships between each node, and can be easily brought in and reused like Lego blocks when building other types of complex services, thereby drastically reducing overall development time and costs. Brief explanation of the drawing
[0025] FIG. 1 illustrates an exemplary environment in which a hierarchical AI agent system according to some embodiments of the present disclosure may be applied. FIGS. 2 to 6 are flowcharts relating to operations regarding interactive planning and dynamic code generation / execution self-correction functions that can be performed in a hierarchical AI agent system according to some embodiments of the present disclosure. FIGS. 7 to 11 are exemplary drawings of a hierarchical AI system implemented according to some embodiments of the present disclosure. FIG. 12 is a drawing of an exemplary computing device capable of implementing a device and / or system according to various embodiments of the present disclosure. Specific details for implementing the invention
[0026] Hereinafter, preferred embodiments of the present disclosure will be described in detail with reference to the attached drawings. The advantages and features of the present disclosure and the methods for achieving them will become clear by referring to the embodiments described below in detail together with the attached drawings. However, the technical concept of the present disclosure is not limited to the following embodiments but can be implemented in various different forms. The following embodiments are provided merely to complete the technical concept of the present disclosure and to fully inform those skilled in the art of the scope of the present disclosure, and the technical concept of the present disclosure is defined only by the scope of the claims.
[0027] It should be noted that when assigning reference numerals to the components of each drawing, the same components are given the same reference numeral whenever possible, even if they are shown in different drawings. Furthermore, in describing the present disclosure, if it is determined that a detailed description of related known components or functions could obscure the essence of the present disclosure, such detailed description is omitted.
[0028] Unless otherwise defined, all terms used herein (including technical and scientific terms) may be used in a meaning commonly understood by those skilled in the art to which this disclosure pertains. Additionally, terms defined in commonly used dictionaries are not to be interpreted ideally or excessively unless explicitly and specifically defined otherwise. The terms used herein are for describing the embodiments and are not intended to limit this disclosure. In this specification, the singular form includes the plural form unless specifically stated otherwise in the text.
[0029] Additionally, terms such as first, second, A, B, (a), (b), etc., may be used to describe the components of the present disclosure. These terms are intended only to distinguish the components from other components and do not limit the nature, order, or sequence of the components. Where it is stated that a component is "connected," "coupled," or "joined" to another component, it should be understood that the component may be directly connected or joined to the other component, but that another component may also be "connected," "coupled," or "joined" between each component.
[0030] As used in the specification, "comprises" and / or "comprising" do not exclude the presence or addition of one or more other components, steps, actions, and / or elements to the mentioned components, steps, actions, and / or elements.
[0031] Hereinafter, various embodiments of the present disclosure will be described in detail with reference to the attached drawings.
[0032] In addition, terms such as first, second, A, B, (a), (b), etc. may be used when describing the components of the present invention. These terms are intended merely to distinguish the components from other components, and the essence, order, or sequence of the components is not limited by these terms. Throughout the specification, when a part is described as 'comprising' or 'equipped' with a certain component, unless specifically stated otherwise, this means that it may include additional components rather than excluding other components. Furthermore, terms such as 'part' or 'module' described in the specification refer to a unit that processes at least one function or operation, and this may be implemented in hardware, software, or a combination of hardware and software.
[0034] FIG. 1 illustrates an exemplary environment in which a hierarchical AI agent system according to some embodiments of the present disclosure may be applied. Through a system including a user terminal (100) and a hierarchical AI agent system (200) as illustrated in FIG. 1, an artificial intelligence agent may provide operations to reliably perform complex tasks.
[0035] Below, we will explain in more detail the components shown in FIG. 1 related to task performance operations by utilizing the user terminal (100) and the hierarchical AI agent system (200) through the system described above.
[0036] FIG. 1 illustrates an example in which a user terminal (100) and a hierarchical AI agent system (200) are connected via a network, but this is merely for convenience of understanding, and the number of devices that can be connected to the network can vary.
[0037] Meanwhile, FIG. 1 merely illustrates a preferred embodiment for achieving the purpose of the present disclosure, and some components may be added or deleted as needed. Below, the components illustrated in FIG. 1 will be described in more detail.
[0038] The hierarchical AI agent system (200) can collect and analyze various information generated from the user terminal (100). The various information may include all data generated from the user terminal (100). In this case, the various information may refer to raw data for processing in relation to a large-scale language model, or all data for learning or processing in relation to a deep learning algorithm. Therefore, the various information is not interpreted as being limited to a specific form or storage format, and may include all data necessary when processing tasks in the artificial intelligence agent system.
[0039] The user terminal (100) illustrated in FIG. 1 may be implemented with one or more computing devices. For example, all functions of the user terminal (100) may be implemented in a single computing device. As another example, the first function of the user terminal (100) may be implemented in a first computing device, and the second function may be implemented in a second computing device. Here, the computing device may be a notebook, a desktop, a laptop, etc., but is not limited thereto and may include all types of devices equipped with computing functions.
[0040] Meanwhile, the hierarchical AI agent system (200) may also be implemented with one or more computing devices. For example, all functions of the hierarchical AI agent system (200) may be implemented in a single computing device. As another example, the first function of the hierarchical AI agent system (200) may be implemented in a first computing device, and the second function may be implemented in a second computing device. Here, the computing device may be a notebook, desktop, laptop, etc., but is not limited thereto and may include all types of devices equipped with computing functions. However, it may be preferable for the hierarchical AI agent system (200) to be implemented as a high-performance server-class computing device. An example of a computing device will be described with reference to FIG. 12.
[0041] Additionally, the functions that can be implemented in the hierarchical AI agent system (200) may also be implemented by utilizing an electronic device installed in the user terminal (100). Therefore, although the hierarchical AI agent system (200) and the user terminal (100) are depicted separately in FIG. 1, it is obvious that according to one embodiment, the hierarchical AI agent system (200) is installed in the user terminal (100) and a corresponding device within the user terminal (100) can implement the first function, the second function, etc. Accordingly, it should be noted that this interpretation is not limited to an embodiment in which the user terminal (100) and the hierarchical AI agent system (200) are externally separated as shown in FIG. 1.
[0042] For convenience of explanation, the present specification describes a situation in which a user terminal (100) and a hierarchical AI agent system (200) are separated to implement functions.
[0043] In some embodiments, components included in an environment where a hierarchical AI agent system (200) is applied can communicate through a network. The network can be implemented as any type of wired or wireless network, such as a Local Area Network (LAN), a Wide Area Network (WAN), a mobile radio communication network, or Wibro (Wireless Broadband Internet).
[0044] Meanwhile, although the environment illustrated in FIG. 1 is shown as being connected via a network through a user terminal (100) and a hierarchical AI agent system (200), the scope of the present disclosure is not limited thereto, and it should be noted that the user terminal (100) may also be connected to the hierarchical AI agent system (200) via P2P (Peer to Peer).
[0045] Up to now, with reference to FIG. 1, exemplary environments in which a corresponding device (200) according to some embodiments of the present disclosure may be applied have been described. Hereinafter, with reference to FIG. 2 and subsequent drawings, methods according to various embodiments of the present disclosure will be described in detail.
[0046] Each step of the methods described below may be performed by a computing device. In other words, each step of the methods may be implemented by one or more instructions executed by a processor of the computing device. All steps included in these methods may be performed by a single physical computing device, but the first steps of the methods may be performed by a first computing device and the second steps of the methods may be performed by a second computing device.
[0047] In FIG. 2 below, the explanation will continue assuming that each step of the methods is performed by the hierarchical AI agent system (200) exemplified in FIG. 1. However, for the convenience of explanation, the subject of the operation of each step included in the methods may be omitted.
[0049] FIGS. 2 to 6 are flowcharts relating to operations regarding interactive planning and dynamic code generation / execution self-correction functions that can be performed in a hierarchical AI agent system according to some embodiments of the present disclosure.
[0050] In step S100, the hierarchical AI agent system (200) can analyze a task input from a user terminal, break it down into multiple sub-tasks, and select a sub-node suitable for each sub-task to establish an execution plan. The task input from the user terminal may refer to input data entered by the user through the user terminal, and may be data regarding an initial request transmitted from the user terminal to the system.
[0051] Referring to FIG. 3, in step S110, the hierarchical AI agent system (200) can subdivide the user's request into clear sub-goals. In step S120, the hierarchical AI agent system (200) can determine the order and responsibility node of each sub-task by referring to the roles and input variables of the sub-nodes.
[0052] Returning to Fig. 2, in step S200, the hierarchical AI agent system (200) can perform a top-down delegation step in which a top agent node delegates work to a lower agent node or tool node according to an execution plan.
[0053] In step S300, the hierarchical AI agent system (200) performs a cyclic feedback loop of thinking, acting, and observing to perform tasks delegated to the subordinate agent nodes, and can dynamically generate and execute Python-based executable code in the acting step.
[0054] Referring to FIG. 4, in step S310, the hierarchical AI agent system (200) is executed in an execution environment built independently in each agent node and can execute code in a state isolated from other agent nodes. In step S320, the hierarchical AI agent system (200) can restrict the execution environment to execute code according to a predefined list of allowed libraries.
[0055] Returning to Fig. 2, in step S400, the hierarchical AI agent system (200) can obtain observation data including success output or error tracking information from the code execution result and feed the said observation data as input to the next thought step to perform self-correction.
[0056] Referring to FIG. 5, in step S410, the hierarchical AI agent system (200) can analyze the error message that occurred during code execution and infer the cause of the error. In step S420, the hierarchical AI agent system (200) can generate and re-execute modified code or a substituted strategy based on the inferred cause of the error.
[0057] Returning to Fig. 2, in step S500, the hierarchical AI agent system (200) can transmit only the final result to the upper node through a bottom-up reporting mechanism when the lower node completes the task. Referring to Fig. 6, in step S510, the hierarchical AI agent system (200) can report only the core results of the delegated task to the upper agent, excluding intermediate logs or error records of the execution process of the lower node.
[0058] Below, the agent node, tool node, top-down delegation, bottom-up reporting, planning, self-correcting cycle, and dynamic code executor described in detail in the present invention will be described in more detail.
[0060] FIGS. 7 to 11 are exemplary drawings of a hierarchical AI system implemented according to some embodiments of the present disclosure.
[0061] Referring to Figures 7 through 11, a Main Agent node is located at the root of the system to receive the user's initial request and act as the orchestrator of the entire task. To resolve its task, the Main Agent node can simultaneously possess subordinate agent nodes (SearchAgent, ImageGeneratorAgent) dedicated to tasks requiring complex reasoning, such as web browsing, and tool nodes (document_parser) that perform a clear single function, such as simply parsing the content of document data, as subordinate nodes. This structural flexibility allows for the dynamic configuration of optimal resources according to the nature of the task. Similarly, a subordinate agent node (e.g., SearchAgent) also has a recursive structure capable of having another subordinate agent node (e.g., DeepSearchAgent) and a tool node (e.g., google_search) as subordinate nodes to perform its task.
[0062] This means that each sub-agent functions as a complete, small-scale agent system in itself, providing scalability that allows for the formation of as many deep hierarchies as necessary to solve complex problems. In other words, the entire system is designed like a sophisticated machine assembled from reusable intelligent components (agent nodes) and simple components (tool nodes).
[0063] This structure is controlled by the two core operating principles of the present invention.
[0064] This structure is controlled by top-down delegation and bottom-up reporting, which are the core operating principles of the present invention.
[0065] Top-down Delegation: Work instructions are strictly transmitted only from the parent node to the child node. In this case, the parent agent does not need to know the complex internal implementation of the child nodes. Instead, it delegates abstract tasks by referencing a text description (subnodes_description)—which outlines the names, roles, and types of input parameters of the child nodes—much like an 'API specification,' effectively saying, "I entrust this work to you, who possesses these capabilities." This enables an effective division of roles, allowing the parent agent to focus solely on high-level strategy formulation and the child agent to concentrate on their respective areas of expertise. These principles of information hiding and encapsulation play a crucial role in reducing the overall system complexity to a manageable level.
[0066] Bottom-up Reporting: Lower nodes autonomously perform delegated tasks and may experience numerous internal trials and errors in the process (e.g., errors and self-correction occurring during ReAct cycles). However, detailed logs or failure records of these intermediate processes are not reported to the parent node at all. After completing all tasks, the lower node reports only the key deliverables related to the final delegated task to the parent node. This bottom-up reporting mechanism prevents the parent agent's finite cognitive resources (the context window in LLM) from being overwhelmed by unnecessary information and losing the context of the entire task. It serves as a critical guardrail, ensuring that the entire system performs tasks stably without deviating from the user's initial goals.
[0067] Agent nodes are key components responsible for intelligent decision-making and autonomous execution in this invention. All agent nodes are essentially identical in function and structure, and their roles are distinguished only by their position within the hierarchical structure.
[0068] Main Agent Node: Refers to the agent node located at the top (root) of the hierarchy that receives the user's initial request.
[0069] Sub-agent Node: Refers to an agent node located below another agent node that performs detailed tasks delegated by a parent agent.
[0070] Looking at Figures 7 through 11, all agent nodes perform two common core functions (a. planning, b. self-correcting ReAct cycle).
[0071] Planning
[0072] Planning is a highly sophisticated cognitive process in which an agent draws a blueprint for how to solve a given task. It begins by grasping the user's fundamental intent and context, going beyond simply reacting to keywords. The agent first analyzes the user's vague and comprehensive requests to define specific and clear sub-goals to be achieved. Subsequently, based on its role and the functional specifications (subnode_descriptions) of the sub-nodes (other agents or tools) available to it, it breaks down the overall task into multiple sub-tasks with logical sequential relationships. This process goes beyond merely listing steps; it takes on the nature of 'optimal resource allocation,' which involves comparing and evaluating the requirements of each sub-task with the capabilities of the sub-nodes to strategically select and assign the most suitable nodes. For example, if a summary is required after information retrieval, the agent recognizes that the search task must precede the summary task and incorporates this order into the plan. This systematically established plan serves as a detailed roadmap that enables the agent to move toward its goal without getting lost when faced with complex problems.
[0073] Self-Correcting React Cycle (React Cycle with Self-Correction)
[0074] Once a plan is established, the agent enters the ReAct cycle, a circular feedback loop of 'Thought → Action → Observation,' to perform the actual work. This is very similar to how human experts solve problems.
[0075] Thought: An internal monologue process of determining the most logical next step to be performed right now by comprehensively considering the current situation (previous observations or requested tasks) and the overall plan.
[0076] Action: This is the stage where the strategy determined in the 'Thinking' stage is generated into executable Python code and executed in the dynamic code executer described later. This code may be a simple function call or a complex script containing variable assignments, conditional statements, and loops.
[0077] Observation: This is the stage where the results of the code executed in the 'Action' stage are provided to the agent as feedback. The results provided to the agent in the 'Observation' stage are the unprocessed, raw results returned when the generated code is executed. Based on the execution results provided as feedback, the agent proceeds to the next ReAct loop. When generating code, the print() statement can be used to selectively specify the data to be output as feedback in the observation stage. The core of this invention is that these observation results include not only standard output (stdout) upon success but also detailed error traceback information (stderr traceback) upon failure. This 'error information feedback' is the starting point of the self-correction mechanism. The agent analyzes the observed error messages to clearly diagnose the cause of the failure in the next 'Accident' stage, such as, "Ah, a FileNotFoundError occurred. Since the file path is incorrect or the file does not exist, I should execute the code to check the path first," and establishes a new action plan to resolve it. Thanks to this closed-loop of learning from failure and correcting itself, the agent gains robustness that allows it to complete tasks without getting frustrated even when faced with unpredictable problems.
[0078] Termination of ReAct cycle: When the ReAct cycle has been repeated sufficiently to obtain the results for the delegated task, the agent generates code that calls the special tool node final_answer in the final 'action' stage, providing the final result and report as input variables. The generated code is executed by the dynamic code executor in the final 'observation' stage, and the final result and report passed to final_answer are delivered to the parent node by the bottom-up reporting mechanism.
[0079] Dynamic Code Executor (LocalPythonExecutor)
[0080] The dynamic code executor is independently embedded in each agent node and executes Python code generated by the agent during the 'action' phase of the ReAct cycle, returning the result. The fact that each agent possesses its own executor is one of the core structural features of the present invention, which ensures that each agent performs tasks autonomously with an independent state and memory space unaffected by the operations of other agents. For example, even if SearchAgent stores web page content in a variable named page_content, this variable does not affect the execution environment of ImageGeneratorAgent. This thorough state isolation fundamentally prevents unexpected side effects and conflicts that may occur when multiple agents perform tasks simultaneously or sequentially, and serves as a fundamental prerequisite for ensuring the stable operation of the agents. The dynamic code executor, which receives a Python code string generated by an agent as input, executes it in the actual system environment, and returns the result, has the following specific characteristics.
[0081] Selective execution environment for enhanced security (Sandboxing): It fundamentally blocks the use of dangerous libraries (e.g., os) that could harm the system and executes code using only safe libraries included in a predefined 'allowed library list' (e.g., requests, pandas). This provides an isolated execution environment that guarantees agent autonomy without compromising system stability.
[0082] Isolated Statefulness: As previously explained, since each agent has its own executor, the state of variables created during a ReAct cycle is maintained independently only within that agent, and agents can reference or modify variables created in their previous ReAct cycles. This independence prevents conflicts or side effects between agents and enables the efficient execution of complex multi-step data processing tasks.
[0083] Transparency of Asynchronous Processing: Modern high-performance web services often communicate asynchronously. Dynamic code executors internally manage the event loop, abstracting asynchronous code generated by agents (e.g., async / await statements) so that it can be executed as simply as synchronous code. The burden of reasoning is significantly reduced because agents only need to generate intuitive code for the necessary tasks, without having to worry about the internal workings of complex asynchronous programming.
[0084] Ease of debugging through explicit execution: All actions of the agent are recorded in explicit, human-readable Python code. If the agent behaves differently than intended, developers can very easily and quickly identify the cause of the problem by directly examining the code generated by the agent.
[0085] Below, an exemplary computing device in which a hierarchical AI agent system (200) can be implemented will be described in detail through FIG. 12.
[0087] FIG. 12 is a drawing of an exemplary computing device capable of implementing a device and / or system according to various embodiments of the present disclosure.
[0088] A computing device (1500) may include one or more processors (1510), a bus (1550), a communication interface (1570), a memory (1530) for loading a computer program (1591) executed by the processor (1510), and a storage (1590) for storing the computer program (1591). However, only components related to the embodiments of the present disclosure are illustrated in FIG. 12. Accordingly, a person skilled in the art to which the present disclosure belongs will understand that other general-purpose components may be included in addition to the components illustrated in FIG. 12.
[0089] The processor (1510) controls the overall operation of each component of the computing device (1500). The processor (1510) may be configured to include a CPU (Central Processing Unit), an MPU (Micro Processor Unit), an MCU (Micro Controller Unit), a GPU (Graphic Processing Unit), or any form of processor well known in the art of the present disclosure. Additionally, the processor (1510) may perform operations for at least one application or program for executing the method according to the embodiments of the present disclosure. The computing device (1500) may have one or more processors.
[0090] The memory (1530) stores various data, commands and / or information. The memory (1530) may load one or more programs (1591) from storage (1590) to execute a method according to embodiments of the present disclosure. The memory (1530) may be implemented as volatile memory such as RAM, but the technical scope of the present disclosure is not limited thereto.
[0091] The bus (1550) provides communication functions between components of the computing device (1500). The bus (1550) can be implemented as various types of buses, such as an address bus, a data bus, and a control bus.
[0092] The communication interface (1570) supports wired and wireless internet communication of the computing device (1500). Additionally, the communication interface (1570) may support various communication methods other than internet communication. To this end, the communication interface (1570) may be configured to include a communication module well known in the art of the present disclosure.
[0093] According to some embodiments, the communication interface (1570) may be omitted.
[0094] Storage (1590) can store one or more of the above programs (1591) and various data non-temporarily.
[0095] Storage (1590) may be configured to include non-volatile memory such as ROM (Read Only Memory), EPROM (Erasable Programmable ROM), EEPROM (Electrically Erasable Programmable ROM), flash memory, a hard disk, a removable disk, or any form of computer-readable recording medium well known in the art to which this disclosure belongs.
[0096] A computer program (1591) may include one or more instructions that cause a processor (1510) to perform a method / operation according to various embodiments of the present disclosure when loaded into memory (1530). That is, the processor (1510) may perform a method / operation according to various embodiments of the present disclosure by executing the one or more instructions.
[0097] Various embodiments of the present disclosure and effects according to those embodiments have been described with reference to FIGS. 1 to 12. The effects according to the technical concept of the present disclosure are not limited to those mentioned above, and other unmentioned effects will be clearly understood by a person skilled in the art from the description in the specification.
[0098] The technical concept of the present disclosure, as described so far with reference to FIGS. 1 to 12, may be implemented as computer-readable code on a computer-readable medium. The computer-readable recording medium may be, for example, a removable recording medium (CD, DVD, Blu-ray disc, USB storage device, removable hard disk) or a fixed recording medium (ROM, RAM, computer-equipped hard disk). The computer program recorded on the computer-readable recording medium may be transmitted to another computing device via a network such as the Internet and installed on the other computing device, thereby being used on the other computing device.
[0099] In the foregoing, although all components constituting the embodiments of the present disclosure have been described as being combined or operating together, the technical concept of the present disclosure is not necessarily limited to such embodiments. That is, within the scope of the purpose of the present disclosure, all components may be selectively combined and operated in one or more ways.
[0100] Although operations are depicted in a specific order in the drawings, it should not be understood that the operations must be executed in the specific order depicted or in a sequential order, or that all depicted operations must be executed to obtain the desired result. In certain situations, multitasking and parallel processing may be advantageous. Furthermore, the separation of the various configurations in the embodiments described above should not be understood as a necessary separation, and it should be understood that the described program components and systems can generally be integrated together into a single software product or packaged into multiple software products.
[0101] Although embodiments of the present disclosure have been described above with reference to the attached drawings, those skilled in the art will understand that the present disclosure may be practiced in other specific forms without changing the technical concept or essential features thereof. Therefore, the embodiments described above should be understood as illustrative in all respects and not restrictive. The scope of protection of the present disclosure shall be interpreted by the claims below, and all technical concepts within the equivalent scope shall be interpreted as being included within the scope of rights of the technical concept defined by the present disclosure.
Claims
Claim 1 A method performed by a hierarchical AI agent system comprises: a step of analyzing a task input from a user terminal to break it down into multiple sub-tasks, selecting a sub-node suitable for each sub-task, and establishing an execution plan; a step of performing a top-down delegation step in which an upper agent node delegates a task to a lower agent node or a tool node according to the execution plan; a step of performing a cyclic feedback loop of thought, action, and observation for the lower agent node to perform the delegated task, and dynamically generating and executing Python-based executable code in the action step; a step of obtaining observation data including success output or error tracking information from the code execution result, and performing self-correction by feeding the said observation data as input to the next thought step; and a step of transmitting only the final result to the upper node through a bottom-up reporting mechanism when the lower agent node completes the task.It includes, for a subordinate agent node to perform a delegated task, a circular feedback loop of thought, action, and observation is executed; the step of dynamically generating and executing Python-based executable code during the action phase is performed in an execution environment independently embedded in each agent node; it further includes a step in which the code is executed with the state of other agent nodes isolated, and a step in which the execution environment restricts the execution of the code according to a predefined list of allowed libraries; and in the step in which, when the subordinate agent node completes the task, only the final result is transmitted to the parent node via a bottom-up reporting mechanism, the subordinate node generates code that calls the special tool node 'final_answer' by providing the final result and report as input variables; the generated code is executed by a dynamic code executer, which is independently embedded in each agent node, and each agent runs in an independent state and memory space unaffected by the work of other agents; when subordinate agent nodes perform tasks simultaneously or sequentially, the state of the generated variables is maintained independently only within that agent node; and the subordinate agent node has a self-correcting function based on interactive planning and dynamic code generation / execution, which involves referencing or modifying the variables generated in the subordinate agent node's circular feedback loop. Operation method of a hierarchical AI agent system.; Claim 2 A method of operation of a hierarchical AI agent system having a self-correcting function based on interactive planning and dynamic code generation / execution, wherein the step of analyzing a task input from a user terminal and breaking it down into a plurality of sub-tasks, and selecting a sub-node suitable for each sub-task to establish an execution plan, further includes the step of subdividing the request of the user terminal into clear sub-goals. Claim 3 A method of operation of a hierarchical AI agent system having a self-correcting function based on interactive planning and dynamic code generation / execution, wherein the step of analyzing a task input from a user terminal, breaking it down into multiple sub-tasks, and selecting a sub-node suitable for each sub-task to establish an execution plan further includes the step of determining the order and responsibility node of each sub-task by referring to the roles and input variables of the sub-nodes. Claim 4 delete Claim 5 delete Claim 6 A method of operation of a hierarchical AI agent system having a self-correction function based on interactive planning and dynamic code generation / execution, wherein the step of obtaining observation data including success output or error tracking information from the result of code execution and feeding the said observation data as input to the next thought stage to perform self-correction further includes the step of analyzing error messages that occurred during code execution and inferring the cause of the error. Claim 7 A method of operation of a hierarchical AI agent system having a self-correction function based on interactive planning and dynamic code generation / execution, wherein, in claim 6, the step of obtaining observation data including success output or error tracking information from the result of code execution and feeding the said observation data as input to the next thought stage to perform self-correction further includes the step of generating and re-executing modified code or an alternative strategy according to the inferred cause of error. Claim 8 A method of operation of a hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution, wherein, in claim 1, the step of transmitting only the final result to the upper node through a bottom-up reporting mechanism when the lower node completes the task further includes the step of the lower node reporting only the core deliverables of the delegated task to the upper agent, excluding intermediate logs or error records of the execution process. Claim 9 A method of operation of a hierarchical AI agent system having a self-correcting function based on interactive planning and dynamic code generation / execution, wherein, in claim 1, the 'think-action-observation' feedback loop operates as a closed loop that stably completes a task even in an unpredictable external environment by feeding back error information collected in the observation stage to the next thinking stage to dynamically modify the plan. Claim 10 A method of operation of a hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution, wherein, in claim 9, the hierarchical structure of the hierarchical AI agent system forms a hierarchical structure in which a higher agent is responsible for strategic planning and resource allocation, and a lower agent autonomously performs detailed tasks, thereby improving the predictability and stability of the system. Claim 11 A processor; a network interface; memory; and a computer program loaded into the memory and executed by the processor, wherein the processor comprises: an instruction for analyzing a task input from a user terminal, breaking it down into a plurality of sub-tasks, selecting a sub-node suitable for each sub-task, and establishing an execution plan; an instruction for performing a top-down delegation step in which an upper agent node delegates a task to a lower agent node or a tool node according to the execution plan; an instruction for performing a cyclic feedback loop of thought, action, and observation to enable the lower agent node to perform the delegated task, and for dynamically generating and executing Python-based executable code in the action step; an instruction for obtaining observation data including success output or error tracking information from the code execution result, and feeding the said observation data as input to the next thought step to perform self-correction; and an instruction for transmitting only the final result to the upper node through a bottom-up reporting mechanism when the lower agent node completes the task.It performs including, and for subordinate agent nodes to execute delegated tasks, it performs a circular feedback loop of thought, action, and observation; instructions that dynamically generate and execute Python-based executable code during the action phase are executed in an execution environment independently embedded in each agent node; it further includes instructions where code is executed with the state of other agent nodes isolated, and instructions that restrict the execution environment to code execution according to a predefined list of allowed libraries; and in an instruction that transmits only the final result to the parent node via a bottom-up reporting mechanism when the subordinate agent node completes the task, the subordinate node generates code that calls the special tool node `final_answer` by providing the final result and report as input variables; the generated code is executed by a dynamic code executer, which is independently embedded in each agent node, and each agent runs in an independent state and memory space unaffected by the work of other agents; when subordinate agent nodes perform tasks simultaneously or sequentially, the state of the generated variables is maintained independently only within that agent node, and the subordinate agent node references or modifies the variables generated in the subordinate agent node's circular feedback loop A hierarchical AI agent system with self-correcting capabilities based on interactive planning and dynamic code generation / execution. Claim 12 A hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution, wherein the instruction for analyzing a task input from a user terminal and breaking it down into multiple sub-tasks, and selecting a sub-node suitable for each sub-task to establish an execution plan, further includes an instruction for subdividing the request of the user terminal into clear sub-goals. Claim 13 A hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution, wherein, in paragraph 12, an instruction for analyzing a task input from a user terminal and breaking it down into multiple sub-tasks, and for selecting a sub-node suitable for each sub-task to establish an execution plan, further includes an instruction for determining the order and responsibility node of each sub-task by referring to the roles and input variables of the sub-nodes. Claim 14 delete Claim 15 delete Claim 16 In claim 11, the instruction to obtain observation data including success output or error tracking information from the result of code execution and to feed back said observation data as input to the next thought stage to perform self-correction further includes an instruction to analyze error messages that occurred during code execution and infer the cause of the error, thereby having a hierarchical AI agent system having an interactive planning and dynamic code generation / execution-based self-correction function. Claim 17 A hierarchical AI agent system having self-correction capabilities based on interactive planning and dynamic code generation / execution, wherein, in claim 16, an instruction to perform self-correction by obtaining observation data including success output or error tracking information from the result of code execution and feeding said observation data as input to the next thought stage further includes an instruction to re-execute by generating modified code or an alternative strategy according to the inferred cause of error. Claim 18 A hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution, wherein, in paragraph 11, when a subordinate node completes a task, the instruction to transmit only the final result to the superior node through a bottom-up reporting mechanism further includes an instruction for the subordinate node to report only the core deliverables of the delegated task to the superior agent, excluding intermediate logs or error records of the execution process. Claim 19 A hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution, wherein the 'Think-Act-Observe' feedback loop operates as a closed loop that stably completes tasks even in unpredictable external environments by feeding back error information collected in the observation stage to the next thinking stage to dynamically modify the plan. Claim 20 In claim 19, the hierarchical structure of the hierarchical AI agent system is characterized by forming a hierarchical structure in which a higher-level agent is responsible for strategic planning and resource allocation, and a lower-level agent autonomously performs detailed tasks, thereby improving the predictability and stability of the system, and is a hierarchical AI agent system having self-correcting functions based on interactive planning and dynamic code generation / execution.