Task state driven hierarchical memory management method and apparatus, and medium

CN123011997APending Publication Date: 2026-10-30NINETECH INFORMATION TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611278030.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-21
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本发明实施例提出一种基于任务状态驱动的分层记忆管理方法、装置及介质,用以解决相关技术中AI智能体采用静态检索或统一召回的记忆增强方法存在的记忆检索精确度低、相关性差及召回信息过多影响代理执行稳定性技术问题

Benefits of technology

本发明实施例中一种基于任务状态驱动的分层记忆管理方法,通过接收用户输入任务目标并解析处理获得任务结构化描述后,结合任务目标执行过程抽象划分为多个任务状态,并基于任务结构化描述、当前任务状态生成当前任务状态对象后,基于当前任务状态对象在预设分层记忆中按照预设记忆检索方式获得目标记忆组合,并将目标记忆组合输入至目标代理决策执行模块获得当前步骤的执行结果,通过执行结果更新当前任务状态对象以重新获取适配的目标记忆组合,进而推进至下一步骤的动作执行,直至完成所有步骤后获得满足目标任务的预期结果;通过适配不断更新的当前任务状态对象,按照预设记忆检索方式进行精确检索相关性高的记忆,进而解决相关技术中采用静态检索或统一召回的记忆增强方法存在的记忆检索精确度低、相关性差及召回信息过多影响代理执行稳定性技术问题,提供了一种能够适应当前任务状态变化从而获取适应目标记忆组合的、召回记忆内容精确高的基于任务状态驱动的分层记忆管理方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011997A_ABST
    Figure CN123011997A_ABST
Patent Text Reader

Abstract

The application discloses a layered memory management method and device based on task state driving and a medium. The method is abstractly divided into multiple task states through a task target execution process, a current task state object is generated based on task structured description and the current task state, a target memory combination is obtained in a preset layered memory according to a preset memory retrieval mode based on the current task state object, the current task state object is updated according to an execution result of the target memory combination to reacquire an adapted target memory combination, and then the action execution of the next step is promoted until the expected result satisfying the target task is obtained after all steps are completed, thereby solving the technical problems of low memory retrieval accuracy, poor correlation and excessive recall information affecting agent execution stability in the memory enhancement method using static retrieval or unified recall in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a hierarchical memory management method, apparatus and medium based on task state-driven approach. Background Technology

[0002] With the development of AI technology, it is gradually being applied in enterprise office automation, web page operation, business approval, information processing, and system workflow execution scenarios. In related technologies, to improve the long-task execution capability of AI agents, a memory module is typically added to store information such as historical dialogues, tool execution results, and historical experience. During execution, reasoning is then performed using conversation history concatenation, vector retrieval, caching of historical trajectories, and supplementary context generated based on retrieval enhancement. However, memory enhancement methods using static retrieval or unified recall in related technologies cannot accurately retrieve corresponding memories based on the current task state. This leads to excessive memory recall information with poor relevance, thus affecting the stability of agent execution.

[0003] Therefore, how to solve the technical problems of low memory retrieval accuracy, poor relevance, and excessive recall information affecting the stability of agent execution in related technologies has become a technical challenge that needs to be overcome by those skilled in the art. Summary of the Invention

[0004] This invention proposes a hierarchical memory management method, device, and medium based on task state-driven principles to address the technical problems of low memory retrieval accuracy, poor relevance, and excessive recall information affecting agent execution stability in related technologies where AI agents employ static retrieval or unified recall memory enhancement methods.

[0005] In a first aspect, one embodiment of the present invention provides a task-state-driven hierarchical memory management method, comprising: Receive the task objective input by the user, and parse the task objective to obtain a structured description of the task; The execution process of the task objective is abstractly divided into multiple task states, and a current task state object is generated based on the structured description of the task and the current task state. Based on the current task status object, a target memory combination is obtained by performing a preset memory retrieval method in a preset hierarchical memory; The target memory combination is input into the target agent decision execution module to obtain the execution result of the current step; After updating the current task state object based on the execution result, the target memory combination is retrieved again and executed until the execution result meets the expected result of the task target.

