Autonomous control method and system of agent based on behavior tree and large language model
Patent Information
- Application Number
- CN202611424019.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-15
- Publication Date
- 2026-10-20
AI Technical Summary
第一,计算成本高:对于多步骤任务,需要执行多次大语言模型调用,且每次调用需处理不断累积的对话上下文,计算成本随任务步骤数量呈爆炸性增长
本发明的基于行为树与大语言模型的智能体自主控制方法及系统,通过将任务规划与任务执行相分离,先利用大语言模型一次性生成能够覆盖完整任务步骤的行为树配置,而后基于行为树配置构建行为树实例,由行为树实例按照其固有的控制流语义驱动各节点依次执行,且在各节点正常执行过程中不调用大语言模型,仅在节点出现异常时由内嵌的执行智能机制按需介入处理,能够将大语言模型的调用次数从与任务步骤数相关的线性复杂度降至常量级别,显著降低了计算成本与响应延迟,同时以行为树的结构化控制流消除了传统对话式架构中的决策不确定性与循环执行风险,实现了系统行为的可测试、可验证与可预测,并使得整个系统能够在资源受限的边缘设备上以小参数规模的大语言模型实现完全离线部署。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent agent control technology, and in particular to an intelligent agent autonomous control method and system based on behavior tree and large language model. Background Technology
[0002] With the rapid development of large language models, they have demonstrated powerful capabilities in natural language understanding and generation, and are beginning to be widely applied in autonomous intelligent agent systems. Currently, mainstream autonomous control schemes based on large language models generally adopt a conversational tool invocation architecture. Under this architecture, the system employs an agent execution mode of observation-thinking-action loop. For each step, the current dialogue context is input into the large language model, which determines the next tool to invoke or the operation to be performed. The tool execution result is then appended to the dialogue history, and the large language model again participates in the decision-making process in the next round, repeating this cycle until the task is completed.
[0003] However, existing autonomous control schemes based on large language models have the following shortcomings in multi-step task execution: First, high computational cost: For multi-step tasks, multiple calls to the large language model are required, and each call needs to process the continuously accumulating dialogue context. The computational cost increases explosively with the number of task steps. Second, cumulative response latency: Multi-step serial calls cause end-to-end response latency to increase linearly with the number of steps, making it difficult to meet the requirements of autonomous tasks with hard real-time constraints, such as collision avoidance and real-time control. Third, uncertainty in decision-making behavior: The large language model itself has probabilistic generation characteristics. Even if the temperature parameter is set to zero, small differences in the tool's execution results may still be mapped to different subsequent outputs by the large language model, leading to unpredictable deviations in the decision path. Test cases that pass ground testing may also generate different decision sequences in real-world operation due to changes in context, making it impossible to strictly reproduce and reliably verify the system behavior. Fourth, risk of loop execution: When the large language model faces abnormal or ambiguous state information, it may repeatedly make the same erroneous decisions, falling into an execution loop that cannot exit self-consistently, resulting in wasted computational resources or even system loss of control. Fifth, cloud dependence and extremely high computing power requirements: Existing solutions generally rely on cloud-deployed large models with hundreds of billions of parameters, which must maintain a network connection to operate. This makes them unsuitable for environments with limited communication or prohibited network access, such as spacecraft and unmanned underwater vehicles. Furthermore, they pose data security risks and uncontrollable response delays. Even if local deployment is attempted, the requirements of ultra-large parameter models for video memory, RAM, and power consumption far exceed the carrying capacity of airborne computers or embedded edge devices, making it difficult to implement in resource-constrained autonomous intelligent agent systems. Summary of the Invention
[0004] To address some or all of the technical problems existing in the prior art, this invention provides an intelligent agent autonomous control method and system based on behavior trees and large language models.
[0005] The technical solution of the present invention is as follows: Firstly, a method for autonomous control of intelligent agents based on behavior trees and large language models is provided, including: Receive task requirements from user input; The intent of the task requirement is parsed using a large language model to determine the intent type of the task requirement; When the intent type of the task requirement is determined to be task-oriented, tools and / or skills related to the task requirement are selected from the preset tool and skill library to form a set of tools and skills; Using the large language model, a behavior tree configuration that can cover the complete task steps is generated based on the task requirements and the set of tools and skills. The behavior tree configuration is parsed to construct a behavior tree instance; According to the control flow semantics of the behavior tree instance, each node in the behavior tree instance is driven to execute sequentially, wherein the large language model is not called during the normal execution of each node; During the execution of each node, for the target node that is determined to be a tool node or a skill node, the corresponding tool or skill is scheduled to perform the operation, and the operation is verified using a preset security check mechanism. When the verification result is abnormal, the abnormality is handled using the execution intelligence mechanism embedded in the target node. After all nodes of the behavior tree instance have been executed, the execution result is output.
[0006] Furthermore, in some alternative implementations, the intent type also includes casual and unsupported types; When the intent type of the task requirement is determined to be casual conversation, a response is directly generated using the large language model. When the intent type of the task requirement is determined to be unsupported, the large language model is used to provide feedback that execution is not supported and to output the reason for non-execution.
[0007] Furthermore, in some optional implementations, the step of selecting tools and / or skills related to the task requirements from a preset tool and skill library to form a tool and skill set includes: The tools and skills in the tool and skill library are hierarchically organized and classified according to functional domains to form a tree index structure. Based on the tree index structure, the tool and skill library is coarsely screened to determine the tool categories and / or skill categories related to the task requirements, thereby obtaining a set of candidate tools and skills. The semantic similarity between the task requirements and each candidate tool and / or skill in the candidate tool and skill set is calculated using an embedding model. The k most relevant tools and / or skills are filtered according to a preset similarity threshold and returned as the tool and skill set, where k is a preset value.
[0008] Furthermore, in some optional implementations, the behavior tree instance includes: a preset survival behavior tree and a service behavior tree constructed by configuring the behavior tree, wherein the survival behavior tree is used to handle the survival assurance behavior of the agent, and the service behavior tree is used to handle the task requirements; The survival behavior tree and the service behavior tree are merged through a selection node, and the survival behavior tree has a higher execution priority than the service behavior tree; During the execution of the behavior tree instance, the survival behavior tree is executed first, and when the survival behavior tree determines that the survival conditions are met, the service behavior tree is executed.
[0009] Furthermore, in some optional implementations, the execution intelligence mechanism includes: Exceptions can be handled using any of the following modes: inference-only, confirmation-only, and hybrid. In the inference-only mode, the large language model is invoked to automatically infer the cause of the anomaly and attempt to fix it based on the local context of the target node; In the confirmation-only mode, the execution of the target node is paused, an interaction request is generated to obtain user confirmation or supplementary information, and execution continues based on user feedback; In the hybrid mode, the large language model is first invoked to automatically infer the cause of the anomaly based on the local context of the target node and attempt to repair it. If the repair fails, the execution of the target node is paused, an interaction request is generated to obtain user confirmation or supplementary information, and execution continues based on user feedback.
[0010] Furthermore, in some optional implementations, the method further includes: The cached behavior tree configuration and its corresponding task requirements are successfully executed, and an expiration date is set for each cached record. When the cache duration exceeds the expiration date, the corresponding cached record is cleared.
[0011] Furthermore, in some optional implementations, the method further includes: Before using the large language model to parse the intent of the task requirement, query whether there is a cached behavior tree configuration that matches the task requirement; If it exists, use the cached behavior tree configuration as the behavior tree configuration corresponding to the task requirement.
[0012] Secondly, an intelligent agent autonomous control system based on behavior trees and large language models is also provided, including: The receiving module is used to receive task requirements input by the user; The intent parsing module is used to parse the intent of the task requirement using a large language model and determine the intent type of the task requirement. The tool and skill context management module is used to filter tools and / or skills related to the task requirement from a preset tool and skill library when the intent type of the task requirement is determined to be task-oriented, and form a set of tools and skills. The behavior tree configuration generation module is used to generate a behavior tree configuration that can cover the complete task steps by utilizing the large language model and based on the task requirements and the set of tools and skills. The behavior tree generation module is used to parse the behavior tree configuration and construct a behavior tree instance; The behavior tree execution module is used to drive each node in the behavior tree instance to execute sequentially according to the control flow semantics of the behavior tree instance, wherein the large language model is not called during the normal execution of each node; The Tools and Skills Service Module is used to schedule corresponding tools or skills to perform operations on target nodes that are determined to be tool nodes or skill nodes during the execution of each node, and to verify the operations using a preset security check mechanism. When the verification result is abnormal, the abnormality is handled using the execution intelligence mechanism embedded in the target node. The result output module is used to output the execution result after all nodes of the behavior tree instance have been executed.
[0013] Furthermore, in some optional implementations, the system further includes: a caching module; The caching module is used to cache the successfully executed behavior tree configuration and its corresponding task requirements, and to set an expiration date for each cached record. When the cache duration exceeds the expiration date, the corresponding cached record is cleared.
[0014] Furthermore, in some optional implementations, the system further includes: a query module; The query module is used to query whether there is a cached behavior tree configuration that matches the task requirement before the intent parsing module uses the large language model to parse the intent of the task requirement. If there is, the cached behavior tree configuration is used as the behavior tree configuration corresponding to the task requirement.
[0015] The main advantages of the technical solution of this invention are as follows: The present invention relates to an intelligent agent autonomous control method and system based on behavior trees and a large language model. By separating task planning from task execution, the method first uses a large language model to generate a behavior tree configuration that covers all task steps in one go. Then, behavior tree instances are constructed based on the behavior tree configuration. The behavior tree instances drive each node to execute sequentially according to their inherent control flow semantics. During the normal execution of each node, the large language model is not called. Only when a node encounters an anomaly, the embedded execution intelligence mechanism intervenes as needed. This reduces the number of calls to the large language model from a linear complexity related to the number of task steps to a constant level, significantly reducing computational costs and response latency. At the same time, the structured control flow of the behavior tree eliminates the decision uncertainty and circular execution risk in traditional conversational architectures, making the system behavior testable, verifiable, and predictable. Furthermore, the entire system can be fully deployed offline on resource-constrained edge devices with a small-parameter-scale large language model. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and constitute a part of this invention, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 A flowchart illustrating an intelligent agent autonomous control method based on behavior tree and large language model provided in an embodiment of the present invention; Figure 2 A schematic diagram of the structure of an intelligent agent autonomous control system based on behavior tree and large language model provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of another intelligent agent autonomous control system based on behavior tree and large language model provided in an embodiment of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0018] The technical solutions provided by the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0019] See Figure 1 This invention provides an agent autonomous control method based on behavior trees and a large language model, the method comprising: Step 1: Receive the task requirements input by the user; Step 2: Use a large language model to analyze the intent of the task requirements and determine the intent type of the task requirements; Step 3: When the intent type of the task requirement is determined to be task-oriented, tools and / or skills related to the task requirement are selected from the preset tool and skill library to form a set of tools and skills. Step 4: Using a large language model, generate a behavior tree configuration that can cover the complete task steps based on task requirements and the set of tools and skills. Step 5: Parse the behavior tree configuration and construct a behavior tree instance; Step 6: Drive each node in the behavior tree instance to execute sequentially according to the control flow semantics of the behavior tree instance. During the normal execution of each node, the large language model is not called. Step 7: During the execution of each node, for the target node that is determined to be a tool node or skill node, the corresponding tool or skill is scheduled to perform the operation, and the operation is verified using a pre-set security check mechanism. When the verification result is abnormal, the abnormality is handled using the execution intelligence mechanism embedded in the target node. Step 8: After all nodes of the behavior tree instance have been executed, output the execution result.
[0020] In this embodiment of the invention, the intent type also includes chatty and unsupported types; when the intent type of the task requirement is determined to be chatty, a response is directly generated using a large language model; when the intent type of the task requirement is determined to be unsupported, the large language model is used to provide feedback that execution is not supported and to output the reason for non-execution.
[0021] In this embodiment of the invention, the large language model adopts a small large language model with a parameter size not exceeding 4B, and can run in an offline environment. The specific type of large language model is set according to actual needs, such as Qwen2.5-4B, DeepSeek-V2-Lite, etc.
[0022] In this embodiment of the invention, the tools and skills library are set according to actual needs.
[0023] In this embodiment of the invention, the behavior tree configuration is described in JSON format. The behavior tree configuration includes the node types of the behavior tree, the hierarchical relationship between nodes, and the input parameters of each node. The node types described in the behavior tree configuration include control nodes and action nodes. Control nodes include, but are not limited to, sequential nodes, selection nodes, and parallel nodes. Action nodes include, but are not limited to, tool nodes and skill nodes. Sequential nodes are used to execute all their child nodes sequentially. Selection nodes are used to attempt to execute their child nodes sequentially until a child node returns a success or running status. Parallel nodes are used to execute all their child nodes in parallel.
[0024] In this embodiment of the invention, a runnable behavior tree instance is constructed by parsing the behavior tree configuration. The topology, execution order, and parameter configuration of each node in the behavior tree instance are fully defined by the behavior tree configuration.
[0025] In this embodiment of the invention, each node in the behavior tree instance is executed sequentially in a deterministic manner according to the control flow semantics of the behavior tree instance. The execution process is entirely driven by the behavior tree logic. During the normal execution of each node in the behavior tree instance, the large language model is not called.
[0026] In this embodiment of the invention, the security check mechanism is set according to actual needs.
[0027] In this embodiment of the invention, the execution intelligent mechanism is set according to actual needs and embedded in the node.
[0028] The autonomous control method for intelligent agents based on behavior trees and large language models provided in this invention separates task planning from task execution. First, a behavior tree configuration covering all task steps is generated at once using a large language model. Then, behavior tree instances are constructed based on the behavior tree configuration. The behavior tree instances drive each node to execute sequentially according to their inherent control flow semantics. During the normal execution of each node, the large language model is not called. Only when a node encounters an anomaly, the embedded execution intelligence mechanism intervenes as needed. This reduces the number of calls to the large language model from a linear complexity related to the number of task steps to a constant level, significantly reducing computational costs and response latency. At the same time, the structured control flow of behavior trees eliminates decision uncertainty and the risk of loop execution in traditional conversational architectures, making the system behavior testable, verifiable, and predictable. Furthermore, the entire system can be fully deployed offline on resource-constrained edge devices using a large language model with a small parameter scale.
[0029] Furthermore, in this embodiment of the invention, tools and / or skills related to task requirements are selected from a preset tool and skill library to form a tool and skill set, including: The tools and skills in the tool and skill library are hierarchically organized and classified according to functional domains to form a tree index structure. Based on the tree index structure, the tool and skill library is coarsely screened to determine the tool categories and / or skill categories related to task requirements, and a candidate tool and skill set is obtained. The semantic similarity between the task requirements and each candidate tool and / or skill in the candidate tool and skill set is calculated using an embedding model. The k most relevant tools and / or skills are filtered according to a preset similarity threshold and returned as the tool and skill set, where k is a preset value.
[0030] In this embodiment of the invention, to reduce the contextual burden on the large language model when generating behavior tree configurations, a hierarchical filtering strategy is adopted to select tools and / or skills related to task requirements from a preset tool and skill library, forming a set of tools and skills. The first layer of filtering involves: hierarchically organizing and classifying the tools and skills in the tool and skill library according to functional domains to form a tree-like index structure; using this tree-like index structure to perform a coarse screening of the tool and skill library to determine the categories of tools and / or skills related to task requirements, thus obtaining a set of candidate tools and skills; the second layer of filtering involves: using an embedding model to calculate the semantic similarity between the task requirements and each candidate tool and / or candidate skill in the candidate tool and skill set; filtering according to a preset similarity threshold and returning the k most relevant tools and / or skills as the set of tools and skills.
[0031] In this embodiment of the invention, the specific values of the similarity threshold and the preset value k are set according to actual needs.
[0032] In this embodiment of the invention, the embedded model is deployed according to actual needs.
[0033] In this embodiment of the invention, a two-level hierarchical screening strategy of tree index coarse screening and semantic vector fine screening is adopted. In the first layer of screening, the tree index structure is used to quickly screen the candidate range. In the second layer of screening, the embedding model is used to perform semantic fine screening on the candidate range. In this way, while ensuring the recall and accuracy of tool and skill screening, the context length of subsequent input to the large language model is significantly compressed, reducing the information burden of the large language model when generating behavior tree configuration. This ensures that behavior tree configuration covering the complete task steps can still be generated efficiently and accurately under the condition of limited parameter scale.
[0034] Furthermore, in this embodiment of the invention, the behavior tree instance includes: a preset survival behavior tree and a service behavior tree constructed by configuring the behavior tree. The survival behavior tree is used to handle the survival guarantee behavior of the intelligent agent, and the service behavior tree is used to handle task requirements. The survival behavior tree and the service behavior tree are merged through a selection node, and the survival behavior tree has a higher execution priority than the service behavior tree; During the execution of a behavior tree instance, the survival behavior tree is executed first, and the service behavior tree is executed when the survival behavior tree determines that the survival conditions are met.
[0035] In this embodiment of the invention, the survival behavior tree is a pre-set innate behavior framework that is solidified at the bottom layer of the system. The survival behavior tree is used to handle the survival assurance behavior of the agent when there are no external instructions. The survival assurance behavior includes behaviors such as energy management, thermal control protection, and collision avoidance.
[0036] In this embodiment of the invention, a service behavior tree is constructed by parsing the behavior tree configuration. The service behavior tree is used to process the task requirements input by the user.
[0037] In this embodiment of the invention, by merging a pre-set survival behavior tree with a service behavior tree dynamically constructed from the behavior tree configuration through node selection, and by giving the survival behavior tree a higher execution priority than the service behavior tree, survival assurance behaviors are checked and executed first in each execution cycle of the behavior tree instance. User tasks are only executed when survival conditions are met. This enables a hard guarantee mechanism of "safety first" at the architectural level, ensuring that the agent responds to survival threats (such as insufficient energy, collision risks, etc.) first under any circumstances. The survival behavior tree, as a deterministic logic solidified at the bottom layer, does not rely on the generation of a large language model, fundamentally eliminating the uncertainty of safety-critical behaviors. At the same time, it completely decouples the safety assurance logic from the task execution logic, further improving the robustness, security, and maintainability of the system.
[0038] Furthermore, in this embodiment of the invention, the security check mechanism includes at least one of parameter range verification and permission verification; parameter range verification is used to check whether the input parameters are within a preset security range, such as whether the numerical parameters exceed physical limits, whether the coordinate parameters are within the executable workspace range, etc.; permission verification is used to check whether the current operation has execution permission, such as whether the current user or task has the security level authorization to call the tool, whether the operation is allowed to be executed in the current running mode, etc.
[0039] In this embodiment of the invention, by performing dual deterministic verification of parameter range and permissions before the operation of tool nodes and skill nodes, the legality of the operation is automatically intercepted in real time, which can ensure the security of action execution from the bottom layer without relying on the intervention of a large language model.
[0040] Furthermore, in this embodiment of the invention, the execution of the intelligent mechanism includes: Exceptions can be handled using any of the following modes: inference-only, confirmation-only, and hybrid. In inference-only mode, the large language model is invoked to automatically infer the cause of the anomaly and attempt to fix it based on the local context of the target node; In confirm-only mode, the execution of the target node is paused, an interaction request is generated to obtain user confirmation or supplementary information, and execution continues based on user feedback; In hybrid mode, the large language model is first invoked to automatically infer the cause of the anomaly based on the local context of the target node and attempt to fix it. If the fix fails, the execution of the target node is paused, an interaction request is generated to obtain user confirmation or supplementary information, and execution continues based on user feedback.
[0041] In this embodiment of the invention, by utilizing the above-mentioned intelligent execution mechanism to handle anomalies, the invocation of the large language model can be strictly limited to when a node anomaly occurs and it is indeed necessary. This ensures the smooth autonomous operation of the system while taking into account the safety of high-risk operations, achieving a balance between anomaly recovery efficiency and human-machine collaborative controllability.
[0042] Furthermore, in this embodiment of the invention, the method further includes the following steps: The cached behavior tree configuration and its corresponding task requirements are successfully executed, and an expiration date is set for each cached record. When the cache duration exceeds the expiration date, the corresponding cached record is cleared.
[0043] In this embodiment of the invention, the validity period is set according to actual needs, for example, it is set to 30 days.
[0044] In this embodiment of the invention, when the cache duration of a cached record exceeds the validity period, the cached record is cleared.
[0045] In this embodiment of the invention, an SQLite database caching behavior tree configuration and its corresponding task requirements are adopted.
[0046] Furthermore, in this embodiment of the invention, in addition to caching the successfully executed behavior tree configuration, the method further includes: Before using the large language model to parse the intent of the task requirements, query whether there is a cached behavior tree configuration that matches the task requirements; If it exists, use the cached behavior tree configuration as the behavior tree configuration corresponding to the task requirements.
[0047] In this embodiment of the invention, if there is a cached behavior tree configuration that matches the task requirements, the cached behavior tree configuration is used as the behavior tree configuration corresponding to the task requirements, and the processing steps 2-4 are skipped.
[0048] In this embodiment of the invention, by persistently storing the successfully executed behavior tree configuration and prioritizing its reuse when receiving task requests, repetitive or high-frequency tasks can completely skip the intent parsing and behavior tree configuration generation process of the large language model, thereby further improving response speed while reducing computational resource consumption.
[0049] Furthermore, in this embodiment of the invention, the existence of a cached behavior tree configuration that matches the task requirements is queried in the following manner: Calculate the MD5 hash value required for the task; Indexed by MD5 hash value, query whether there is a cached behavior tree configuration that matches the task requirements.
[0050] In this embodiment of the invention, by converting task requirements into fixed-length MD5 hash values as indexes for precise matching queries, cache retrieval can be completed with constant time complexity, avoiding the computational overhead of long text semantic comparison, and achieving efficient and deterministic hits on cached behavior tree configurations.
[0051] Furthermore, considering the limited cache resources, in this embodiment of the invention, the method further includes: Set the total cache size threshold, database size threshold, and maximum record count threshold; When any of the actual size of the cached data, the actual size of the database file, or the actual number of records exceeds the corresponding threshold, the least recently used cleanup strategy is executed to delete the least recently used cached record.
[0052] In this embodiment of the invention, the total cache size threshold refers to the upper limit of the total number of bytes occupied by cached data in memory or disk storage space. For example, the total storage space occupied by cached data is limited to no more than 512MB. When the actual size of the cached data exceeds the total cache size threshold, a least recently used cleanup strategy is executed to delete the least recently used cache record.
[0053] In this embodiment of the invention, the database size threshold refers to the upper limit of the file size of the database (such as an SQLite database) used for caching behavior tree configuration. The database file will continuously change as records are added or deleted. Even if the actual size of the cached data does not exceed the total cache size threshold, if the database file exceeds the database size threshold due to factors such as fragmentation or index bloat, the least recently used cleanup strategy will still be executed to delete the least recently used cached records.
[0054] In this embodiment of the invention, the maximum record count threshold refers to the upper limit of the number of cached behavior tree configuration entries. Each record corresponds to a behavior tree configuration and task requirement. Even if the actual size of the cached data and the actual size of the database file do not exceed the limit, if the actual number of records reaches the maximum record count threshold, the least recently used cleanup strategy is still executed to delete the least recently used cached record.
[0055] In this embodiment of the invention, by setting a total cache size threshold, a database size threshold, and a maximum record count threshold, and by adopting a management strategy that automatically cleans up the least used cache records when any condition is triggered, a dynamic balance between cache size, storage overhead, and query performance can be achieved in embedded environments with limited cache resources, ensuring the stability of the system's long-term autonomous operation.
[0056] refer to Figure 2 This invention also provides an intelligent agent autonomous control system based on behavior trees and large language models, the system comprising: Receiver module 11 is used to receive task requirements input by the user; The intent parsing module 12 is used to parse the intent of the task requirements using a large language model and determine the intent type of the task requirements. The tool and skill context management module 13 is used to filter tools and / or skills related to the task requirements from the preset tool and skill library when the intent type of the task requirement is determined to be task-oriented, and form a set of tools and skills. The behavior tree configuration generation module 14 is used to generate a behavior tree configuration that can cover the complete task steps by utilizing a large language model and based on task requirements and a set of tools and skills. Behavior tree generation module 15 is used to parse the behavior tree configuration and construct behavior tree instances; The behavior tree execution module 16 is used to drive each node in the behavior tree instance to execute sequentially according to the control flow semantics of the behavior tree instance. During the normal execution of each node, the large language model is not called. The Tools and Skills Service Module 17 is used to schedule corresponding tools or skills to perform operations on target nodes that are determined to be tool nodes or skill nodes during the execution of each node, and to use a pre-set security check mechanism to verify the operation. When the verification result is abnormal, the execution intelligence mechanism embedded in the target node is used to handle the abnormality. The result output module 18 is used to output the execution result after all nodes of the behavior tree instance have been executed.
[0057] In this embodiment of the invention, the intent type also includes chatty and unsupported; when the intent parsing module 12 determines that the intent type of the task requirement is chatty, it directly generates a response using a large language model; when the intent parsing module 12 determines that the intent type of the task requirement is unsupported, it uses a large language model to provide feedback that execution is not supported and outputs the reason for non-execution.
[0058] In this embodiment of the invention, the large language model is pre-deployed in the system.
[0059] refer to Figure 3 Furthermore, in this embodiment of the invention, the system further includes: a cache module 19; The caching module 19 is used to cache the behavior tree configurations that have been successfully executed and their corresponding task requirements, and to set an expiration date for each cached record. When the cache duration exceeds the expiration date, the corresponding cached record is cleared.
[0060] refer to Figure 3 In this embodiment of the invention, the system further includes: a query module 20; The query module 20 is used to query whether there is a cached behavior tree configuration that matches the task requirements before the intent parsing module 12 uses the large language model to parse the task requirements. If there is, the cached behavior tree configuration is used as the behavior tree configuration corresponding to the task requirements.
[0061] The modules in the intelligent agent autonomous control system based on behavior tree and large language model provided in this embodiment of the invention are devices corresponding to the above-described method steps, and can realize all the processes of the intelligent agent autonomous control method based on behavior tree and large language model. The specific working principle, function and technical effect of each module are the same as those of the intelligent agent autonomous control method based on behavior tree and large language model, and will not be repeated here.
[0062] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Additionally, the terms "front," "back," "left," "right," "upper," and "lower" in this document refer to the placement shown in the accompanying drawings.
[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An agent-based autonomous control method based on behavior trees and large language models, characterized in that, include: Receive task requirements from user input; The intent of the task requirement is parsed using a large language model to determine the intent type of the task requirement; When the intent type of the task requirement is determined to be task-oriented, tools and / or skills related to the task requirement are selected from the preset tool and skill library to form a set of tools and skills; Using the large language model, a behavior tree configuration that can cover the complete task steps is generated based on the task requirements and the set of tools and skills. The behavior tree configuration is parsed to construct a behavior tree instance; According to the control flow semantics of the behavior tree instance, each node in the behavior tree instance is driven to execute sequentially, wherein the large language model is not called during the normal execution of each node; During the execution of each node, for the target node that is determined to be a tool node or a skill node, the corresponding tool or skill is scheduled to perform the operation, and the operation is verified using a preset security check mechanism. When the verification result is abnormal, the abnormality is handled using the execution intelligence mechanism embedded in the target node. After all nodes of the behavior tree instance have been executed, the execution result is output.
2. The agent autonomous control method based on behavior tree and large language model according to claim 1, characterized in that, The intent types also include casual and unsupported; When the intent type of the task requirement is determined to be casual conversation, a response is directly generated using the large language model. When the intent type of the task requirement is determined to be unsupported, the large language model is used to provide feedback that execution is not supported and to output the reason for non-execution.
3. The agent autonomous control method based on behavior tree and large language model according to claim 1, characterized in that, The step of selecting tools and / or skills related to the task requirements from a preset tool and skill library to form a tool and skill set includes: The tools and skills in the tool and skill library are hierarchically organized and classified according to functional domains to form a tree index structure. Based on the tree index structure, the tool and skill library is coarsely screened to determine the tool categories and / or skill categories related to the task requirements, thereby obtaining a set of candidate tools and skills. The semantic similarity between the task requirements and each candidate tool and / or skill in the candidate tool and skill set is calculated using an embedding model. The k most relevant tools and / or skills are filtered according to a preset similarity threshold and returned as the tool and skill set, where k is a preset value.
4. The agent autonomous control method based on behavior tree and large language model according to claim 1, characterized in that, The behavior tree instance includes: a pre-defined survival behavior tree and a service behavior tree constructed by configuring the behavior tree. The survival behavior tree is used to handle the survival guarantee behavior of the agent, and the service behavior tree is used to handle the task requirements. The survival behavior tree and the service behavior tree are merged through a selection node, and the survival behavior tree has a higher execution priority than the service behavior tree; During the execution of the behavior tree instance, the survival behavior tree is executed first, and when the survival behavior tree determines that the survival conditions are met, the service behavior tree is executed.
5. The agent autonomous control method based on behavior tree and large language model according to claim 1, characterized in that, The execution intelligence mechanism includes: Exceptions can be handled using any of the following modes: inference-only, confirmation-only, and hybrid. In the inference-only mode, the large language model is invoked to automatically infer the cause of the anomaly and attempt to fix it based on the local context of the target node; In the confirmation-only mode, the execution of the target node is paused, an interaction request is generated to obtain user confirmation or supplementary information, and execution continues based on user feedback; In the hybrid mode, the large language model is first invoked to automatically infer the cause of the anomaly based on the local context of the target node and attempt to repair it. If the repair fails, the execution of the target node is paused, an interaction request is generated to obtain user confirmation or supplementary information, and execution continues based on user feedback.
6. The agent autonomous control method based on behavior tree and large language model according to claim 1, characterized in that, The method further includes: The cached behavior tree configuration and its corresponding task requirements are successfully executed, and an expiration date is set for each cached record. When the cache duration exceeds the expiration date, the corresponding cached record is cleared.
7. The agent autonomous control method based on behavior tree and large language model according to claim 6, characterized in that, The method further includes: Before using the large language model to parse the intent of the task requirement, query whether there is a cached behavior tree configuration that matches the task requirement; If it exists, use the cached behavior tree configuration as the behavior tree configuration corresponding to the task requirement.
8. An intelligent agent autonomous control system based on behavior tree and large language model, characterized in that, include: The receiving module is used to receive task requirements input by the user; The intent parsing module is used to parse the intent of the task requirement using a large language model and determine the intent type of the task requirement. The tool and skill context management module is used to filter tools and / or skills related to the task requirement from a preset tool and skill library when the intent type of the task requirement is determined to be task-oriented, and form a set of tools and skills. The behavior tree configuration generation module is used to generate a behavior tree configuration that can cover the complete task steps by utilizing the large language model and based on the task requirements and the set of tools and skills. The behavior tree generation module is used to parse the behavior tree configuration and construct a behavior tree instance; The behavior tree execution module is used to drive each node in the behavior tree instance to execute sequentially according to the control flow semantics of the behavior tree instance, wherein the large language model is not called during the normal execution of each node; The Tools and Skills Service Module is used to schedule corresponding tools or skills to perform operations on target nodes that are determined to be tool nodes or skill nodes during the execution of each node, and to verify the operations using a preset security check mechanism. When the verification result is abnormal, the abnormality is handled using the execution intelligence mechanism embedded in the target node. The result output module is used to output the execution result after all nodes of the behavior tree instance have been executed.
9. The intelligent agent autonomous control system based on behavior tree and large language model according to claim 8, characterized in that, The system also includes: a cache module; The caching module is used to cache the successfully executed behavior tree configuration and its corresponding task requirements, and to set an expiration date for each cached record. When the cache duration exceeds the expiration date, the corresponding cached record is cleared.
10. The intelligent agent autonomous control system based on behavior tree and large language model according to claim 9, characterized in that, The system also includes: a query module; The query module is used to query whether there is a cached behavior tree configuration that matches the task requirement before the intent parsing module uses the large language model to parse the intent of the task requirement. If there is, the cached behavior tree configuration is used as the behavior tree configuration corresponding to the task requirement.