An intelligent task processing method and system based on an external state file driver
By using an intelligent task processing method driven by external state files, the illusion phenomenon and inconsistency in state management of large language models in complex tasks are solved, thereby achieving system reliability and auditability and ensuring the accuracy and consistency of output.
Patent Information
- Application Number
- CN202511492287.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-10-20
AI Technical Summary
In existing technologies, large language models are prone to hallucinations when dealing with complex tasks, have inconsistent state management, are difficult to audit and review end-to-end, and cannot effectively facilitate human-machine collaboration.
An intelligent task processing method driven by external state files is adopted. By creating and updating external state files, the task decomposition and execution process are clarified, and action instructions are executed through tool interfaces. Combined with human-machine collaborative intervention, structured output is generated.
It ensures the accuracy and reliability of the output, avoids state synchronization problems, improves system stability and reliability, and provides auditability and consistency.
Smart Images

Figure CN120973500B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of artificial intelligence, and particularly relates to an intelligent task processing method and system based on external state file driving. BACKGROUND
[0002] With the rapid development of large language model (LLM) technology, its application in automatic systems is increasingly widespread. In the prior art, LLM is directly applied to process complex tasks, such as conducting in-depth research or making emergency response decisions; however, LLM will produce a “hallucination” phenomenon when processing tasks that require accurate facts, and output content that does not conform to the facts; when processing long-term, multi-step tasks, it is easy to forget key goals or state information due to the limitation of context length. In the prior art, a multi-agent system is constructed to iteratively decompose tasks by a master agent, and the execution state of the task is usually implicitly and unstructuredly saved in the dialogue history or internal memory of the master agent. This state management method has the following defects: lack of human-machine collaboration interface, inability to grasp the overall picture of the task, and inability to accurately intervene in task planning; state management is prone to inconsistency or loss; and it is difficult to perform end-to-end auditing and review. SUMMARY
[0003] The application aims to provide an intelligent task processing method and system based on external state file driving to solve the problems of “hallucination” phenomenon, inconsistent state management, and insufficient auditability mentioned in the background art.
[0004] To achieve the above-mentioned purpose, the application adopts the following technical solutions:
[0005] According to one aspect of the application, an intelligent task processing method based on external state file driving is provided, which comprises the following steps:
[0006] Receiving a task request input by a user, creating and initializing an external state file based on the task request;
[0007] Based on the task request and the current content of the external state file, performing task decomposition through a large language model to generate at least one to-be-executed subtask, and updating the subtask to the external state file;
[0008] Entering a task execution loop, and in each loop: reading the current content of the external state file, and generating a next action instruction through the large language model; executing the action instruction through a tool interface; updating the observation result after executing the action instruction and the corresponding subtask state to the external state file;
[0009] When it is determined that the task termination condition is met, a structured output is generated based on the final content of the external state file.
[0010] Based on the foregoing scheme, in the task execution loop, a human-computer collaborative intervention step is further included:
[0011] Receiving natural language intervention instructions of external input;
[0012] Based on the intervention instructions and the current content of the external state file, a modification suggestion for the external state file is generated by the large language model;
[0013] The external state file is updated according to the modification suggestion to modify the task execution process.
[0014] Based on the foregoing scheme, the executing the action instruction through the tool interface includes calling a deterministic external tool function and obtaining a structured observation object, which at least contains one or more of execution state, main data and error information.
[0015] Based on the foregoing scheme, when the structured output is a presentation, the generating the structured output includes:
[0016] The content recorded in the external state file is converted into a structured design intent specification by a design intent generation agent;
[0017] Based on the design intent specification, a layout template is matched from a metadata template library by a layout matching agent;
[0018] According to the matched layout template and content, a series of deterministic editing instructions are generated by an editing instruction generation agent;
[0019] The editing instructions are executed by an instruction execution agent to generate the presentation.
[0020] Based on the foregoing scheme, when the instruction execution agent executes the editing instructions, if an exception occurs, the error information is fed back to the editing instruction generation agent to correct the instructions and re-execute.
[0021] Based on the foregoing scheme, after the task is terminated, the method further includes packaging the final version of the external state file, the final structured output and related metadata together to form an auditable task archive and storing it.
[0022] Based on the foregoing scheme, the task decomposition by the large language model includes:
[0023] A prompt word is constructed, which at least contains system instructions, the current content of the external state file and a list of available tools;
[0024] The large language model performs inference based on the prompt word and outputs a structured task decomposition result;
[0025] The task decomposition result is updated as a new subtask to the external state file, and each subtask is assigned a state identifier.
[0026] Based on the foregoing scheme, in the task execution cycle, the action instructions executed by the tool interface include at least one of the following:
[0027] Call the fusion knowledge base query tool to obtain domain knowledge and historical data from the fusion knowledge base;
[0028] Call the real-time data acquisition tool to obtain a dynamic real-time data stream through a real-time data bus.
[0029] According to another aspect of the present application, an intelligent task processing system driven by an external state file is provided, which comprises a state file management module, a planning engine module, a context builder, a tool interface module, a fusion knowledge base, and a real-time data bus.
[0030] The state file management module is configured to create, read and update the external state file.
[0031] The planning engine module is configured to run a large language model for task decomposition and inference.
[0032] The context builder is configured to build a structured input prompt for the planning engine module, and the core content of the input prompt is derived from the external state file.
[0033] The tool interface module is configured to execute action instructions output by the planning engine module.
[0034] The fusion knowledge base is configured to store domain-specific structured and unstructured knowledge.
[0035] The real-time data bus is configured to access and provide a dynamic real-time data stream.
[0036] Based on the foregoing scheme, a multi-agent document generation module is further included, comprising a design intent generation agent, a format matching agent, an editing instruction generation agent, an instruction execution agent, and a compilation agent.
[0037] The design intent generation agent is configured to generate a structured design intent specification.
[0038] The format matching agent is configured to match a format in a metadata template library.
[0039] The editing instruction generation agent is used for generating deterministic editing instructions;
[0040] The instruction execution agent is used for executing the single-page manuscript file generated by the editing instruction generation agent.
[0041] The compiling agent is used for uniformly merging the single-page manuscript file to output a final manuscript document.
[0042] According to the above technical solution, compared with the prior art, the present application has at least the following advantages and positive effects: by physically separating factual knowledge from the reasoning process, the LLM is forced to obtain factual data by querying the knowledge base, completely eliminating the possibility of LLM generating output inconsistent with facts, ensuring the accuracy and reliability of system output. By taking the external state file as the only, complete and persistent state representation in the entire task life cycle, the complex state synchronization problem of distributed systems is avoided, greatly improving the stability and reliability of the system. The external state file is a complete, time-ordered record and readable archive, and the entire task thinking and execution chain is completely presented in a file, providing auditability. In the document generation scenario, the template is modified by executing deterministic editing instructions, ensuring that the preset layout technical parameters in the template are consistently reproduced in the output file.
[0043] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0044] The accompanying drawings incorporated in the specification and forming a part thereof illustrate embodiments consistent with the present application and together with the description serve to explain the principles of the application. It is clear that the drawings described below are only some embodiments of the present application, and other drawings can be obtained from these drawings without creative labor for those skilled in the art. In the drawings:
[0045] Figure 1 is a schematic diagram of the intelligent task processing method based on the external state file driven by the present application;
[0046] Figure 2 is a flowchart of the intelligent task processing method based on the external state file driven by the present application;
[0047] Figure 3 is a task execution cycle schematic diagram of the present application;
[0048] Figure 4 is a schematic diagram of the intelligent task processing system based on the external state file driven by the present application. DETAILED DESCRIPTION
[0049] In order to illustrate the purpose, technical solutions and advantages of the present application more clearly, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. The example embodiments can be implemented in various forms and should not be understood as being limited to the examples described herein; on the contrary, the embodiments are provided so that the present application will be more comprehensive and complete, and the ideas of the example embodiments will be fully conveyed to those skilled in the art.
[0050] In addition, the described features, structures or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to give a full understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be used. In other cases, well-known methods, devices, implementations or operations are not shown or described in detail to avoid obscuring the aspects of the present application.
[0051] The block diagrams shown in the drawings are only functional entities, which do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0052] The flowcharts shown in the drawings are only exemplary illustrations, which do not necessarily include all contents and operations / steps, and are not necessarily executed in the order described. For example, some operations / steps can be further decomposed, and some operations / steps can be combined or partially combined, so that the actual execution order can be changed according to the actual situation.
[0053] The present application will be described in detail below with reference to specific embodiments:
[0054] Embodiment 1
[0055] As shown in Figure 1 , 2 , the present embodiment provides a smart task processing method based on external state file driving. The specific steps of the method are as follows:
[0056] S1: receiving a task request input by a user, creating and initializing an external state file based on the task request.
[0057] In this embodiment, the task state of the large language model is managed based on an external state file, and structured output is generated. The external state file, i.e., the DPF file, is also called a dynamic plan file; its content evolves dynamically as the task is executed; it may initially only contain a simple task description, but as the large language model decomposes the task and the system executes, it gradually grows into a complete plan containing detailed subtasks, execution results, current state, and subsequent plans.
[0058] After the system receives the task request, it creates and initializes an independent external state file (e.g., named DPF_task_ID.md) for the task; this file is stored in a persistent storage device, making it an external state, thus achieving the separation of state and computation.
[0059] The initial content of the external state file follows a predefined structure. Exemplarily, its initial content at least includes: a file header containing a task unique identifier, a creation timestamp, an initial state, and other metadata; a task list whose initial state contains a to-be-processed task item generated based on the user request, which can be marked as: [P] <task description>.
[0060] Specifically, first, a task request is received through a user interface (such as a chat box, a button trigger), or an automatic monitoring system (such as a sensor alarm); the task request can be a natural language description question (such as "analyze the flood prevention risk of G4 Expressway K150 section"), or a structured instruction (such as {"task_type": "generate_ppt", "topic":"work plan for the second half of the year"}). Further, an external state file is created, and an independent, persistent text file is created and initialized for this task, such as DPF_task_001.md. In all subsequent steps, the system's decisions, executions, and updates are strictly based on the latest content of the external state file, ensuring that all components have a consistent understanding of the task state. The created external state file at least includes: task description, initial state, metadata; the task description records the user's original request; the initial state, exemplarily, a to-be-solved top-level task, marked as: [P] Task: Understand and decompose user query: "Derive the main risk points of G4 Expressway K150 section under 3 hours of 150mm rainfall." ([P] represents Pending / To-be-processed); the metadata includes a task unique identifier, creation time, state (such as Status: ACTIVE), etc.
[0061] S2: Based on the task request and the current content of the external state file, the large language model is used to decompose the task, generate at least one to-be-executed subtask, and update the subtask to the external state file.
[0062] Transform the external state file (DPF) created in step S1, which contains the initial task description, into a structured, step-by-step executable action plan;
[0063] Specifically, first read the current content of the external state file; at this time, there is usually only one top-level task marked as [P] (to be processed) in the external state file; further, build the context, package the DPF current content, system preset instructions (such as "you are a planning engine, please decompose the task"), and available tool list information, etc. into a structured, clear prompt word (Prompt); the available tool list includes: tools for querying the fusion knowledge base (such as query_knowledge_base), tools for obtaining real-time data (such as get_realtime_data), etc. Further, send the prompt to the large language model, output the structured task decomposition result; the task of the large language model is not to directly answer the initial question, but to analyze the task intent and decompose it into a series of discrete, sequentially or parallelly executable subtasks; finally, receive the output of the large language model (i.e. the task decomposition result) as new subtasks and update it to the external state file; these newly generated subtasks are also marked as [P] state, while the original top-level task may be marked as [D] (completed) or [decomposed] state.
[0064] When there is a task item in the external state file with a status of 'to be processed' ([P]) and related to 'planning decomposition', the task decomposition process is automatically triggered. Build the input of the large language model, including reading all the current content of the external state file as the core context; embed a command that limits the role and output format of the large language model, for example: 'your task is to decompose the top-level task in the current external state file into specific, executable sub-steps, and the output must only be a list of subtasks'; then attach a list of available tool functions and their descriptions, such as: query_asset_database, run_simulation, generate_report, etc., to guide the large language model to plan within the known ability range.
[0065] It should be noted that the large language model reasons based on the context, analyzes the final goal of the current task, and disassembles it into a series of sequential or parallel atomic subtasks; each subtask should be matched with available tool functions as much as possible to form explicit actions such as 'call X tool, input Y parameter'; the output of the large language model strictly follows the preset format, for example, returning a JSON array, each array element represents a subtask, containing fields such as description and expected_tool. After receiving the structured decomposition suggestions of the large language model output, mark the original top-level task in the external state file with a status of [P] as completed ([D]), and optionally record 'decomposed'; append all subtasks generated by the large language model to the task list in the external state file with a status of [P]. The updated external state file clearly shows the evolution from 'goal' to 'path', and all new subtasks become the execution object of the subsequent control loop.
[0066] For example, an initial task: "[P] Task: Deduce the risk of G4 high-speed K150 section under 3-hour 150mm rainfall." After reasoning by the large language model, the external state file is updated to:
[0067] "[D] Task: Understand and decompose user query...
[0068] [P] Task: Query G4 K150 section asset information from knowledge base.
[0069] [P] Task: Call hydrological simulation tool and input rainfall parameters.
[0070] [P] Task: Retrieve relevant SOP clauses based on simulation results.
[0071] [P] Task: Generate comprehensive risk assessment report."
[0072] By decomposing complex tasks into specific subtasks, this embodiment converts non-deterministic large language model reasoning into a list of deterministic steps; subsequent steps only need to perform these explicit actions according to the list, greatly improving the reliability and predictability of the system.
[0073] Preferably, if the output of the large language model does not follow the predetermined format or contains unrecognized tool calls, the tool interface will capture this exception and mark the status of the decomposition task as failed ([F]) in the external state file, while recording error details in the observation results; it can be designed to trigger a retry or notify human intervention, thereby preventing incorrect plans from flowing into the execution phase.
[0074] S3: Enter the task execution loop, in each loop: read the current content of the external state file, and generate the next action instruction through the large language model; execute the action instruction through the tool interface; update the observation results after executing the action instruction and the corresponding subtask state to the external state file.
[0075] As shown in Figure 3 The trigger condition of the task execution loop is that there is at least one subtask with the status marker “to be executed” ([P]) in the external state file; each loop cycle starts with access to the external state file state storage, reading the current content of the external state file to obtain the complete status of the task execution at present, ensuring that each decision is based on the latest, global context.
[0076] In this embodiment, after the original task is decomposed into a series of subtasks, the external state file is continuously scanned to locate the subtasks with the status to be processed; the subtasks marked as [P] (to be processed) that need to obtain data are selected from the external state file; a prompt word for the large language model is constructed according to this specific subtask, for example, “current need to query K150 section asset information; please generate an accurate query instruction according to the available tools”. The content of the prompt word template includes: system role instruction, for example, “you are a planning engine, your responsibility is to suggest the best tool call for the next step to be executed according to the current external state file status”; the current external state file status, that is, the entire content of the external state file; the list of available tools, all callable deterministic tools and parameter descriptions; output format instruction, requiring the output of the large language model to be a predefined structured format.
[0077] The large language model outputs a structured, machine-readable action instruction according to the prompt word; the tool interface receives and parses the instruction generated by the large language model, parses and verifies whether the tool name and parameters of the external tool are legal; maps the tool name to the corresponding deterministic tool function and executes (such as executing a specific database SQL query, calling an API to obtain sensor data); after the tool function is executed, the tool interface completely captures the execution result, and encapsulates the result (successfully obtaining data, data being empty, or exception) as a structured observation object. The field design of the observation object includes but is not limited to execution status, primary data, warning information, and error information; the execution status (execution_status) is “SUCCESS”, “PARTIAL_SUCCESS”, “FAILED”, the primary data (primary_data) is the main data result returned by the tool call, the warning information (warnings) is an array of additional information that needs to be paid attention to, and the error information (errors) is an array of error information that causes the operation to fail.
[0078] When the action instruction executed by the tool interface is to query the fusion knowledge base, the system obtains structured information such as domain knowledge, historical data, and device parameters from the fusion knowledge base (RAG Knowledge Base) by calling a deterministic query tool; when the action instruction is to obtain real-time data, the tool interface accesses a real-time data stream through the real-time data bus (Real-time Data Bus) to obtain dynamic information such as sensor readings, device states, and environmental monitoring data.
[0079] Further, a deterministic update operation is performed on the observation object: the corresponding subtask item executed in the current period is found in the external state file, the state identifier of the task item is updated from to-be-executed ([P]) to completed ([D]) or failed ([F]), and the simplified summary or complete content of the observation object is appended or embedded in the form of an additional note (such as (observation result:...)) at the end of the description of the task item. The update operation represents the end of the current period, and the updated external state file becomes the input of the next cycle period, starting a new task execution cycle. This complete recording method provides indispensable facts for complex decision-making (such as fault handling and path re-planning) by the large language model in the next period, and has auditability.
[0080] It should be noted that the large language model converts the natural language description in the external state file into structured and deterministic calling instructions that can be understood by the underlying tool; the large language model itself does not hold or output factual answers, but only outputs “action requests”, which realizes the physical separation of the reasoning process and the source of facts, thereby isolating the propagation path of “hallucinations”.
[0081] During the entire task execution process, the background knowledge and domain specifications are continuously obtained from the fusion knowledge base, the latest state information is continuously obtained from the real-time data bus, the obtained data is updated to the external state file as an observation result, and the next round of decision-making is made based on the updated state.
[0082] Optionally, the embodiment also provides human-computer collaborative intervention, which can be triggered in parallel and integrated into the task execution loop; the operator inputs a natural language instruction, i.e., an external intervention instruction, through a user interface (such as a chat window or an instruction panel); the instruction can be a query of the current task, a modification of the execution process, or the injection of new knowledge; for example, when monitoring the flood control emergency response, the operator finds that the system planning to dispatch a UAV has risks, and can input: “suspend the dispatch task of UAV_02, prioritize notifying the road department to close the K150-K152 entrance, and add the task of checking the status of the backup power supply”. After receiving the external intervention instruction, the original external state file is not interrupted or reset, but is taken as a new, high-priority input and processed in the next task execution loop; based on the complete content of the current external state file and the newly received external intervention instruction, the corresponding instruction is constructed, for example, “an operator gives the following instruction. Please understand its intention and generate specific modification suggestions for the external state file based on the current external state file state to execute the instruction.”; and a list of available tools is given. The large language model reasons based on this context and outputs modification suggestions for the external state file. The tool interface parses the output and directly modifies the external state file as a deterministic operation (such as suspending a task, inserting a new task, or modifying the priority of a task).
[0083] Through human-computer collaborative intervention, the operator can achieve precise control using natural language; all interventions are converted into explicit modifications to the external state file, avoiding ambiguity and recording the entire operation; the operator's external intervention is seamlessly integrated into the existing automated process and state management framework, maintaining the consistency of the system state; each human-computer interaction, including intervention instructions, system understanding (generated modification suggestions), and final external state file changes, is recorded in the history version of the external state file or the system log, providing clear audit clues for subsequent process optimization and review.
[0084] S4: When it is determined that the task termination condition is met, a structured output is generated based on the final content of the external state file.
[0085] The task termination condition includes: there is no subtask with a state of 'to be executed' in the external state file; a task termination instruction is received; all subtasks in the external state file have a state of 'completed' or 'failed'. After the task execution loop completes all data acquisition and logical reasoning subtasks, the structured output generation step is entered, the input of which is the external state file recording the complete task execution history and data observation results, and the output is a structured document conforming to the preset specification. According to the different types of output, the corresponding generation process is started; in this embodiment, according to the output type, it is divided into two paths: generating a text report and outputting a demonstration class manuscript.
[0086] When there is a task item in the external state file that generates a text report (such as a risk assessment report), extract the observation results and key data of all completed tasks from the external state file, package the external state file content and report generation instructions (such as "Please write a structured risk assessment report based on the following task records and data") to the large language model, format the structured report draft generated by the large language model with a deterministic template (such as an XML or Markdown template), and finally render it into a document of a specified format (such as PDF, DOCX) to complete the output.
[0087] When there is a task item in the external state file that generates a presentation, activate the multi-agent collaboration pipeline, which includes in turn: design intent generation agent, layout matching agent, editing instruction generation agent, instruction execution agent, and compilation agent;
[0088] The design intent generation agent reads the part of the external state file related to the presentation outline and content, and through natural language processing, converts the unstructured text content of each page into a machine-readable structured design intent specification that defines at least the content element type and design constraints of the page; the communication intent is converted into layout technical parameters;
[0089] The layout matching agent accepts the design intent specification and performs retrieval and matching in the metadata template library based on its content, which stores technical parameters of each layout template, such as placeholder shape ID, precise coordinates, font style, and color RGB value; the layout matching agent outputs the unique identifier of the layout template with the highest compatibility with the design intent specification;
[0090] The editing instruction generation agent receives the specific page content and unique identifier of the layout template, and based on the metadata of the layout template, generates a series of deterministic, atomic editing instructions that precisely specify the identifier of the element to be operated and the operation content;
[0091] The instruction execution agent executes the editing instruction sequence one by one by calling the underlying document operation interface to modify the template; it also has an error correction mechanism that generates feedback information containing error type and error identifier when it captures an exception during execution, and returns the feedback information to the editing instruction generation agent; the editing instruction generation agent corrects the editing instructions based on the feedback information and re-submits them to the instruction execution agent for execution until the instruction sequence is successfully executed, generating a single-page presentation file;
[0092] Compile the agent, merge all successfully generated single-page presentation files in order, apply a unified theme style, and output the final presentation document.
[0093] Further, the embodiment also includes task archiving and auditing; when it is determined that all sub-task states in the external state file are "completed" ([D]) or "failed" ([F]) or a external termination instruction is received, the task termination condition is met; the task state field (Status) in the file header metadata of the external state file is updated from "active" (ACTIVE) to "closed" (CLOSED) or "terminated" (TERMINATED); the final version of the external state file, the final output result and the task metadata index form a complete task archive and are stored in a persistent archive database. The final version of the external state file records the complete state evolution record, action instruction sequence and observation result from task initialization to end; the final output result is the structured output generated in step S5, such as a text report or a presentation file; the metadata index includes the task unique identifier, the creation timestamp, the end timestamp, the key performance indicators, etc.
[0094] The task archive formed by the final version of the external state file, the final output result and the task metadata index provides a complete and tamper-proof execution chain from the task request to the final output, so that any decision or output can be traced back to its original data source and decision context.
[0095] Embodiment 2
[0096] As shown in Figure 4 , the embodiment exemplarily presents an intelligent task processing system driven based on an external state file, including a state file management module, a context builder, a planning engine module, a tool interface module, a fused knowledge base and a real-time data bus.
[0097] The state file management module is used to create, read and update the external state file; the external state file is created based on the task request; the external state file is a structured text file (such as a Markdown format), which records the complete life cycle of the task, including the initial goal, the decomposed sub-tasks, the execution state of each task (such as [P] to be executed, [D] completed), the observation results of tool execution and the manual intervention record, and is the only fact source of the system.
[0098] The context builder is used to build a structured input prompt for the planning engine module, and the core content of the input prompt is derived from the external state file; at the beginning of each working period, a unambiguous and structured Prompt is constructed from the external state file, system instructions, available tool lists and other sources according to a template, which greatly improves the stability and relevance of the output of the large language model.
[0099] A planning engine module for running large language models for task decomposition and reasoning; does not directly interact with users or external tools, and only outputs action suggestions (such as tool invocation instructions) for the next step based on the context provided by the context builder in each work cycle.
[0100] A tool interface module for executing the action instructions output by the planning engine module; a deterministic code module responsible for parsing and executing the action instructions output by the large language model (such as calling APIs, querying databases).
[0101] A fusion knowledge base for storing structured and unstructured knowledge in the field; stores static, authoritative, and factual knowledge in the field, such as infrastructure design drawings, operating procedures (SOP), equipment parameters, etc.; the tool interface module provides factual basis for the large language model by querying the fusion knowledge base to prevent hallucinations.
[0102] A real-time data bus for accessing and providing dynamic and real-time data streams, such as sensor readings, video streams, weather data, etc., so that the system can perceive the instantaneous changes in the real world.
[0103] In another embodiment, it also includes a multi-agent manuscript generation module, including a design intent generation agent, a layout matching agent, an editing instruction generation agent, an instruction execution agent, and a compilation agent.
[0104] The design intent generation agent is used to generate structured design intent specifications; the layout matching agent is used to match layouts in the metadata template library according to the design intent specifications; the editing instruction generation agent is used to generate deterministic editing instructions; the instruction execution agent is used to execute the editing instructions to generate single-page manuscript files and implement closed-loop error correction; and the compilation agent is used to unify and merge single-page manuscripts to output the final manuscript document.
[0105] Optionally, the embodiment also includes a human-machine collaboration interface, the system provides a natural language interaction interface, allowing operators to view external state files in real time to grasp the overall situation, and can input natural language instructions for intervention; the system understands the instruction intent through the large language model and converts it into deterministic modifications to the external state file, achieving precise and safe human-machine collaboration.
[0106] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims. It is understood that the application is not limited to the precise structures herein disclosed and illustrated, and that various modifications and changes can be made therein without departing from the scope thereof. The only true scope of the application is indicated by the appended claims.
Claims
1. A smart task processing method based on external state files, characterized in that, The method includes: Receive a task request input by the user, and create and initialize an external state file based on the task request; the external state file is a text file independent of the large language model and is stored in a persistent storage device to achieve separation of state and computation; Based on the task request and the current content of the external state file, the task is decomposed using a large language model to generate at least one subtask to be executed, and the subtask is updated in the external state file. The task decomposition using a large language model includes: constructing prompt words, which at least contain system instructions, the current content of the external state file, and a list of available tools; the large language model performing inference based on the prompt words and outputting a structured task decomposition result; and updating the external state file with the task decomposition result as a new subtask, wherein each subtask is assigned a state identifier. Enter the task execution loop. In each loop: read the current content of the external state file and generate the next action instruction through the large language model; execute the action instruction through the tool interface; update the observation results and corresponding subtask states after executing the action instruction to the external state file. When the task termination condition is met, structured output is generated based on the final content of the external status file; When the structured output is a presentation, the process includes: converting the content recorded in the external state file into a structured design intent specification through a design intent generation agent; matching a layout template from a metadata template library based on the design intent specification through a layout matching agent; generating a series of deterministic editing instructions through an editing instruction generation agent based on the matched layout template and content; and executing the editing instructions through an instruction execution agent to generate the presentation.
2. The intelligent task processing method based on external state file driving according to claim 1, characterized in that, The task execution loop also includes a human-machine collaborative intervention step: Receive natural language intervention instructions from external input; Based on the intervention instruction and the current content of the external state file, modification suggestions for the external state file are generated through the large language model; Update the external status file according to the proposed modifications.
3. The intelligent task processing method based on external state file driving according to claim 1, characterized in that, The execution of the action command through the tool interface includes calling a deterministic external tool function and obtaining a structured observation object, wherein the observation object contains at least one or more of the following: execution status, master data, and error information; the master data is the main data result returned by the tool call.
4. The intelligent task processing method based on external state file driving according to claim 1, characterized in that, If an error occurs while the instruction execution agent is executing an editing instruction, it will send the error information back to the editing instruction generation agent to correct the instruction and re-execute it.
5. The intelligent task processing method based on external state file driving according to claim 1, characterized in that, After the task is terminated, the final content of the external status file, the structured output, and related metadata are packaged together to form an auditable task file and stored.
6. The intelligent task processing method based on external state file driving according to claim 1, characterized in that, In the task execution loop, the action instructions executed through the tool interface include at least one of the following: The fusion knowledge base query tool is invoked to obtain domain knowledge and historical data from the fusion knowledge base; Call the real-time data acquisition tool to obtain dynamically changing real-time data streams through the real-time data bus.
7. An intelligent task processing system based on external state files, used to implement the intelligent task processing method as described in any one of claims 1-6, characterized in that, It includes a status file management module, a context builder, a planning engine module, a tool interface module, a fusion knowledge base, and a real-time data bus; The status file management module is used to create, read, and update external status files; The context builder is used to construct structured input prompts for the planning engine module, the core content of which originates from the external state file; The planning engine module is used to run a large language model for task decomposition and reasoning; The tool interface module is used to execute action commands output by the planning engine module; The fusion knowledge base is used to store domain-specific structured and unstructured knowledge; The real-time data bus is used to access and provide dynamically changing real-time data streams.
8. The intelligent task processing system based on external state file driving according to claim 7, characterized in that, It also includes a multi-agent document generation module, including an agent for generating design intent, an agent for matching layout, an agent for generating editing instructions, an agent for executing instructions, and an agent for compiling; The design intent generation agent is used to generate structured design intent specifications; The layout matching agent is used to match layouts in the metadata template library; The editing instruction generating agent is used to generate deterministic editing instructions; The instruction execution agent is used to execute editing instructions to generate a single-page document file; The compiler agent is used to merge the single-page document files and output the final document.
Citation Information
Patent Citations
Complex task decomposition and dynamic optimization method and device based on large language model
CN119883549A
Intelligent agent-based big language model retrieval enhancement generation system and method
CN120470088A