[0006] The task-state-driven hierarchical memory management method of this invention has at least the following beneficial effects: This invention discloses a task-state-driven hierarchical memory management method. After receiving and parsing user-inputted task objectives to obtain a structured description, the method abstracts and divides the task execution process into multiple task states. Based on the structured description and the current task state, a current task state object is generated. Then, based on this object, a target memory combination is retrieved from a preset hierarchical memory using a preset memory retrieval method. This target memory combination is input to a target agent decision-making execution module to obtain the execution result of the current step. The execution result updates the current task state object to re-acquire a suitable target memory combination, thus advancing to the next step until all steps are completed and the expected result satisfying the target task is obtained. By adapting to the continuously updated current task state object and accurately retrieving highly relevant memories according to the preset memory retrieval method, this method solves the problems of low memory retrieval accuracy, poor relevance, and excessive recall information affecting agent execution stability in related technologies that use static retrieval or unified recall memory enhancement methods. This provides a task-state-driven hierarchical memory management method that can adapt to changes in the current task state to obtain suitable target memory combinations and retrieve highly accurate memory content.

[0007] According to other embodiments of the hierarchical memory management method of the present invention, the step of abstractly dividing the task into multiple task states based on the execution process of the task objective includes: Based on the execution process of the task objective, it is abstractly divided into initialization state, planning state, execution state, verification state, error correction state, recovery state and completion state. Each state node includes one or more task stages, and each task stage includes one or more steps.

[0008] According to other embodiments of the hierarchical memory management method of the present invention, the step of generating a current task state object based on the task structure description and the current task state includes: An initialization state object is generated based on the task structure description, and the initialization state object is the current task state object.

[0009] According to other embodiments of the hierarchical memory management method of the present invention, the preset hierarchical memory includes short-term conversation memory, task state memory and long-term experience memory; The step of obtaining the target memory combination by performing a preset memory retrieval method in a preset hierarchical memory according to the current task state object includes: Pre-establish a mapping table between task states and memory strategies; By combining the current task state object and the task state-memory strategy mapping table, candidate memory combinations are obtained in the short-term conversation memory, the task state memory, and the long-term experience memory; The target memory combination is obtained by performing a multi-dimensional comprehensive score on the candidate memory combinations.

[0010] According to other embodiments of the hierarchical memory management method of the present invention, the step of obtaining the target memory combination by performing a multi-dimensional comprehensive scoring on the candidate memory combinations includes: Obtain one or more of the following from the candidate memory combination: semantic relevance to the current step, task stage matching degree, environmental consistency, step dependency matching degree, time validity, and historical success weight; The score for each candidate memory is obtained by weighting the results according to preset weights. The target memory group is obtained based on the score of each candidate memory and a preset threshold condition.

[0011] According to other embodiments of the hierarchical memory management method of the present invention, the current task state object includes a unique task identifier, task stage, current step, pending steps, environment summary, exception information, and recovery point information; updating the current task state object according to the execution result includes: If the execution result is successful, proceed to the next step and write the updated current task state object into the task state memory; If the execution result is a failure, an exception message is written into the task state memory, and the current task state object is updated to the task state object corresponding to the error correction state or the recovery state before the corresponding target memory combination is re-acquired.

[0012] The hierarchical memory management method according to other embodiments of the present invention further includes: After the task objective is achieved, the execution path will be written into the long-term experience memory.

[0013] According to other embodiments of the hierarchical memory management method of the present invention, each memory stored in the short-term session memory, the task status memory, and the long-term experience memory is additionally assigned a unique task identifier, a status tag, an environment tag, a time tag, and a success rate tag; and the short-term session memory, the task status memory, and the long-term experience memory are managed by independent storage areas or logical partitions.

[0014] Secondly, one embodiment of the present invention provides a task-state-driven hierarchical memory management device, comprising: The structured processing module is used to receive the task target input by the user and parse the task target to obtain a structured description of the task. The task state creation module is used to abstractly divide the execution process of the task objective into multiple task states, and generate a current task state object based on the task structure description and the current task state. The target memory combination recall module is used to obtain the target memory combination by performing a preset memory retrieval method in a preset hierarchical memory according to the current task status object; The decision execution module is used to input the target memory combination into the target agent decision execution module to obtain the execution result of the current step; The status update and result output module is used to update the current task status object according to the execution result, then re-acquire the target memory combination and execute it until the execution result meets the expected result of the task target.

