A ReAct agent loop control method and related device
By introducing reference triggering conditions and local storage mechanisms into the large language model, the problems of context overflow and inference lag caused by external tools returning large amounts of data are solved, enabling the ReAct framework to run stably and efficiently on the large language model, and ensuring the stability and accuracy of task execution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 广州市公安局网络安全保卫支队
- Filing Date
- 2026-06-02
- Publication Date
- 2026-07-31
AI Technical Summary
In large language models, the large amount of data returned by external tools can cause context window overflow and inference lag, especially on models deployed locally and privately, which affects inference performance and task completion efficiency.
By determining whether the result data meets the preset reference triggering conditions, the data that meets the conditions is stored locally and a reference pointer is generated. This data is then used as the return content of the external tool, registered in the attachment list of the target prompt word, and used in the large language model for further planning. Data processing is performed by combining local storage and pointer resolution, avoiding the direct transmission of large amounts of data.
It effectively avoids context overflow and inference lag in large language models, improves parsing and task inference speed, and ensures stable and efficient operation of the model and stability and accuracy of task execution.
Smart Images

Figure CN122489130A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a ReAct intelligent agent cyclic control method and related apparatus. Background Technology
[0002] In large language model applications and intelligent task execution scenarios, the ReAct reactive reasoning and action framework is the mainstream task processing approach. The core feature of this framework is that it does not rely on pre-defined fixed-step planning, but rather dynamically adjusts subsequent actions based on real-time feedback from the environment. In a typical workflow, the ReAct agent maintains the user's original queries and historical tool returns, constructs prompts and sends them to the large language model. The model outputs the next reasoning and action instructions, and the ReAct agent then calls the corresponding tool to execute them. The tool's return results are added to the history as new observations, and this cycle continues until the task is completed.
[0003] However, in practical applications, tools often return large amounts of data, such as extremely long texts or large files. Directly feeding this full dataset into a large language model can cause the model's context window to overflow, leading to stuttering during inference and severely reducing the accuracy of the model's output and task completion efficiency. Especially in some enterprise and government application scenarios, due to data security considerations, users often choose to deploy large language models locally and privately. Limited by local computing resources, these models typically have inherent limitations such as a small number of parameters and a short context window. When running the ReAct framework on such models, the problem caused by the excessive amount of data returned by the aforementioned tools is particularly prominent. Therefore, a mechanism that can effectively process the large amounts of data returned by tools is urgently needed to avoid context overflow and ensure inference performance. Summary of the Invention
[0004] In view of the above problems, this application provides a ReAct agent loop control method and related apparatus to solve the problem of context window overflow and inference lag caused by large amounts of data returned by external tools in the prior art. The specific solution is as follows:
[0005] The first aspect of this application provides a ReAct agent loop control method, comprising:
[0006] Obtain the result data returned after calling an external tool in the task loop, and determine whether the result data meets the preset reference triggering conditions;
[0007] If so, the result data is stored locally, and a reference pointer pointing to the storage location of the result data is generated;
[0008] The reference pointer is registered as the return content of the external tool in the attachment list of the target prompt word, and the target prompt word is input into the large language model to obtain the next planned action containing the reference pointer;
[0009] The tool executor is invoked to perform pointer resolution on the next planned action. Based on the resolved reference pointer, the result data is read from the local machine and then passed to the external tool invoked by the next planned action for processing to obtain new result data.
[0010] The new result data is used as the result data returned after calling the external tool in the task loop. The system then determines whether the result data meets the preset reference triggering conditions, and the task loop ends when the external tool called for the next planned action is a task completion tool.
[0011] In one possible implementation, the result data returned after calling an external tool in the task loop is a result dictionary containing key-value pairs;
[0012] The step of determining whether the result data meets the preset reference triggering condition, and if so, storing the result data locally and generating a reference pointer to the storage location of the result data, includes:
[0013] Determine whether the length of the value in each key-value pair of the result dictionary is greater than a preset length threshold, so as to filter out target key-value pairs whose value length is greater than the length threshold, and generate the reference pointer for the value in the target key-value pair;
[0014] The step of registering the reference pointer as the return content of the external tool into the attachment list of the target prompt word includes:
[0015] The reference pointer and corresponding key generated for the value in the target key-value pair are registered as the first return content of the external tool in the attachment list of the target prompt word, and the non-target key-value pairs with a value length less than or equal to the length threshold are written as the second return content of the external tool into the execution record placeholder slot of the target prompt word.
[0016] In one possible implementation, when the external tool is a pre-configured nested sub-agent tool, the step of passing the read result data to the external tool invoked for the next planning action for processing includes:
[0017] The read result data is passed to the nested sub-agent tool so that the nested sub-agent tool can perform data preprocessing on the read result data, remove redundant data in the read result data, and obtain filtered result data as the new result data.
[0018] In one possible implementation, before entering the task loop, the following is also included:
[0019] Obtain the task instruction corresponding to the current task, and filter the target SOP that matches the task instruction from the pre-built standardized operating procedure (SOP) configuration list;
[0020] The target SOP is instantiated and added to the pool of available tools, which provides callable external tools for the task cycle.
[0021] In one possible implementation, filtering the target SOP that matches the task instruction from a pre-built list of standardized operating procedures (SOPs) configurations includes:
[0022] Count the total number of SOPs that are enabled in the SOP configuration list;
[0023] If the total number is less than a preset threshold, the task instruction, as well as the name and description summary of the SOP contained in the SOP configuration list, are sent to the large language model so that the target SOP can be filtered out by the large language model.
[0024] If the total number is greater than or equal to the number threshold, the task instruction is matched with the SOP vectors in the pre-built vector index library to obtain a preset number of candidate SOPs with the highest matching degree. The task instruction, as well as the name and description summary of the candidate SOPs, are sent to the large language model to filter out the target SOP through the large language model. The vector index library is obtained by vectorizing the SOPs in the SOP configuration list.
[0025] In one possible implementation, after instantiating the target SOP and adding it to the pool of available tools, the following is also included:
[0026] A preset high-priority hint is injected into the SOP placeholder of the target prompt word to guide the large language model to prioritize the use of the target SOP when generating the next planned action.
[0027] In one possible implementation, after the task loop ends, the following is also included:
[0028] The task completion tool sends the complete historical execution record of the current task and the attachment information in the attachment list to the large language model to obtain the reference file list output by the model. If the reference pointer is generated during the task loop, the attachment information includes the reference pointer and the corresponding reference summary. The reference file list is generated by the large language model when it determines that the complete historical execution record and the attachment information are insufficient to generate a task report.
[0029] Based on the list of referenced files, the corresponding result data is read from the local machine and sent to the large language model to obtain the task report output by the model.
[0030] A second aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the ReAct intelligent agent cyclic control method described in the first aspect or any implementation thereof.
[0031] A third aspect of this application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0032] The memory is used to store computer programs;
[0033] The processor is used to execute the computer program so that the electronic device can implement the ReAct intelligent agent cyclic control method of the first aspect or any implementation thereof.
[0034] A fourth aspect of this application provides a computer storage medium carrying one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the ReAct intelligent agent loop control method described in the first aspect or any implementation thereof.
[0035] By employing the aforementioned technical solution, the ReAct agent loop control method provided in this application, in order to avoid the overflow of the large language model's context window and inference lag caused by the large amount of data returned by external tools, thus affecting inference performance, obtains the result data returned after calling the external tool in the task loop, determines whether the result data meets the preset reference triggering conditions, and if so, stores the result data locally and generates a reference pointer pointing to the storage location of the result data. This reference pointer is then registered as the return content of the external tool in the attachment list of the target prompt word, and the target prompt word is input into the large language model to obtain the next planned action containing the reference pointer. By introducing preset reference triggering conditions and storing a large amount of result data locally, this application uses a concise reference pointer instead of full data to participate in the construction of the target prompt word, significantly reducing the amount of context data input to the large language model, avoiding the full data crowding the model's context window, and solving the context overflow and inference interruption problems that easily occur when the large language model runs the ReAct framework. Simultaneously, the number of tokens for the target prompt word input to the large language model is small, reducing the difficulty of parsing the prompt word tokens and thus improving the parsing and task inference speed.
[0036] Furthermore, to enable normal inference using the result data pointed to by the reference pointer even when only a reference pointer is passed in, this application can invoke a tool executor to resolve the pointer for the next planned action. Based on the resolved reference pointer, the result data is read from the local machine and passed to the external tool called by the next planned action for processing, resulting in new result data. This new result data is then used as the result data returned after calling the external tool in the task loop. The loop then checks whether the result data meets the preset reference triggering conditions until the external tool called by the next planned action is a task completion tool, at which point the task loop ends. Thus, this application provides a complete logical closed loop of reference triggering judgment, local storage, pointer passing and resolution, and loop iteration. This fundamentally solves the problems of context overflow, inference lag, and performance degradation in large language models caused by large amounts of data returned by external tools, while ensuring the availability and integrity of data during model inference. This achieves stable and efficient operation of the ReAct framework on large language models, guaranteeing the stability, efficiency, and accuracy of task execution. Attached Figure Description
[0037] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0038] Figure 1 A schematic diagram of a system architecture provided for this application;
[0039] Figure 2 A flowchart illustrating a ReAct agent loop control method provided in this application;
[0040] Figure 3 This application provides a complete flowchart of a ReAct agent loop control.
[0041] Figure 4 A schematic diagram of the structure of a ReAct intelligent agent loop control device provided in this application;
[0042] Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation
[0043] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0044] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0045] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0046] Given that external tools in existing technologies may return search results containing tens of thousands of tokens, directly incorporating this content into a dialogue would immediately cause context overflow in typical large language models. Even for large language models with long context, stuffing in a large number of tokens can cause the agent to lose focus in later steps (i.e., redundant data overwhelms key thought processes), affecting the final generation result.
[0047] To address the aforementioned issues, this application provides a ReAct agent loop control method and related apparatus, which can be applied to scenarios where a large language model is used to perform ReAct-based reasoning on user-input task instructions to efficiently complete tasks.
[0048] For example, when using an intelligent agent to retrieve data from the entire network and generate an information analysis report on a specific topic, the agent needs to perform multiple lengthy steps, such as extracting keywords, searching across multiple platforms, extracting core viewpoints, and generating the report.
[0049] It should be noted that the above scenarios are merely examples and are not intended to limit this application.
[0050] The ReAct agent cyclic control method provided in this application can be applied to the ReAct agent cyclic control system. Because it decouples the basic toolchain from the upper-level scheduling logic, the ReAct agent cyclic control system has a high degree of pluggability and can be seamlessly embedded into various mainstream agent frameworks.
[0051] In practical implementation, the core of the ReAct intelligent agent cyclic control system is deployed in the intelligent agent's logic decision-making center. Depending on the security strategy and computing power distribution of the actual business, the deployment location can be either in the cloud or on a private server, or it can be deployed locally on a lightweight client (such as a local personal computer or edge computing device).
[0052] For example, in one possible implementation, the ReAct agent loop control method provided in this application can be applied to, for example... Figure 1 The system architecture shown includes a terminal 100 and a server 200. The server 200 may include one or more servers (…). Figure 1 (This example uses a server as an illustration).
[0053] Either terminal 100 or server 200 can be used independently to execute the ReAct agent loop control method provided in the embodiments of this application. Alternatively, terminal 100 and server 200 can also be used collaboratively to execute the ReAct agent loop control method provided in the embodiments of this application.
[0054] The following description Figure 1 The product form of the mid-terminal 100;
[0055] The terminal 100 in this application embodiment can be a mobile phone, tablet computer, wearable device, vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc., and this application embodiment does not impose any restrictions on it.
[0056] To enable those skilled in the art to better understand this application, the ReAct intelligent agent cyclic control method of the present application embodiments will be described in detail below with reference to the accompanying drawings.
[0057] Reference Figure 2 , Figure 2 A flowchart illustrating a ReAct agent loop control method provided in this application embodiment is shown below. Figure 2 As shown, the ReAct agent loop control method may include:
[0058] Step S201: Obtain the result data returned after calling the external tool in the task loop, and determine whether the result data meets the preset reference triggering conditions.
[0059] As described in the background section, the ReAct paradigm dynamically plans and iterates through the tasks to be executed. Thus, in each iteration of the task loop, it calls external tools and obtains the result data returned by the external tools. This result data is the intermediate data required to complete the task.
[0060] In this embodiment, after each acquisition of result data, it can be determined whether the result data meets the preset reference triggering conditions.
[0061] Optionally, the reference trigger condition can be that the character length of the result data is greater than a preset length threshold, such as 2000.
[0062] For example, when a user initiates a task command to "query the development trends of the artificial intelligence industry in 2026 and generate an analysis report", the ReAct agent enters the task loop. First, it calls a web search tool to perform a search operation and returns result data containing a 5,000-word industry overview and 30 relevant literature links. The preset citation trigger condition is "the character length of the result data is greater than 2,000 characters". After judgment, the character length of the result data is 5,800 characters, which meets the citation trigger condition.
[0063] Step S202: If yes, store the result data locally and generate a reference pointer to the storage location of the result data.
[0064] In this embodiment, when the result data meets the reference triggering condition, the result data can be stored locally, for example, saved as a result data file named "2026AI_trend_001.txt", and persistently stored in the " / data / llm / ref / " directory of the local file system.
[0065] In order to enable referencing of the result data, this application also generates a reference pointer to the storage location of the result data.
[0066] Optionally, the reference pointer can include information such as the local storage path, the filename of the result data file, the file type, a summary of the file content, and a small number of data samples, so that after being passed to the large language model, the large language model can quickly preview the result data pointed to by the reference pointer, ensuring that the attention of the large language model is not distracted by redundant content.
[0067] Step S203: Register the reference pointer as the return content of the external tool to the attachment list of the target prompt word, and input the target prompt word into the large language model to obtain the next planned action containing the reference pointer.
[0068] In this embodiment, only the reference pointer can be used as the returned content of the external tool. It should be understood that compared to the result data itself, the number of tokens in the reference pointer is extremely small, thus avoiding overloading the context window of a large language model and preventing performance degradation in task inference due to data overflow.
[0069] The aforementioned target prompt word refers to the prompt word template pre-configured for the large language model, which includes an attachment list placeholder slot. Registering the reference pointer to the attachment list of the target prompt word specifically means filling the attachment list placeholder slot with the reference pointer.
[0070] In this embodiment, in addition to the reference pointer, alternatively, a placeholder replacement mechanism can be used to concatenate the current time, the list of available tools (from the available tool pool), the attachment information carried by the user-input task instructions, and the historical execution records of all previous iterations into the target prompt word to form a more information-rich target prompt word, which is then submitted to the large language model for reasoning to obtain the next planned action, which includes the reference pointer.
[0071] Optionally, the large language model can be a short-context large language model or a long-context large language model. This application does not limit the specific form of the large language model.
[0072] For example, a large language model could be the iFlytek Spark Large Model, the Doubao Large Model, the Deep Search Large Model, the Wenxin Yiyan Large Model, etc., and this application does not impose any specific limitations.
[0073] The next step in the planning action includes tool invocation parameters, enabling this embodiment to invoke the tool executor and call the required external tools based on the tool invocation parameters.
[0074] Optionally, in addition to outputting the next planning action, the large language model may also output the current plan, thought process, etc. For example, it may output a single data entry containing the current plan, thought process, and next planning action in standard JSON (JavaScript Object Notation) format. The thought process refers to the internal reasoning and analysis performed by the large language model based on the contextual information in the target prompts; the current plan is a phased action plan derived from the thought content; and the next planning action is a concrete execution command that concretizes a step in the plan.
[0075] It is understandable that the output format of the large language model may be incorrect. In one possible implementation, if the output format of the large language model is detected to be correct, then proceed to step S104 below. Conversely, if the output format of the large language model is detected to be incorrect, then generate an error message as a virtual observation result and write it into the historical execution record, skipping the current round, so that the large language model can trigger self-correction when reading the historical execution record in the next round.
[0076] Step S204: Invoke the tool executor to perform pointer resolution on the next planned action, read the result data from the local machine based on the resolved reference pointer, and pass the read result data to the external tool called by the next planned action for processing to obtain new result data.
[0077] Specifically, in this embodiment, after receiving the next planned action, the tool executor performs pointer resolution before formally calling the external tool. That is, it recursively scans the parameter list included in the passed-in next planned action. If a reference pointer is identified, it actively reads the result data from the local file system and dynamically injects parameters to replace the reference pointer. This process is completely transparent to the underlying business modules. Subsequently, based on the tool type, the corresponding external tool is scheduled from the available tool pool, and the parameters (i.e., the read result data) are passed to it. This allows the external tool to process the passed-in result data and obtain new result data, thus completing one task cycle.
[0078] Step S205: Use the new result data as the result data returned after calling the external tool in the task loop, and return to determine whether the result data meets the preset reference trigger condition. The task loop ends when the external tool called in the next planned action is the task completion tool.
[0079] In this embodiment, the new result data can be used as the result data obtained in the previous step S201 and entered into the next loop iteration.
[0080] When the large language model determines that the overall plan has been completed or all necessary information has been obtained, it will call the system's built-in task completion tool in the next planned action output. At this point, it can be determined that the task loop has ended.
[0081] In some scenarios, it may be necessary to generate a task report. In this case, the task completion tool and the large language model can be interacted to summarize the complete historical execution record of the current task and the attachment information in the accumulated attachment list, and generate a task report.
[0082] The ReAct agent loop control method provided in this application aims to prevent large language model context window overflow and inference lag caused by large amounts of data returned by external tools, thus affecting inference performance. This application obtains the result data returned after calling external tools in the task loop, determines whether the result data meets preset reference triggering conditions, and if so, stores the result data locally and generates a reference pointer pointing to the storage location of the result data. This reference pointer is then registered as the return content of the external tool in the target prompt word attachment list, and the target prompt word is input into the large language model to obtain the next planned action containing the reference pointer. By introducing preset reference triggering conditions and storing large amounts of result data locally, this application uses concise reference pointers instead of full data in the construction of target prompt words, significantly reducing the amount of context data input to the large language model. This avoids full data crowding the model context window and solves the context overflow and inference interruption problems that easily occur when large language models run the ReAct framework. Simultaneously, the number of tokens for the target prompt word input to the large language model is small, reducing the difficulty of parsing prompt word tokens and thus improving the parsing and task inference speed.
[0083] Furthermore, to enable normal inference using the result data pointed to by the reference pointer even when only a reference pointer is passed in, this application can invoke a tool executor to resolve the pointer for the next planned action. Based on the resolved reference pointer, the result data is read from the local machine and passed to the external tool called by the next planned action for processing, resulting in new result data. This new result data is then used as the result data returned after calling the external tool in the task loop. The loop then checks whether the result data meets the preset reference triggering conditions until the external tool called by the next planned action is a task completion tool, at which point the task loop ends. Thus, this application provides a complete logical closed loop of reference triggering judgment, local storage, pointer passing and resolution, and loop iteration. This fundamentally solves the problems of context overflow, inference lag, and performance degradation in large language models caused by large amounts of data returned by external tools, while ensuring the availability and integrity of data during model inference. This achieves stable and efficient operation of the ReAct framework on large language models, guaranteeing the stability, efficiency, and accuracy of task execution.
[0084] In one possible implementation, the result data returned after calling an external tool in the task loop is a result dictionary containing key-value pairs. Here, the key in each key-value pair is an identifier used to identify the result information, and the value is the actual result data.
[0085] For example, the dictionary of results returned by the web search tool in the previous example could be: {"Search keywords": "2026 Artificial Intelligence Development Trends", "Search Results Summary": "In 2026, the artificial intelligence industry will enter the stage of large-scale implementation, with generative AI and edge AI becoming the core development directions... (5000 words)", "Document Links": ["http: / / xxx.1", "http: / / xxx.2", ..., "https: / / xxx.30"], "Search Time": "20xx-xx-xx 10:30"}.
[0086] Based on this, the process of "determining whether the result data meets the preset reference triggering conditions, and if so, storing the result data locally and generating a reference pointer to the storage location of the result data" can be specifically described as follows: determining whether the length of the value in each key-value pair of the result dictionary is greater than the preset length threshold, so as to filter out the target key-value pairs whose value length is greater than the length threshold, and generating a reference pointer for the value in the target key-value pair.
[0087] Accordingly, "registering the reference pointer as the return content of the external tool to the attachment list of the target prompt word" can be specifically as follows: registering the reference pointer generated for the value in the target key-value pair and the corresponding key as the first return content of the external tool to the attachment list of the target prompt word, and writing the non-target key-value pairs with a value length less than or equal to the length threshold as the second return content of the external tool into the execution record placeholder slot of the target prompt word.
[0088] For example, still taking a length threshold of 2000 characters as an example, the value "2026 Artificial Intelligence Development Trends" corresponding to the key "search keywords" has a length of 14 characters, which is less than 2000 characters, so it is a non-target key-value pair; the value corresponding to the key "search results overview" has a length of 5000 characters, which is greater than 2000 characters, so it is a target key-value pair; the value corresponding to the key "literature link" has a length of 860 characters, which is less than 2000 characters, so it is a non-target key-value pair; and the value corresponding to the key "search time" has a length of 16 characters, which is less than 2000 characters, so it is a non-target key-value pair.
[0089] After selecting the target key-value pair, the target key-value pair can be stored locally, and a reference pointer can be generated for it. The reference pointer can then be registered in place of the target key-value pair in the attachment list of the target prompt word.
[0090] It is worth noting that the attachment list is specifically used to mount file objects (such as uploaded documents and long file summaries of REF (Reference) files stored on disk). For short texts with a length less than a preset threshold (i.e., non-target key-value pairs), they can be written directly to the execution record placeholder slot of the target prompt word as regular observations, instead of being registered as files in the attachment list.
[0091] For example, to generate a reference pointer "REF_2026AI_001" for the value in the target key-value pair {key "search results summary", value "5000-word summary"}, the content registered in the attachment list of the target suggestion term is: {"document links": ["http: / / xxx.1", "http: / / xxx.2", ..., "https: / / xxx.30"]}, and the content written to the execution record placeholder slot of the target suggestion term is: {"search keywords": "2026 artificial intelligence development trends", "search results summary": "REF_2026AI_001", "search time": "20xx-xx-xx 10:30"}.
[0092] This embodiment further refines the logic for judging, storing, and registering returned content of the result data based on the previous embodiment. For the result dictionary containing key-value pairs, reference pointers are generated only for target key-value pairs whose value length exceeds the length threshold. For short-length non-target key-value pairs, the original content is directly retained, without generating pointers for all of them. This avoids the waste of resources and cumbersome process caused by generating pointers for short data, while ensuring the lightweight transmission of massive amounts of data. At the same time, the key and its corresponding pointer are registered to the attachment list, and non-target key-value pairs are written to the execution record placeholder slot, ensuring the integrity of the prompt word context. This allows the large language model to fully obtain the information returned by the tool and improve the accuracy of the next planned action.
[0093] In some other embodiments of this application, the process of step S204 above, "passing the read result data to the external tool called for the next planning action for processing", is described.
[0094] In this embodiment, when the read result data involves extremely long text or large file data, the external tool invoked can be a pre-configured nested sub-agent tool.
[0095] For example, when a large language model parses target prompt words, it can detect that the target prompt words contain reference pointers and generate the next planned action to call nested sub-agent tools.
[0096] Optionally, nested sub-agent tools can be tools for file reading, history reading, etc.
[0097] When the external tool is a pre-configured nested sub-agent tool, the process of "passing the read result data to the external tool called for the next planning action for processing" mentioned above can include: passing the read result data to the nested sub-agent tool so that the nested sub-agent tool can perform data preprocessing on the read result data, remove redundant data from the read result data, and obtain filtered result data as new result data.
[0098] In this embodiment, a sub-agent loop approach can be adopted, in which a nested sub-level ReAct loop is started independently. The sub-agent tool takes over the preprocessing of the read result data. Within the result data file, it autonomously performs data preprocessing processes such as data matching based on preset regular expressions, extraction of specific key values, and conditional filtering. This enables fine-grained information processing of the read result data, completes data cleaning and purification, discards useless redundant information, and obtains filtered result data. This avoids a large amount of redundant data distracting subsequent tasks and affecting the accuracy of the new result data generated by subsequent tasks.
[0099] Considering that enterprise users often have standardized, long-chain tasks, directly using the ReAct framework for step-by-step planning results in extremely high execution instability. This is especially true when using models with a small number of parameters for inference, where the model frequently experiences "illusions" later in the process, such as forgetting the initial task objective, getting stuck in a step-by-step infinite loop, or incorrectly calling irrelevant tools, leading to the interruption of the entire business chain. This uncontrollability significantly increases the system's fault tolerance cost, making it difficult to meet the stringent deterministic and robust requirements of enterprise production environments.
[0100] The root cause was found to be that the pure ReAct paradigm relies excessively on the model's immediate zero-shot reasoning and planning capabilities. Pure autonomous planning requires the model to make independent decisions "from scratch" at every step of the task, which exceeds the logical deduction limits of a small-parameter model in long execution cycles, and also generates a large amount of meaningless token consumption. Traditional architectures lack a hybrid scheduling mechanism that can integrate enterprise-deterministic Standard Operating Procedures (SOPs) with the dynamic planning capabilities of large language models, resulting in insufficient model stability in enterprise-level business scenarios.
[0101] To address this issue, this embodiment provides a method for pre-registering SOPs as available tools.
[0102] Specifically, in this embodiment, before entering the task loop, the task instruction corresponding to the current task can be obtained first, and then the target SOP that matches the task instruction can be selected from the pre-built standardized operating procedure (SOP) configuration list.
[0103] For example, enterprise users can generate a Standard Operating Procedure (SOP) for each execution step of their frequently used tasks. Here, an SOP is a configuration file that defines the SOP name, description summary, execution steps, input and output parameters, and logical judgments between steps. The configuration files corresponding to each SOP can be categorized and stored by directory to form an SOP configuration list.
[0104] Additionally, it allows configuring the enable status of SOP configuration lists or individual SOPs within a list, enabling users to select and load certain SOP configuration lists or specific SOP files.
[0105] Therefore, it is possible to filter only the SOPs that match the task instructions and are enabled.
[0106] In one possible implementation, the task instruction, along with the names and descriptive summaries of the SOPs included in the SOP configuration list, can be sent to a large language model. The large language model then analyzes the task instruction, the names of each SOP, and their descriptive summaries to filter out the target SOPs that best match the semantic intent of the task instruction. Here, there can be one or more target SOPs, depending on the specific application, and no specific limitations are imposed here.
[0107] Considering that the process of analyzing large language models based on task instructions, the names and descriptions of each SOP takes time, analyzing each SOP individually would be inefficient if the SOP configuration list contains a large number of SOPs. To improve efficiency, this embodiment also provides the following alternative implementation.
[0108] First, the total number of SOPs in the SOP configuration list that are enabled can be counted. If the total number is less than a preset threshold (e.g., less than 50), the task instruction, along with the name and description summary of the SOPs contained in the SOP configuration list, is sent to the large language model so that the target SOP can be filtered out through the large language model.
[0109] Conversely, if the total number is greater than or equal to the number threshold, the task instruction is matched with the SOP vectors in the pre-built vector index library to obtain the candidate SOPs with the highest matching degree (such as TOP-K, where K is the preset number). The task instruction, as well as the name and description summary of the candidate SOPs, are sent to the large language model to filter out the target SOPs. The vector index library is obtained by vectorizing the SOPs in the SOP configuration list.
[0110] In this embodiment, vector retrieval enables a coarse textual similarity match between the Standard Operating Procedure (SOP) and the task instructions, thereby filtering out SOPs completely irrelevant to the task instructions. However, since the vector similarity matching process does not involve artificial intelligence processing, it cannot accurately identify the task intent and may select some SOPs that are textually similar but semantically significantly different. Therefore, after vector similarity matching, a large language model is further triggered to perform precise semantic filtering, resulting in a more accurate target SOP.
[0111] In order to make the target SOP a usable external tool, this embodiment can instantiate the target SOP and add it to the pool of available tools. Here, the pool of available tools is used to provide callable external tools for the task cycle.
[0112] As mentioned earlier, an SOP is a configuration file in program implementation. Instantiation refers to loading the configuration file into an SOP object in memory, so that the SOP executor can actually perform tasks according to the properties of the object.
[0113] Optionally, to distinguish the SOP tool from other external tools, this embodiment can assign the SOP tool the prefix name SOP_xxx. Thus, when the name of the called external tool contains the SOP identifier, the SOP executor can be woken up, user parameter variables can be replaced by static rendering, and the result data of the preceding steps can be parsed by dynamic evaluation. Following the strict SOP process preset by the enterprise, the long chain of SOP subtasks can be automatically completed in one go.
[0114] Since the target SOP is more relevant to the semantic intent of the current task instruction and contains multiple accurate execution steps, in order to make the ReAct process prioritize the use of the target SOP, this embodiment can inject a preset high-priority prompt into the SOP placeholder of the target prompt word to guide the large language model to prioritize the use of the target SOP when generating the next planned action.
[0115] It should be noted that the above high-priority prompts are only to guide large language models to prioritize the target SOP, but are not mandatory to use the target SOP.
[0116] This embodiment adds a SOP matching and loading step before the task cycle, combining the enterprise's preset standardized operating procedures (SOPs) with the ReAct agent's cycle control. By filtering and instantiating target SOPs that match the task instructions, the SOP tools are added to the available tool pool, enabling the ReAct agent's task execution to follow the enterprise's standardized process. This avoids problems such as step jumps and tool call confusion when planning actions with a large language model, improving the standardization and stability of task execution and making it more suitable for the needs of enterprise-level business scenarios.
[0117] By refining the SOP selection logic, different selection methods are adopted based on the total number of SOPs in the enabled state: when the number is small, the large language model directly selects the SOPs to simplify the process and improve speed; when the number is large, candidate SOPs are first selected by vector similarity matching, and then the large language model selects the target SOPs. This avoids the decrease in inference efficiency caused by the large language model processing too many SOPs, and ensures that the target SOPs that match the task instructions can be selected quickly and accurately, thereby further improving the task execution efficiency.
[0118] Meanwhile, the addition of a high-priority prompt injection step guides the large language model to prioritize the use of tools corresponding to the target SOP. This strengthens the standardized guidance role of the target SOP, prevents the large language model from calling tools that are not compatible with the task due to deviations in autonomous planning, ensures that task execution strictly follows the preset standardized process, reduces redundancy and errors, and further improves the stability and standardization level of ReAct agent task execution.
[0119] In some other embodiments of this application, as described in step S205 above, a task report needs to be generated after the task loop ends.
[0120] In one possible implementation, after the task loop ends, a task completion tool can send the complete historical execution record of the current task and the attachment information from the attachment list to the large language model. Here, if reference pointers were generated during the previous task loop, the attachment information includes the reference pointers and the corresponding reference summaries. Optionally, the complete historical execution record can be obtained from the execution record placeholder slots of the target prompt words in each round of execution.
[0121] If the large language model deems the existing information sufficient, it can invoke the report generator tool to generate a task report based on the complete historical execution record of the current task and the attachment information in the attachment list.
[0122] If the large language model deems the existing information insufficient, it can output a list of referenced files. This list is generated by the large language model when it determines that the complete historical execution records and attachment information are insufficient to generate a task report.
[0123] At this point, the corresponding result data can be read from the local machine based on the list of referenced files, and then sent to the large language model to obtain the task report output by the model.
[0124] Optionally, the report generator can be invoked to load the result data corresponding to the list of referenced files on demand, and the prompt words can be reassembled to request the large language model to generate a structured task report.
[0125] After generating the task report, the task report can be returned to the client, the main task progress bar can be marked as 100%, and the long-chain task can be declared to have been successfully completed.
[0126] This embodiment introduces a report generation step after the task loop ends. By sending historical execution records and attachment information to the large language model, the model determines whether additional reference files are needed, and then reads local raw data as needed to generate a report. This ensures that the final generated task report is based on complete raw data, avoiding the problem of incomplete and inaccurate report content caused by relying solely on pointers and summaries. At the same time, it eliminates the need to load the full amount of data during the loop, balancing report quality and inference efficiency, and improving the completeness and practicality of ReAct agent task execution.
[0127] To enable those skilled in the art to better understand this application, please refer to Figure 3 The diagram shows a complete flowchart of the ReAct agent cyclic control method of this application, which can be applied to a central controller.
[0128] Step S301: Receive the user's task instructions and attachment information.
[0129] Here, the task instructions can be natural language instructions, and the task instructions may contain attachment information, which can be obtained by parsing the task instructions.
[0130] Step S302: Task initialization and resource loading.
[0131] Specifically, if the task instruction includes attachment information, the attachment information can be downloaded to the local machine.
[0132] Simultaneously, system role prompts and user prompt templates can be loaded to form pre-configured target prompts. Additionally, underlying basic atomic tools (such as search engines and database queries) and built-in nested sub-agent tools (such as file reading and history reading) are loaded into the global tool registry corresponding to the available tool pool for later use.
[0133] Step S303: Count the total number of SOPs in the SOP configuration list that are in the enabled state, and determine whether the total number is less than the number threshold. If so, use a pure LLM (Large Language Model) filtering strategy to obtain the target SOP; otherwise, use a two-layer retrieval strategy to obtain the target SOP.
[0134] The pure LLM filtering strategy refers to sending the task instructions, along with the names and descriptions of the SOPs contained in the SOP configuration list, to a large language model to filter out the target SOPs.
[0135] The two-layer retrieval strategy refers to: matching the task instructions with the SOP vectors in the pre-built vector index to obtain a preset number of candidate SOPs with the highest matching degree, and sending the task instructions, as well as the names and descriptive summaries of the candidate SOPs, to the large language model to filter out the target SOP.
[0136] Step S304: Target SOP hybrid packaging and injection.
[0137] Specifically, this step can instantiate the target SOP and give it the prefix name SOP_xxx, injecting it into the available tool pool as a dynamic tool. At the same time, it injects a preset high-priority hint into the SOP placeholder of the target prompt word to guide the large language model to prioritize the use of the target SOP when generating the next planned action.
[0138] Step S305: The system enters the ReAct task loop, dynamically constructs target prompt words, and submits LLM inference.
[0139] Specifically, this step can execute the following process in each round of the ReAct task loop: using the placeholder replacement mechanism, the current time, available tool list, attachment information, historical execution records of previous iterations, reference pointers, etc. are fully assembled into the target prompt words for this round, and submitted to the large language model for reasoning to obtain the next planned action.
[0140] Step S306: Determine whether the output format of the next planned action is correct. If not, construct a virtual observation result and write it into the historical execution record.
[0141] Step S307: If the output format of the next planned action is correct, determine the type of external tool called by the next planned action. If it is a normal tool, execute the atomic logic; if it is an SOP tool, wake up the SOP executor; if it is a nested sub-agent tool, start the data preprocessing process; if it is a task completion tool, execute step S309. If multiple tools are called at once, summarize the output data of each tool to obtain new result data.
[0142] Specifically, for ordinary tools, they can directly wake up and execute the corresponding module's own business logic, wait for and return the result data.
[0143] If it is an SOP tool, the SOP executor needs to be activated. The system traverses the fixed process steps in the SOP configuration. During the execution, user parameter variables are replaced by static rendering, and the result data of the preceding steps are parsed by dynamic evaluation. Following the company's rigorous process, the long chain of sub-tasks is completed in one go.
[0144] If it is a nested sub-agent tool, then the nested sub-agent tool takes over the data preprocessing work and autonomously performs fine-grained information processing operations such as regular expression matching, specific key value extraction, and conditional filtering within the result data file.
[0145] Step S308: Determine whether the result data meets the reference triggering condition. If so, perform pointer-ization on the result data; otherwise, store the observed data in the historical execution record.
[0146] Here, if the result data does not meet the reference triggering condition, then the observed data is the result data; if the result data meets the reference triggering condition, then the observed data is a reference pointer generated for the result data.
[0147] The process of pointerization can be referred to the previous introduction, and will not be repeated here.
[0148] Step S309: Wake up the report generator and send the complete historical execution record and attachment information to the LLM.
[0149] Step S310: If the information is insufficient, LLM loads files as needed; if the information is sufficient, it generates a task report.
[0150] The task completion tool can send the complete historical execution record of the current task and the attachment information in the attachment list to the large language model. If the judgment information is sufficient, the model will output a task report, or if the judgment information is insufficient, it will output a list of referenced files. Based on the list of referenced files, the corresponding result data can be read from the local machine and sent to the large language model to obtain the task report output by the model.
[0151] In summary, this embodiment has the following advantages:
[0152] First, it provides a data referencing and nested extraction mechanism. Specifically, the transparent reference flow to underlying tools is achieved at the underlying framework level through automatic interception and reference pointer replacement of extremely large return values based on length thresholds, with automatic parsing and injection before subsequent calls. This mechanism is completely transparent to the underlying business modules, enabling existing conventional tools to handle massive amounts of data without any code modification, effectively avoiding context overflow. Regarding the built-in nested sub-agent reading, it innovatively introduces built-in reading tools such as file reading, history reading, and final report generation, constructing a two-layer nested inference architecture. The task of long text retrieval, which consumes context and has low information density, is delegated to independent sub-agent loops, returning only the refined data extracted as needed to the main loop, effectively reducing the context length of the main loop.
[0153] Second, it provides a hybrid SOP scheduling mechanism. In terms of deterministic and autonomous scheduling, it changes the traditional rule engine's forced takeover of tasks, encapsulating fixed standard operating procedures (SOPs) into dynamic tools at the same level as ordinary functional modules. This allows the system to flexibly implement pure SOP execution, mixed SOP process and independent tool calls, or completely free planning within a single task, improving the applicability and execution stability of long-chain tasks. It also provides a two-layer matching architecture for massive business processes. For enterprise-level massive SOP scenarios, it introduces a hybrid strategy of "vector retrieval coarse screening + LLM semantic fine ranking" in the pre-scheduling stage, solving the context length limitation and response latency problems in pure large model matching, and achieving effective dimensionality reduction in time complexity.
[0154] The above describes a ReAct agent loop control method provided by the embodiments of this application. The following describes the apparatus for executing the above ReAct agent loop control method.
[0155] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a ReAct intelligent agent loop control device provided in an embodiment of this application. Figure 4 As shown, the ReAct agent loop control device may include:
[0156] The condition judgment unit 401 is used to obtain the result data returned after calling an external tool in the task loop and to determine whether the result data meets the preset reference triggering condition.
[0157] The pointer generation unit 402 is used to store the result data locally if the condition is met, and to generate a reference pointer pointing to the storage location of the result data.
[0158] Action planning unit 403 is used to register the reference pointer as the return content of the external tool to the attachment list of the target prompt word, and input the target prompt word into the large language model to obtain the next planned action containing the reference pointer;
[0159] The planning execution unit 404 is used to call the tool executor, perform pointer resolution on the next planning action, read the result data from the local machine based on the resolved reference pointer, and pass the read result data to the external tool called by the next planning action for processing to obtain new result data.
[0160] The task loop unit 405 is used to take the new result data as the result data returned after calling the external tool in the task loop, and return to the condition judgment unit until the task loop ends when the external tool called in the next planned action is the task completion tool.
[0161] Each module in the aforementioned ReAct intelligent agent cyclic control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0162] This application also provides an electronic device, which may include at least one processor and a memory connected to the processor, wherein:
[0163] Memory is used to store computer programs;
[0164] The processor is used to execute computer programs to enable electronic devices to implement any of the ReAct agent loop control methods provided in the embodiments of this application.
[0165] refer to Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0166] like Figure 5 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. When the electronic device is powered on, the RAM 603 also stores various programs and data required for the operation of the electronic device. The processing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0167] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, memory cards, hard drives, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0168] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the ReAct intelligent agent loop control methods provided in this application.
[0169] This application also provides a computer-readable storage medium carrying one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the ReAct intelligent agent loop control methods provided in this application.
[0170] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0171] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0172] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0173] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A ReAct agent cyclic control method, characterized in that, include: Obtain the result data returned after calling an external tool in the task loop, and determine whether the result data meets the preset reference triggering conditions; If so, the result data is stored locally, and a reference pointer pointing to the storage location of the result data is generated; The reference pointer is registered as the return content of the external tool in the attachment list of the target prompt word, and the target prompt word is input into the large language model to obtain the next planned action containing the reference pointer; The tool executor is invoked to perform pointer resolution on the next planned action. Based on the resolved reference pointer, the result data is read from the local machine and then passed to the external tool invoked by the next planned action for processing to obtain new result data. The new result data is used as the result data returned after calling the external tool in the task loop. The system then determines whether the result data meets the preset reference triggering conditions, and the task loop ends when the external tool called for the next planned action is a task completion tool.
2. The ReAct agent cyclic control method according to claim 1, characterized in that, The result data returned after calling an external tool in the task loop is a dictionary containing key-value pairs; The step of determining whether the result data meets the preset reference triggering condition, and if so, storing the result data locally and generating a reference pointer to the storage location of the result data, includes: Determine whether the length of the value in each key-value pair of the result dictionary is greater than a preset length threshold, so as to filter out target key-value pairs whose value length is greater than the length threshold, and generate the reference pointer for the value in the target key-value pair; The step of registering the reference pointer as the return content of the external tool into the attachment list of the target prompt word includes: The reference pointer and corresponding key generated for the value in the target key-value pair are registered as the first return content of the external tool in the attachment list of the target prompt word, and the non-target key-value pairs with a value length less than or equal to the length threshold are written as the second return content of the external tool into the execution record placeholder slot of the target prompt word.
3. The ReAct agent cyclic control method according to claim 1, characterized in that, In the case where the external tool is a pre-configured nested sub-agent tool, the step of passing the read result data to the external tool invoked for the next planning action for processing includes: The read result data is passed to the nested sub-agent tool so that the nested sub-agent tool can perform data preprocessing on the read result data, remove redundant data in the read result data, and obtain filtered result data as the new result data.
4. The ReAct agent cyclic control method according to any one of claims 1-3, characterized in that, Before entering the task loop, the following is also included: Obtain the task instruction corresponding to the current task, and filter the target SOP that matches the task instruction from the pre-built standardized operating procedure (SOP) configuration list; The target SOP is instantiated and added to the pool of available tools, which provides callable external tools for the task cycle.
5. The ReAct agent cyclic control method according to claim 4, characterized in that, The step of selecting a target SOP that matches the task instruction from a pre-built list of standardized operating procedures (SOPs) configurations includes: Count the total number of SOPs that are enabled in the SOP configuration list; If the total number is less than a preset threshold, the task instruction, as well as the name and description summary of the SOP contained in the SOP configuration list, are sent to the large language model so that the target SOP can be filtered out by the large language model. If the total number is greater than or equal to the number threshold, the task instruction is matched with the SOP vectors in the pre-built vector index library to obtain a preset number of candidate SOPs with the highest matching degree. The task instruction, as well as the name and description summary of the candidate SOPs, are sent to the large language model to filter out the target SOP through the large language model. The vector index library is obtained by vectorizing the SOPs in the SOP configuration list.
6. The ReAct agent cyclic control method according to claim 4, characterized in that, After instantiating the target SOP and adding it to the available tool pool, the process further includes: A preset high-priority hint is injected into the SOP placeholder of the target prompt word to guide the large language model to prioritize the use of the target SOP when generating the next planned action.
7. The ReAct agent cyclic control method according to claim 1, characterized in that, After the task cycle ends, it also includes: The task completion tool sends the complete historical execution record of the current task and the attachment information in the attachment list to the large language model to obtain the reference file list output by the model. If the reference pointer is generated during the task loop, the attachment information includes the reference pointer and the corresponding reference summary. The reference file list is generated by the large language model when it determines that the complete historical execution record and the attachment information are insufficient to generate a task report. Based on the list of referenced files, the corresponding result data is read from the local machine and sent to the large language model to obtain the task report output by the model.
8. A computer program product, characterized in that, It includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the ReAct agent cyclic control method as described in any one of claims 1 to 7.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the ReAct agent loop control method as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the ReAct intelligent agent cyclic control method as described in any one of claims 1 to 7.