[0015] Thirdly, one embodiment of the present invention provides a computer-readable storage medium storing an executable program, which is executed by a processor to implement the task state-driven hierarchical memory management method described above. Attached Figure Description

[0016] Figure 1 This is a schematic flowchart of a specific embodiment of a hierarchical memory management method based on task state driving according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a specific embodiment of a hierarchical memory management method based on task state driving according to an embodiment of the present invention, in which step S300 includes sub-steps; Figure 3 This is a schematic diagram of a specific embodiment of a hierarchical memory management method based on task state driving according to an embodiment of the present invention, in which step S330 includes sub-steps; Figure 4 This is a schematic diagram of the overall operation flow of a specific embodiment of a task state-driven hierarchical memory management method according to the present invention. Figure 5 This is a schematic diagram of the module composition of a specific embodiment of a task state-driven hierarchical memory management device according to an embodiment of the present invention. Detailed Implementation

[0017] The following will describe the inventive concept and its resulting technical effects clearly and completely with reference to embodiments, so as to fully understand the purpose, features and effects of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are all within the scope of protection of the present invention.

[0018] In the description of the embodiments of the present invention, the term "several" means one or more, and the term "multiple" means two or more. The terms "greater than," "less than," and "exceeding" should be understood as excluding the stated number, while the terms "above," "below," and "within" should be understood as including the stated number. The terms "first" and "second" should be understood as distinguishing technical features, and not as indicating or implying relative importance, the number of indicated technical features, or the order of the indicated technical features.

[0019] Reference Figure 1 This invention provides a task-state-driven hierarchical memory management method, applied to memory retrieval management during AI agent action execution. It addresses the problems in related technologies, such as poor correlation between memory retrieval and the current task state, and poor agent execution stability due to excessive retrieved memory content. Specifically, it includes the following steps: S100: Receive the task target input by the user and parse the task target to obtain a structured description of the task; The user-input task objective refers to the task instruction that the user sends to the agent execution module (large language model or AI agent) based on their current needs. The task instruction is processed through natural language understanding, rule extraction, and structured parsing to obtain a structured data description of the task. Natural language understanding includes word segmentation, semantic recognition, intent recognition, and entity extraction of the user input (task objective) to obtain information such as the task object, actions, constraints, and expected results. Rule extraction involves extracting structured elements such as time conditions, object scope, step restrictions, and result requirements from the task instruction based on preset keywords, sentence templates, field matching rules, and business matching rules. Structured parsing involves converting the results of natural language understanding and rule extraction into a unified structured description of the task, which includes at least the following fields: task name, task object, execution steps, constraints, expected results, and execution scope.

[0020] S200. The execution process of the task objective is abstractly divided into multiple task states, and a current task state object is generated based on the structured description of the task and the current task state. The process from receiving the user's input task objective to the feedback output result can be abstractly divided into multiple task states based on the execution progress of the task objective. The purpose of dividing the task into multiple task states is to enable subsequent targeted and precise memory retrieval based on the current task state. Simultaneously, to describe, acquire, or store specific information about the current task state, a current task state object is generated based on the structured description of the task and the current task state. The task state object includes information such as the task identifier, task stage identifier, current step identifier, completed steps, pending steps, step dependencies, task objective constraints, expected result constraints, current environment summary, most recent execution result, whether there is an exception, exception type, recovery point information, and state update time.

[0021] S300: Based on the current task status object, perform a preset memory retrieval method in the preset hierarchical memory to obtain the target memory combination; Among them, the preset hierarchical memory is used to store different types of memory content. After obtaining the specific information used to describe the current task state (i.e. the current task state object), the target memory combination can be accurately recalled in the preset hierarchical memory according to the preset memory retrieval method based on the current task state object. This realizes the binding of task state and recalled memory, avoiding the problem of too much recalled memory information and poor relevance caused by using static retrieval or unified recall methods.

[0022] S400. Input the target memory combination into the target agent decision execution module to obtain the execution result of the current step; The target agent decision execution module includes a large language model and tool execution module in the AI ​​agent. After obtaining the target memory combination in step S300, the target memory combination is input into the target agent decision execution module to generate and execute actions, thereby obtaining the execution result of the current step.

[0023] S500. After updating the current task status object based on the execution result, reacquire the target memory combination and execute it until the execution result meets the expected result of the task target.

[0024] In this process, after obtaining the execution result of the current step, the task state changes (i.e., the specific content of the current task state object changes). The target memory combination obtained in step S300 is no longer suitable for the current task state, and the execution result may be success or failure. If the execution is successful, the task state advances to the next step (which may be the next step after the current task state or the first step of the next task state). If the execution fails, the task state switches to a suitable error correction state or recovery state. Therefore, after obtaining the execution result in step S400, the current task state object is updated according to the execution result, and the target memory combination is retrieved again and executed until the obtained execution result meets the expected result of the task objective or all steps of the task objective are completed.

[0025] This invention discloses a hierarchical memory management method based on task state driving. After abstracting the execution process of a task objective into multiple task states, a current task state object is generated based on the task's structured description and the current task state. Then, based on the current task state object, target memory combinations are obtained from a preset hierarchical memory using a preset memory retrieval method. After executing corresponding actions based on the target memory combinations and obtaining execution results, the process proceeds to the next step. The current task state object is then updated based on the execution results, and the target memory combinations are retrieved and executed again. This process continues until the obtained execution results meet the expected results of the task objective or all steps of the task objective are completed. By deeply and dynamically binding changes in the current task state with the recalled target memory combinations, each action executed by the target agent decision-making execution module is adapted to the current task state, thus avoiding the problems of excessive recalled memory information and poor relevance caused by static retrieval or unified recall methods.

[0026] In some embodiments, to fully describe the different states during the execution of the task objective, the division of multiple task states in step S200 of the above embodiments is based on the general process of task objective execution, the task step advancement mechanism, and the execution feedback closed-loop mechanism. Specifically, in this embodiment, the task states are abstractly divided according to the execution process of the task objective, including the following: initialization state, planning state, execution state, verification state, error correction state, recovery state, and completion state; wherein, each of the above task states includes one or more task stages, and each task stage includes one or more steps.

[0027] In other specific embodiments, the initialization state in the above embodiments includes the initial preparation stage after the task objective is created, that is, the stage after the AI ​​agent receives the task objective input by the user, which includes steps such as environmental perception and resource preparation; the planning state includes the task objective decomposition stage and the execution path generation stage; the execution state includes the specific action execution stage; the verification state includes the execution result comparison stage with the task objective and the execution result comparison stage with the expected result; the error correction state includes the problem correction stage after the execution result is wrong; the recovery state includes the execution recovery stage after the task is interrupted or an anomaly is reselected and the execution path is resumed; the completion state includes the ending stage after the task objective reaches the expected result. Each of the above task stages includes one or more steps. In the process of executing the task objective, the execution progresses according to the execution action corresponding to the step. After the execution of one step is completed, the next step is entered according to the execution result of the current step. The next step may be in the current task state or another task state. As long as the next step is entered, the specific content of the corresponding current task state object has changed.

[0028] In some embodiments, after receiving the task objective and parsing it to obtain a structured task description, the system (AI agent) enters an initialization state. Then, in step S200 of the above embodiments, a current task state object is generated based on the structured task description and the current task state. This means that after obtaining the structured task description, the system first generates a current task state object in the initialization state. The current task state object includes the initial task stage, the current step, the steps to be executed, constraints, and initial environmental information. After completing the initialization process, the system actively updates the task stage identifier in the current task state object to the planning state; that is, the current task state object is updated to a planning state object. Subsequently, the current task state object is updated after each step is executed in the system.

[0029] Reference Figure 2In some embodiments, to adapt to changes in the current task state object and perform different retrieval priorities at different memory levels, this embodiment pre-defines hierarchical memory including short-term session memory, task state memory, and long-term experience memory. Different memories are used to store different types of memories, and then, based on the current task state object, target memory combinations are retrieved from different memories according to a preset memory retrieval method. Specifically, in this embodiment, short-term session memory stores several recent user commands, several recent inference contexts, several recent tool return results, task goal constraints, and expected result constraints in the current session; task state memory stores task number, current stage, current step, completed steps, pending steps, page or environment snapshot summary, anomaly markers, recovery point information, and state transition records; long-term experience memory stores historical task templates, successful paths, failure cases, recovery strategies, domain rules, and scenario-based operational experience. Furthermore, step S300 in the above embodiment includes the following sub-steps: S310. Pre-establish a mapping table between task status and memory strategy; In this embodiment, the task state-memory strategy mapping table is used to determine the retrieval priority and recall rules for the current task state in short-term memory, task state memory, and long-term experience memory. For example: In the planning stage, prioritize retrieving historical task templates from long-term experience memory; In the execution state, priority is given to retrieving task state memory and short-term session memory; During the verification state, priority is given to retrieving task goal constraints and expected result constraints from task state memory and short-term session memory; In the error correction or recovery state, priority is given to retrieving failure cases and recovery strategies from long-term experience memory, as well as abnormal markers from task state memory.

[0030] Among them, the memory level that is prioritized for retrieval has a higher retrieval weight and recall rate.

[0031] S320. Combine the current task state object and the task state and memory strategy mapping table to obtain candidate memory combinations in short-term conversation memory, task state memory and long-term experience memory. The current task status object includes information such as a unique task identifier, task stage, current step, pending steps, environment summary, exception information, and recovery point information. The current task status can be determined by the content of the current task status object. Candidate memory combinations are extracted from short-term conversation memory, task status memory, and long-term experience memory according to the priority retrieval and recall rules corresponding to the current task status.

[0032] S330. The candidate memory combinations are comprehensively scored from multiple dimensions to obtain the target memory combination.

[0033] In step S200, the candidate memory combinations may also contain memory content with low relevance to the current task state. In this step, the candidate memory combinations are further evaluated in multiple dimensions to select target memory combinations that meet the score requirements for relevance to the current task state, so as to achieve the purpose of matching the recalled memory with the current task state and avoid the poor relevance of the recalled memory and the excessive recall information affecting the stability of agent execution.

[0034] Reference Figure 3 In some embodiments, in order to filter out the target memory combination from the candidate memory combinations and prevent the deletion of memories that are highly relevant to the current task state, step S330 in the above embodiments specifically includes the following sub-steps: S331. Obtain one or more of the following for each candidate memory in the candidate memory combination: semantic relevance, task stage matching degree, environmental consistency, step dependency matching degree, time validity, and historical success weight. Among them, semantic relevance refers to the semantic closeness between the current candidate memory and the task objective and the current step in the candidate memory combination; task stage matching degree refers to whether the current candidate memory matches the task stage of the current task state; environment consistency refers to whether the environment label when the current candidate memory was generated is consistent with the environment summary of the current task state; step dependency matching degree refers to whether the current candidate memory corresponds to the upstream and downstream relationship of the current step; time validity refers to whether the current candidate memory is available and has not expired; historical success weight refers to the validity and stability of the current candidate memory after it has been used in similar historical tasks.

[0035] S332. Calculate the score for each candidate memory according to the preset weights; The preset weights can be adapted and set according to the task scenario and user needs. By assigning preset weights to the semantic relevance, task stage matching degree, environmental consistency, step dependency matching degree, time validity and historical success weight of each candidate memory in the above step S310, the score of each candidate memory is calculated.

[0036] S333. Obtain the target memory combination based on the score of each candidate memory and the preset threshold conditions.

[0037] In step S332, after obtaining the score for each candidate memory, the score is compared with a preset threshold value. Candidate memories with scores greater than the preset threshold are considered target memories. One or more target memories that meet the preset threshold are considered a target memory combination. In this embodiment, after obtaining the target memory combination, the multiple target memories are sorted according to their scores to generate a recall result.

[0038] In some embodiments, to facilitate management and improve retrieval efficiency, each memory stored in the short-term session memory, task status memory, and long-term experience memory is appended with a unique task identifier, status tag, environment tag, time tag, and success rate tag. Simultaneously, the short-term session memory, task status memory, and long-term experience memory are managed through independent storage areas or logical partitions.

[0039] Reference Figure 4 The following specific embodiment illustrates the execution process of the task state-driven hierarchical memory management method of the present invention: The system receives user-input task objectives and performs natural language understanding, rule extraction, and structured parsing to obtain a structured task description. Based on this description and initialization state, it initializes the task state to generate an initial state object, determining the initial task stage, current step, pending steps, constraints, and initial environmental information. After initialization, the task execution progress (task stage identifier changes) transitions from the initialization state to the planning state. At this point, the current task state object is updated to a planning state object, which includes a unique task identifier, task stage identifier, current step, pending steps, environmental summary, exception information, and recovery point information. Furthermore, based on the task state (planning state) corresponding to the task stage, and according to the retrieval priority and recall rules defined in the task state-memory strategy mapping table, when in the planning state, priority is given to retrieving historical task templates from long-term experience memory. After retrieving and recalling from long-term experience memory, further retrieval and recall are performed in short-term conversation memory and task state memory to obtain candidate memory combinations. After further multi-dimensional comprehensive scoring of candidate memory combinations, the target memory combination is determined. This target memory combination is input into the LLM (Large Language Model), and a corresponding action is generated and executed based on the current step to obtain the execution result. If execution is successful, the task progresses to the next step. The current task state object is updated based on the execution result (success), and the updated current task state object is written into the task state memory for storage. Then, it is determined whether the task objective is completed (whether the pending steps are empty). If the task objective is not completed, the current task state is determined based on the updated current task state object, and the process of candidate memory combination, target memory combination, action generation and execution, execution result determination, and updating the current task state object is repeated. After the target task is completed, the execution path, key state transitions (such as transitions between task states), and effective operation strategies (such as action execution information) are bound to the task state and written into long-term experience memory for future use when executing related task objectives. Furthermore, if an execution failure occurs during task execution, the current task state transition directly switches to the recovery state, and the exception information is written into the task state memory for future use when executing subsequent task objectives. After switching to the recovery state, the current task state object is updated. At this time, failure cases and recovery strategies in long-term experience memory and recovery point information in task state memory are retrieved first. Then, candidate memory combinations are obtained by further searching in short-term conversation memory, task state memory and long-term experience memory. After multi-dimensional comprehensive scoring to determine the target memory combination, the target memory combination is input into LLM (Large Language Model). The corresponding action is generated and executed in combination with the current step to obtain the execution result. Then, based on the execution result, it is determined whether the execution is successful and proceeds to the next step or switches to the recovery state.Furthermore, failure cases and recovery paths are bound to task states and written into long-term experience, enabling more accurate recall of memory content under similar conditions and improving experience reuse capabilities. In this embodiment, by adapting to the continuously updated current task state object, highly relevant memories are accurately retrieved according to a preset memory retrieval method, thereby solving the technical problems of low memory retrieval accuracy, poor relevance, and excessive recall information affecting the stability of proxy execution in memory enhancement methods using static retrieval or unified recall in related technologies.

[0040] Reference Figure 5 This invention also provides a hierarchical memory management device based on task state driving, which includes a structured processing module, a task state creation module, a target memory combination retrieval module, a decision execution module, and a state update and result output module. The structured processing module receives user-inputted task targets and parses them to obtain a structured description of the task. The task state creation module abstracts and divides the execution process of the task target into multiple task states and generates a current task state object based on the task structured description and the current task state. The target memory combination retrieval module retrieves target memory combinations by performing a preset memory retrieval method in a preset hierarchical memory based on the current task state object. The decision execution module inputs the target memory combination to the target proxy decision execution module to obtain the execution result of the current step. The state update and result output module updates the current task state object based on the execution result, then re-acquires the target memory combination and executes it until the execution result meets the expected result of the task target.

[0041] In this embodiment, a task state creation module is set up to abstractly divide the execution process of the task target into multiple task states. After initializing the state object, a preset memory retrieval method is executed in the preset hierarchical memory based on the current task state object to obtain the target memory combination. The current task state object is updated based on the execution result of the target agent decision execution module based on the target memory combination, thereby realizing memory recall driven by the current task state. This ensures that the recalled memory content is highly relevant to the current task state, and solves the technical problems of low memory retrieval accuracy, poor relevance, and excessive recall information affecting the stability of agent execution in memory enhancement methods using static retrieval or unified recall in related technologies.

[0042] The working process and implementation principle of each module of the hierarchical memory management device based on task state driving in the embodiments of the present invention correspond to the hierarchical memory management method based on task state driving described in the above method embodiments. All implementation methods in the above method embodiments are applicable to the embodiments of this device and can achieve the same technical effect, so they will not be elaborated here.

[0043] This invention also provides a computer-readable storage medium storing a computer-executable program. When executed by a processor, the executable program implements the task-state-driven hierarchical memory management method described in any of the above embodiments. All the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0044] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments, and various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention. Furthermore, the embodiments of the present invention and the features thereof can be combined with each other unless otherwise specified.

Claims

1. A hierarchical memory management method based on task state-driven approach, characterized in that, include: Receive the task objective input by the user, and parse the task objective to obtain a structured description of the task; The execution process of the task objective is abstractly divided into multiple task states, and a current task state object is generated based on the structured description of the task and the current task state. Based on the current task status object, a target memory combination is obtained by performing a preset memory retrieval method in a preset hierarchical memory; The target memory combination is input into the target agent decision execution module to obtain the execution result of the current step; After updating the current task state object based on the execution result, the target memory combination is retrieved again and executed until the execution result meets the expected result of the task target.

2. The hierarchical memory management method based on task state driving according to claim 1, characterized in that, The process of abstractly dividing the task into multiple task states based on the execution of the task objective includes: Based on the execution process of the task objective, it is abstractly divided into an initialization state, a planning state, an execution state, a verification state, an error correction state, a recovery state, and a completion state. Each task state includes one or more task stages, and each task stage includes one or more steps.

3. The hierarchical memory management method based on task state driving according to claim 2, characterized in that, The process of generating a current task state object based on the task structure description and the current task state includes: An initialization state object is generated based on the task structure description, and the initialization state object is the current task state object.

4. The hierarchical memory management method based on task state driving according to claim 2 or 3, characterized in that, The preset hierarchical memory includes short-term conversation memory, task status memory, and long-term experience memory; The step of obtaining the target memory combination by performing a preset memory retrieval method in a preset hierarchical memory according to the current task state object includes: Pre-establish a mapping table between task states and memory strategies; By combining the current task state object and the task state-memory strategy mapping table, candidate memory combinations are obtained in the short-term conversation memory, the task state memory, and the long-term experience memory; The target memory combination is obtained by performing a multi-dimensional comprehensive score on the candidate memory combinations.

5. The hierarchical memory management method based on task state driving according to claim 4, characterized in that, The step of obtaining the target memory combination by performing a multi-dimensional comprehensive evaluation of the candidate memory combinations includes: Obtain one or more of the following for each candidate memory in the candidate memory combination: semantic relevance, task stage matching degree, environmental consistency, step dependency matching degree, time validity, and historical success weight; The score for each candidate memory is obtained by weighting the results according to preset weights. The target memory combination is obtained based on the score of each candidate memory and a preset threshold condition.

6. The hierarchical memory management method based on task state driving according to claim 4, characterized in that, The current task status object includes a unique task identifier, task stage, current step, pending steps, environment summary, exception information, and recovery point information. Updating the current task status object based on the execution result includes: If the execution result is successful, proceed to the next step and write the updated current task state object into the task state memory; If the execution result is a failure, an exception message is written into the task state memory, and the current task state object is updated to the task state object corresponding to the error correction state or the recovery state before the corresponding target memory combination is re-acquired.

7. The hierarchical memory management method based on task state driving according to claim 6, characterized in that, Also includes: After the task objective is achieved, the execution path will be written into the long-term experience memory.

8. The hierarchical memory management method based on task state driving according to claim 4, characterized in that, Each memory stored in the short-term session memory, the task status memory, and the long-term experience memory is assigned a unique task identifier, status tag, environment tag, time tag, and success rate tag; and the short-term session memory, the task status memory, and the long-term experience memory are managed in independent storage areas or logical partitions.

9. A hierarchical memory management device based on task state driving, characterized in that, include: The structured processing module is used to receive the task target input by the user and parse the task target to obtain a structured description of the task. The task state creation module is used to abstractly divide the execution process of the task objective into multiple task states, and generate a current task state object based on the task structure description and the current task state. The target memory combination recall module is used to obtain the target memory combination by performing a preset memory retrieval method in a preset hierarchical memory according to the current task status object; The decision execution module is used to input the target memory combination into the target agent decision execution module to obtain the execution result of the current step; The status update and result output module is used to update the current task status object according to the execution result, then re-acquire the target memory combination and execute it until the execution result meets the expected result of the task target.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an executable program, which is executed by a processor to implement the task state-driven hierarchical memory management method as described in any one of claims 1-8.