Session task planning execution method and device of agent running platform

CN122655847APending Publication Date: 2026-08-28NEZHA SMART TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611160925.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-08-28

AI Technical Summary

Technical Problem

[0004]有鉴于此,本说明书实施例提供一种智能体运行平台的会话任务规划执行方法及设备,用于解决在大语言模型执行多步复杂任务的多轮交互过程中,如何防止历史旧状态的上下文干扰(幻觉),以确保大语言模型对结构化子任务执行进度的认知与系统实际状态始终保持强一致性

Benefits of technology

1、本申请通过引入分层提示和工具约束,有效克服了传统大语言模型推理行为控制不足的问题,显著减少了未列计划即调工具的行为,大幅提升了复杂任务执行的时序合规性与运行安全性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122655847A_ABST
    Figure CN122655847A_ABST
Patent Text Reader

Abstract

The application provides a session task planning execution method and device of an agent running platform, applied to the field of artificial intelligence and computer software technology, to construct a task list by joint keys of an agent and a session, and when it is judged that a user message has a multi-step complex intention, a first-round injection plan is used to preferentially prompt constraints, the "analysis, planning, and execution" stages are forced to be cut in time sequence, the first round of the large language model is limited to output only natural language planning, and subsequent rounds are guided to call the task list management tool to write the planning into storage, thereby solving the problem that the model is easy to skip planning and directly call the tool; subsequently, through runtime dynamic interception, the historical messages are stateless filtered to remove expired old snapshots before sending the context to the model at each round, and the latest state is read from the same source to reconstruct and inject, thereby ensuring that the large model always runs autonomously based on the latest and consistent task view in long link interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence and computer software technology, specifically to a method and device for planning and executing session tasks on an intelligent agent operating platform. Background Technology

[0002] Large language model agents can perform operations such as database queries, file read / write, and invoking the ModelContextProtocol (MCP) through function calls or toolchains. When facing complex tasks requiring multi-step collaboration, such as troubleshooting, service deployment, or report writing, the common approaches currently fall into four main categories: The first type is the pure prompt word constraint (PromptConstraint): The system instructions require the large language model to "make a plan first and then execute it". However, the plan generated by this approach is not a structured list, which makes it impossible for the user interface (UI) to dynamically collapse and display it; and after multiple rounds of calls, the early plan is easily squeezed out or forgotten by the context. The second type is the External Project / Workflow System: This system persistently stores tasks in a third-party system outside the platform (such as Jira or Notion), and the agent is driven by the Orchestration Engine. However, this solution has a weak binding relationship with the current session, entity, and current dialogue, resulting in high system integration costs and making it unsuitable for the real-time interaction scenario of agents that requires "temporary disassembly within a single session and execution followed by immediate departure". The third type is general dialogue history / retrieval enhanced generation (RAG) memory: the plan is scattered in the historical messages, but this scheme is also unstructured and it is difficult to accurately manage the "complete" or "cancel" status of single-step tasks, so it is not suitable as the basis for execution gate. The fourth type is Single-Round Plan Injection: The plan is only attached to the first round of System messages. However, in deep multi-round model invocation scenarios, the MessageAIContextProvider is usually only injected in the first round, which makes it impossible for the large language model to perceive the real-time pending status of the task list in subsequent inference rounds.

[0003] Therefore, a new session task planning and execution scheme for an intelligent agent operation platform is needed. Summary of the Invention

[0004] In view of this, embodiments of this specification provide a conversation task planning and execution method and device for an intelligent agent operation platform, which is used to solve the problem of how to prevent contextual interference (illusion) of historical old states during multi-round interactions of a large language model executing multi-step complex tasks, so as to ensure that the large language model’s perception of the execution progress of structured subtasks always maintains strong consistency with the actual state of the system.

[0005] The embodiments in this specification provide the following technical solutions: This specification provides an embodiment of a session task planning and execution method for an intelligent agent operating platform, the session task planning and execution method comprising: Maintain a task list, wherein the task list uses the agent entity identifier and the session identifier as a joint key; Register at least one task list management tool with the large language model; Receive the user message for the current dialogue round and parse it to obtain the corresponding session identifier and the intelligent agent entity identifier; Determine whether the user message contains a preset multi-step working intent; If present, a plan priority hint constraint is injected into the context message set to be sent to the large language model to perform the following planning guidance operation: The large language model is constrained to generate a natural language response for task planning in the current inference round, and is restricted from initiating arbitrary tool call requests in the current inference round. The large language model is guided to initiate a call request to the task list management tool in the inference rounds following the current inference round, based on the task plan. In response to receiving a call request from the large language model for the task list management tool, the task list management tool is executed to write the multiple structured sub-tasks decomposed from the large language model into the task list list corresponding to the composite key. In the multi-turn inference interactions triggered by the large language model to execute the sub-tasks, before each time the context message set is sent to the large language model, the following task list snapshot message refresh is performed to maintain the consistency of the large language model across multiple calls: Parse the historical message set corresponding to the current interaction; A filtering mechanism is used to remove snapshot messages of the historical task list from the historical message set; the snapshot messages of the historical task list carry preset tags. Based on the union key, read the latest task status from the task list to reconstruct the latest task list snapshot message; The latest task list snapshot message is incorporated into the context message set to generate the final context message set sent to the large language model, so that the large language model can perceive the latest state of the task list in the current inference round.

[0006] Furthermore, determining whether the user message contains a multi-step working intent includes: The user message is trimmed using a gating decision algorithm; Determine whether the pruned user message meets any of the following conditions. If it does, then the user message is determined to have a multi-step working intent: There are pre-defined multi-step planning keywords, to-do keywords, or sequential logical connectives used to indicate the order of steps; There are pre-defined keywords for multi-step work intentions; The text satisfies a preset heuristic rule, which includes at least one of the following: the text length is greater than or equal to a preset length threshold, there is a text newline character, or there is an enumerated tag sequence. There are preset tool or data manipulation intent words.

[0007] Furthermore, registering at least one task list management tool with the large language model includes: When the application starts, the task list storage interface, the task list management tool provider interface, and the corresponding tool instances are registered in the dependency injection container. The tool instances include single addition tool, batch addition tool, removal tool, and status change completion tool. Instantiate the agent and check if the preset to-do list function activation flag is true; If true, then the tool instances are aggregated through the task list management tool provider interface to obtain an initial task list management tool list; The initial task list management tool list is merged and deduplicated with the business tool list configured in the agent instance to generate a target toolset for the large language model to perceive and call.

[0008] Furthermore, registering at least one task list management tool with the large language model also includes: Configure preset tool metadata for the task list management tool. The tool metadata includes a unique tool name, function description, and pattern definition for constraining the input parameter format, so that the large language model can make tool call decisions in the inference rounds. The execution of the task list management tool involves writing multiple structured sub-tasks decomposed from the large language model into the task list corresponding to the composite key, including: When the large language model initiates a tool call request according to the pattern definition, the target session identifier is extracted through the Hypertext Transfer Protocol Context Accessor interface; By using the runtime context of the server-side intelligent agent, the currently active intelligent agent instance is captured in real time, and the target intelligent agent entity identifier is extracted. Using the target session identifier and the target intelligent agent entity identifier as the target union key, the task list storage interface is driven to write the multiple structured subtask items decomposed from the large language model into the task list list, so that the target union key used in the writing phase is consistent with the union key used when reading and refreshing the task list snapshot message.

[0009] Further, the step of receiving the user message of the current dialogue round and parsing it to obtain the corresponding session identifier and the intelligent agent entity identifier includes: At runtime, an empty merge assignment mechanism is used to parse and complete the session identifier and the intelligent agent entity identifier from multiple data sources in descending order of priority. The data sources, listed in descending order of priority, include: Data items in the Hypertext Transfer Protocol request context, asynchronous local storage backup, custom tags for distributed tracking activities, session identifiers for agent sessions, and the current running context message set.

[0010] Furthermore, the constraint that the large language model generates a natural language response for task planning in the current inference round includes: A strict plan priority flag has been applied to diagnose the tool-invocation state of the current inference round.

[0011] Furthermore, the restriction that the large language model initiates arbitrary tool call requests in the current inference round includes at least one of the following control modes: If the large language model is detected to have initiated a request to call any tool in the current inference round, the request is allowed and the corresponding tool is executed, and a violation call log is generated. In the next inference round, before sending the next round of context message set to the large language model, the task list snapshot message refresh operation is triggered to reconstruct the latest task list snapshot message; the latest task list snapshot message is used to perform state overwrite on the input context of the large language model to achieve asynchronous correction. Enable the interception access control state to intercept any tool call requests initiated by the large language model in the current inference round.

[0012] Furthermore, the session task planning and execution method of the intelligent agent operation platform also includes: If the received user message for the current dialogue round is empty, then skip the injection of the plan priority hint constraint; If, when executing the task list management tool, it is detected that the current running context is missing the session identifier or the agent entity identifier, an error code indicating a missing context is returned to the large language model to prompt a retry within the current session link. If the task list management tool detects that the storage capacity of the task list has exceeded the limit or the title is invalid when executing the task list management tool, it returns the corresponding error code to the large language model to trigger the large language model to adaptively perform title optimization or step convergence optimization in the next inference round.

[0013] Further, incorporating the latest task list snapshot message into the context message set includes: Locate the index position of the last user message corresponding to the current interaction, and insert the latest task list snapshot message after the index position of the last user message.

[0014] This specification also provides a session task planning and execution device for an intelligent agent operating platform, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute: the aforementioned session task planning and execution method for an intelligent agent operating platform.

[0015] Compared with the prior art, the technical effects that can be achieved by at least one of the above-mentioned technical solutions adopted in the embodiments of this specification include at least the following: 1. By introducing hierarchical hints and tool constraints, this application effectively overcomes the problem of insufficient control over reasoning behavior in traditional large language models, significantly reduces the behavior of tools being called without a plan, and greatly improves the timing compliance and operational security of complex task execution. 2. This application refreshes the snapshot before each round of model invocation, which completely solves the problem of lack of consistency in multiple rounds, effectively avoids the risk of early plans being crowded out and forgotten by the context, and significantly reduces the occurrence of incorrect decisions made by the model based on the lagging old snapshot when the task list status has been updated; 3. This application achieves efficient task orchestration without relying on an external scheduler by constructing a session-bound structure, which solves the problem of excessive reliance on third-party systems in existing solutions and can be adapted to the single-session closed loop of the intelligent agent operation platform. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart of the planning-then-execution and tool invocation process in a specific embodiment of this application; Figure 2 This is a schematic diagram of the session task planning and execution method of the intelligent agent operation platform in a specific embodiment of this application; Figure 3 This is a schematic diagram of dual-channel pending snapshot injection in a specific embodiment of this application; Figure 4 This is a timing diagram of the pending snapshot in multiple rounds of model calls in a specific embodiment of this application; Figure 5 A schematic diagram of the structure of an electronic device in a specific embodiment of this application. Detailed Implementation

[0018] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0019] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. This application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] It should be noted that various aspects of embodiments within the scope of the appended claims are described below. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this application, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspects set forth herein can be used to implement the device and / or practice the method. Additionally, this device and / or method can be implemented using structures and / or functionalities other than one or more of the aspects set forth herein.

[0021] It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the shape, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0022] Additionally, specific details are provided in the following description to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that practice can be carried out without these specific details.

[0023] Regarding existing session task planning and execution schemes for intelligent agent operation platforms, such as the prior art submitted in the background section, through problem analysis and exploration of solutions, it was found that: On the one hand, when faced with complex user needs, large language models often skip basic analysis and planning steps and directly and blindly call some business tools (such as executing scripts, deleting system data or writing to the database), which not only makes the process uncontrollable but also brings security risks. On the other hand, in order to execute complex subtasks, it is often necessary to engage in dozens of rounds of continuous reasoning and tool calls with the runtime platform. The high-frequency iteration process and the interaction history messages cause the context window to expand rapidly. The large language model engages in reasoning and tool interactions with the platform for up to a dozen rounds. During this process, the message context expands rapidly, and the "task plan" defined by the user or drawn up by the large language model itself is quickly squeezed out of the context window. This causes the large language model to completely forget its initial goal in the latter half of the process, leading to logical confusion.

[0024] After further investigation, the inventors discovered that existing solutions cannot perceive the real-time progress of tasks. Users can only see a stateless loading graph on the front-end interface (UI), which seriously affects the human-computer interaction experience. If external project management systems such as Jira and Notion are introduced to introduce progress perception, the binding relationship is weak. Moreover, when facing lightweight interaction scenarios where tasks are spontaneously broken down within a single session and destroyed after execution, the system integration cost is too high, which cannot meet the needs of closed-loop and agile lifecycle management of intelligent agents.

[0025] Based on this, this specification proposes a session task planning and execution scheme for an intelligent agent operation platform. The overall idea is as follows: First, the platform constructs a lightweight persistent list storage using the joint key of the intelligent agent and the session. When it is determined that the user message has multiple complex intentions, it forcibly separates the "analysis, planning, and execution" stages in time by injecting a priority hint constraint in the first round. That is, it restricts the large language model to only output natural language planning in the first round and guides it to call the task list management tool in subsequent rounds to decompose the planning and write it into the storage. This solves the problem that the model can easily skip the planning and directly call the tool or output the conclusion in the traditional solution. Subsequently, to address the pain point that the context is easily lost in multi-round tool interaction, dynamic interception is performed at runtime. Before sending the context to the model in each round, the historical messages are statelessly filtered to remove expired old snapshots, and the latest state of the storage is read from the same source for reconstruction and injection. This ensures that the large language model can always run autonomously according to the latest and consistent task view in long-link interactions.

[0026] The technical solutions provided by the various embodiments of this application are described below with reference to the accompanying drawings.

[0027] like Figure 1 and Figure 2 As shown in the embodiments of this specification, a session task planning and execution method for an intelligent agent operating platform is provided, including: Maintain a task list, which uses the entity ID and the conversation ID as a joint key.

[0028] Specifically, the task list is implemented using a memory dictionary by default. Alternatively, a concurrent dictionary can be used with (entity identifier, session identifier) ​​as the composite key to maintain the task list state (TodoListState) object. The value corresponding to each key contains an ordered list and a read-write lock to ensure concurrency.

[0029] In addition, the task list can be persisted or stored at runtime using a variety of media, such as relational databases, key-value stores (e.g., Redis remote dictionary service), document libraries, or framework session storage, depending on the business scenario. This embodiment does not impose specific media restrictions, and the storage layer is decoupled from snapshot injection.

[0030] Specifically, if the data is persistently stored in a relational database, the primary key is an identifier (ID), and a composite index (entity_id, conversation_id) is built. Database fields may also include title, completion status, sort order, and update time, etc. Tools and providers still perform read and write access based on the composite key. If stored in key-value pairs, such as Redis, the key pattern is "todo:{entity}:{conversation}", and the corresponding value is a JSON array or hash structure, which is suitable for sharing session to-dos across instances; If a document database is selected, the items array is stored as a single document and per session, which facilitates coexistence with document-based session metadata of the agent platform; If in-framework session storage is selected, a to-do list is attached to the AgentSession object of the Agent Framework (such as Microsoft AgentFramework, MAF), and the AgentSessionTracker interface performs dynamic tracking during the runtime lifecycle. At this time, the Hypertext Transfer Protocol (HTTP) API interface accesses the same view in read-only mode.

[0031] During the initialization or system configuration phase, at least one task list management tool is registered with the large language model; the task list management tool has an interface encapsulation for basic management operations such as adding, deleting, modifying and querying structured task data.

[0032] When a user inputs interactive content through the terminal, the system receives the user message for the current dialogue round and parses the corresponding session identifier and the intelligent agent entity identifier from the current running context. Determine whether the user message contains a preset multi-step working intent; If present, a plan priority hint constraint is injected into the context message set to be sent to the large language model to perform the following planning guidance operation: The large language model is constrained to generate a natural language response for task planning in the current inference round, and is restricted from initiating arbitrary tool call requests in the current inference round. The large language model is guided to initiate a request to the task list management tool in the inference rounds following the current inference round, based on the task plan.

[0033] Specifically, the request injects layered skill hints, first performing intent analysis. The large language model only generates natural language, and the platform uses strict / soft hints injected by the plan-first provider to constrain behavior, without needing to deploy a separate traditional natural language processing (NLP) classifier. Next, a rule is made to predict whether to enable strict plan-first copywriting, and the large language model is strictly restricted from initiating any external tool calls during this inference round, thereby achieving phase isolation of "plan first, then execute".

[0034] To further optimize the input context length of the large language model and reduce computational resource consumption, the injection of the above-mentioned prompt constraints adopts an enhanced version of the on-demand injection rules. For example, the full text of the todo-plan-first skill is read through the load_skill command and temporarily concatenated into the current context message set, which significantly reduces the occupation of the model context window by the resident token, thereby improving the overall running efficiency and response speed of the large language model in subsequent multi-round inference.

[0035] After completing the above planning and reasoning rounds, the platform guides the large language model to initiate a call request to the registered task list management tool based on the previously generated task plan in subsequent reasoning rounds.

[0036] In response to the call request initiated by the large language model, the platform backend tool execution engine activates and executes the task list management tool, which fully writes the multiple structured sub-task items that the large language model decomposes and carries in the request parameters into the task list corresponding to the above-mentioned composite key, thus completing the persistence and structure transformation of the task.

[0037] To execute the sub-tasks sequentially or in parallel, the large language model triggers multiple rounds of inference interactions. To eliminate interference from historical messages on the large language model's logical reasoning, a task list snapshot message refresh operation is automatically performed before each transmission of the context message set to the large language model. Specifically, it parses the historical message set corresponding to the current interaction; A filtering mechanism is used to identify and remove all historical task list snapshot messages carrying preset tags from the historical message set in order to clear outdated state perceptions; Next, based on the union key, the latest task status is read from the task list, and the latest task list snapshot message is reconstructed using this status data; Finally, the latest task list snapshot message is incorporated into the context message set to generate the final context message set sent to the large language model. After receiving the latest context message set, the large language model can accurately perceive the latest status of the task list in the current inference round, thereby maintaining the consistency of the large language model in multiple rounds of invocation.

[0038] In some embodiments, to ensure that the large language model can perceive dynamic changes in the task list in real time and without bias during multi-round inference or high-frequency function call interactions, such as Figure 3 and Figure 4 As shown, a dual-channel todo snapshot injection mechanism is adopted.

[0039] Specifically, in Channel A: the current pending snapshot is formatted as a system-side context injection in the Message AI Context Provider path; Channel B: In the ChatClient Wrapper path, before each model call (including streaming), read the latest snapshot based on the current storage, remove expired snapshot messages and insert them into the current view.

[0040] It's important to note that determining whether a snapshot message is "expired" doesn't involve comparing the field-level differences between the snapshot JSON (Lightweight Data Interchange Format) and the stored data. Instead, it employs a strategy of "system message identification with conventional markers combined with full replacement in each round": any system message whose body (after trimming) begins with a conventional header marker (such as [SkillSnapshot:TodoList]) is considered a to-do snapshot carrier injected in the previous round. Before each underlying asynchronous response retrieval (GetResponseAsync) / streaming call, all such messages are filtered and deleted from the pending message list. Then, the to-do snapshot block (BuildTodoSnapshotBlock, containing structured JSON of completed / total / items, with a maximum of N incomplete items injected) is reconstructed based on the current asynchronous retrieval (GetAsync) result, and new system messages are inserted. Therefore, "expired" = old-marked messages still remaining in the message list, whose content is inevitably outdated compared to the updated storage; deletion followed by insertion ensures consistency between the current model's view and the storage.

[0041] In implementation, Channel A: When the framework executes the AIContextProvider or Message AIContextProvider chain and assembles the message list of the current round of AI context, the asynchronous message delivery method (ProvideMessagesAsync) of the TodoListSnapshotAIContextProvider is called; the returned todo snapshot is used as a ChatRole.System message and is merged into the current round of context along with the outputs of providers such as Retrieval Enhancement Generation (RAG) and Memory (usually located in the system instruction layer or provider merging segment, the specific order is determined by the provider registration order, and it is advisable for the todo snapshot provider to be located after Plan-first and before Skills providers.

[0042] Channel B: Wraps the underlying chat client interface (IChatClient); at the asynchronous response retrieval (GetResponseAsync) / asynchronous streaming response retrieval (GetStreamingResponseAsync) entry point, for the incoming chat message copy: first, it filters out messages with the to-do list snapshot-specific message flag (IsTodoListSnapshotOnlyMessage) set to true using the Where filter; then, it locates the last user message using the FindIndex; and inserts the new snapshot after that user message (or at the beginning of the list if there is no user message). This ensures that the snapshot closely follows the current user round and replaces the old block in each round.

[0043] When the framework triggers the Message AI Context Provider only in the first round of multiple function calls within a single asynchronous run (RunAsync), channel B guarantees that the second, third, and subsequent rounds will still be listed in the latest inventory.

[0044] In some embodiments, the determination of whether the user message has a multi-step working intent is implemented using a lightweight runtime gating decision mechanism, specifically: After receiving a user message, the user message is trimmed using a gating decision algorithm, such as removing leading and trailing spaces and filtering out preset meaningless auxiliary words or interjections.

[0045] Then, it is determined whether the trimmed user message meets any of the following conditions. If it does, it is determined that the user message has a multi-step working intent: Check the text for pre-defined multi-step planning keywords (such as "plan", "plan", "break down"), to-do keywords (such as "to-do", "checklist"), or sequential logical connectives used to indicate the order of steps (such as "first", "then", "next", "finally"). Check the text for pre-defined multi-step work intent keywords, such as "investigate", "repair", "deploy", "implement", etc. Determine whether the preset heuristic rules are met. The heuristic rules include at least one of the following: the text length is greater than or equal to a preset length threshold (e.g., length ≥ 80), the text contains at least one newline character, or there is an enumeration marker sequence (e.g., list symbols such as "1.", "2.", "-", "*"). Check the text for pre-defined tool or data manipulation intent words (such as "sql", "search", "interface path", etc.).

[0046] If a hit occurs, a strict block is injected (requiring intent analysis, filling the to-do list at once, and then calling non-to-do tools); if a hit occurs, a soft block is injected or the task is skipped (if the instructions already contain equivalent constraints, no further additions are made). Through the above multi-dimensional rule matching and combination verification, the system can accurately capture the user's multi-step collaborative intent at runtime with extremely low latency without the need to deploy or train a traditional natural language processing (NLP) classifier separately.

[0047] Application scenario example: The user inputs "Help me check the Assistant's Todo configuration in this repository and write a troubleshooting report." The gating hits the multistep keyword (keyword_multistep). The model first responds with "Deliverable is a troubleshooting report; constraints are read-only repository and configuration; risk is that the branch is not up-to-date"; then, todo_add_many writes steps such as "open appsettings to check TodoListEnabled", "compare with integration tests", and "summarize differences and write to the report"; then, it calls non-to-do tools such as code retrieval / file reading to execute step by step, and todo_completes after each step is completed.

[0048] In some embodiments, after the user inputs a complex task, the following process is executed: Intent analysis round: The model generates only natural language; the platform injects strict / soft cue constraints on behavior through a plan-first provider; the gating decision-maker selects strict blocks based on the last user message; Write Round: The model calls the batch add to-do list (todo_add_many) (preferred) or add to-do list multiple times (todo_add) to write 4 to 10 acceptable steps to storage; the tool returns an identifier (ID) for each item for use in the subsequent to-do list completion (todo_complete); Execution Wheel: Other tools can only be called after the initial plan is filled. "Other tools" refers to the agent's capabilities other than writing / completing / removing to-dos, such as: network retrieval, database query, HTTP call, reading and writing files in the database, executing commands, Model Context Protocol (MCP) extension, knowledge base retrieval, loading skills, etc. The to-do completion tool `todo_complete`, the to-do add tool for adding new to-dos, and the to-do remove tool for removing to-dos can still be called at any time during the execution phase to check progress or change the plan. They are not considered non-to-do execution tools that have been delayed by the gate. Response Description: When planning and guiding the reasoning behavior of a large language model, the natural language response generated by the model in the current reasoning round should employ a structured progress description instead of stateless, vague statements such as "making a plan" or "please wait while I think about it," thereby improving the readability and perceptibility of the front-end user interface. Example Sentence Structure: "N steps have been listed. Begin step 1: {step title}." "Step {k} is complete (brief result), proceed to step {k+1}." "{m} items remain in the list; currently blocked at {reason}, completed items are checked." In some embodiments, registering at least one task list management tool with the large language model includes the following steps: Dependency Injection (DI) Phase: At application startup, the to-do storage implementation (such as InMemoryTodoListStore in-memory to-do list storage), various to-do utility classes (stateless singletons inheriting from the AI ​​function base class AIFunction), and the to-do list tool provider interface (ITodoListToolsProvider) are registered to the dependency injection container; the provider's GetTools() method aggregates and returns AITool instances such as add to-do (todo_add), add to-do in batches (todo_add_many), remove to-do (todo_remove), and complete to-do (todo_complete).

[0049] It should be noted that: Single addition: The to-do addition tool calls AddAsync(asynchronous addition)(entity, session, title) and returns the new item identifier (ID), which is suitable for a small number of additions during the execution of the plan; Batch Add: The batch add tool calls AddManyAsync(asynchronous batch add)(entity, session, title array), atomically writes within the same lock, and returns a snapshot list of new items in the same order as the input; if any title is invalid or the entire batch causes the capacity or serialization limit to be exceeded, the entire batch will fail and the list will not be modified; Removal: RemoveAsync (asynchronous removal) (entity, session, id), idempotent: if the identifier does not exist, it is considered a success and no error is thrown; Completed state switching: MarkCompletedAsync(asynchronous mark completed)(entity, session, id, completed), completed defaults to true (indicating completion), can be passed as false (indicating reverting to incomplete), idempotent.

[0050] The specific process of switching to the completed state: After the tool parses the entity and session key from the current running context, it searches for the item by identifier (ID) in the to-do list of the corresponding key; if it exists, it updates its Completed field and refreshes the last access time (sliding time to live, TTL, TimeToLive) of the key; if it does not exist, it directly returns success (idempotent) without throwing an error to the model, thus avoiding repeated selections that could interrupt the process.

[0051] The relationship between single-item addition and batch addition: Logically, both are written to the same to-do list storage interface (ITodoListStore) and the list under the same session key; the batch path uses AddManyCore (the core batch addition method) in the storage layer to lock, pre-validate all titles (non-empty, length limit such as 128 characters), and verify the maximum number of session entries (such as 50 entries) and the maximum serialization size (such as 256KB) before inserting them in batches; the single-item path calls the same core single-element batch interface. At the utility layer, there are two independently registered functions (with different names and parameter patterns defining the schema: single-item uses the title string, batch uses the titles string array with a single batch limit such as 20 entries), allowing the model to choose between "filling the initial plan at once" and "adding one during execution," with consistent storage and key resolution paths.

[0052] Agent assembly phase: When the agent library configuration item TodoListEnabled is true, when creating the internal chat client agent (ChatClientAgent), the above list of tools is appended to the toolset of the chat options (Tools) (merged with tools from other tool providers in the configuration driver, which are resolved by name:version from the registry, and deduplicated by tool name).

[0053] Tool metadata: Each tool exposes a unique name, description, and JSON schema definition for selection by the large model in inference rounds. When a tool is executed, it resolves the session key using the HTTP context accessor interface (IHttpContextAccessor) and the current running context (AIAgent.CurrentRunContext), and then calls the to-do list storage interface (ITodoListStore) to ensure consistency with the snapshot read key.

[0054] Optional parallel solution: The platform can also mount the framework's built-in TodoProvider to expose naming tools such as TodoList_Add / TodoList_Complete to the model, and link with the session tracker interface (IAgentSessionTracker) for the agent's user interface to query; the claims of this invention do not limit the naming of the tools, the core is "todo-type tools and storage writing bound to the session key".

[0055] In some embodiments, in order to ensure that session identifiers and agent entity identifiers can be accurately obtained under various different call triggering sources, the platform adopts a highly fault-tolerant empty merge assignment mechanism.

[0056] During runtime, the session identifier and the agent entity identifier are parsed and completed sequentially from multiple potential data sources in descending order of priority. The data sources, in descending order of priority, include: data items in the Hypertext Transfer Protocol request context, asynchronous local storage backups, custom tags for distributed tracking activities, session identifiers for agent sessions, and the current running context message set.

[0057] Specifically, the tool call chain and snapshot injection share the to-do snapshot session key resolution method (TodoSnapshotConversationKeys.TryResolve). On the tool side, the to-do tool runs the context resolution method TodoToolRunContext.Resolve to execute equivalent logic. The multi-level completion process is as follows: HTTP Middleware: At the POST / {agentKey} / v1 / chat / completions entry point, it parses the session identifier (conversation_id) in the request body metadata and writes the entity identifier, i.e., the smart agent library key (entityId), and the session identifier (conversationId) into the fixed key of the HTTP context data item (HttpContext.Items); Asynchronous Local Storage (AsyncLocal) Backup: When the target tool executes in an asynchronous continuation, causing HttpContext.Items to be lost or not fully carrying identification data, the TodoRequestKeysAccessor (based on AsyncLocal asynchronous local storage) set by the request entry provides entity / session backup values. Activity tracing: Attach custom tags (such as todo.entity_id, todo.conversation_id) to the current activity (Activity.Current) in distributed tracing. When the target identifier is missing from both the above HTTP context data items and asynchronous local storage, the tool and wrapper read the corresponding identifier data from the tag. ChatClientAgentSession: Reads the session ID from the session of the InvokingContext or the session of the current running context (AIAgent.CurrentRunContext) of the message AI context provider; completes the entity ID from the agent name of the InvokingContext (InvokingContext.Agent.Name) or the agent name of the current running context (CurrentRunContext.Agent.Name), and ensures that the entity ID shown is consistent with the key of the AgentLibrary; The above sources are merged using the empty merge assignment operator (??=) that "if it has been parsed, it will not be overwritten", ensuring that adding to-do items (todo_add) and asynchronous fetching (GetAsync) in a concurrent environment are always based on the same set of fully aligned entity ID and session ID (EntityID, ConversationID) composite keys for secure read and write operations.

[0058] In some embodiments, during the execution of planning guidance operations, in order to monitor and audit the execution state of the large language model throughout its entire lifecycle, the platform, while constraining the large language model to generate only natural language responses in the current inference round, will enable a "StrictPlanFirstApplied" flag in the current session state. This flag is used to diagnose and record the tool-free state of the current inference round for use in subsequent audit logs and state machine transitions.

[0059] In some embodiments, if the model still initiates a non-pending tool call, it is executed by the framework's regular model-tool loop, and the platform can correct the error through logs and subsequent round snapshots; or the runtime gate can block the non-pending tool.

[0060] In some embodiments, the method further includes a complete set of boundary anomaly handling and adaptive optimization verification mechanisms.

[0061] Specifically, during runtime, if the gating decision-maker detects that the user message received in the current dialogue round is empty (e.g., the user accidentally sent it or the front-end parameter passing is abnormal), it will directly return the no query status code, and the system will directly skip the plan priority hint constraint (i.e., not inject strict hint blocks) during runtime to avoid introducing meaningless contextual noise into the large language model; If the large language model initiates a tool call and writes to the storage layer, but the entity / session key is missing, the to-do tool returns a structured error code (MISSING_CONTEXT) indicating that it should retry within the same session link. To ensure storage performance, boundary limit rules are also set, including: when the storage capacity / title is invalid, return "Capacity Exceeded (CAPACITY_EXCEEDED)" / "Title Invalid (INVALID_TITLE)", and the model can shorten the title or retry after convergence.

[0062] Specifically, the maximum number of pending items per session (e.g., 50 items), the maximum title length (e.g., 128 characters), the maximum number of new items added in a single batch (e.g., 20 items), and the sliding expiration of the storage time to live (TTL).

[0063] In some embodiments, the model proactively initiates a function call to add many to-dos (or an equivalent to-do tool) in the following inference step; after the host executes the tool and updates the storage, it appends the tool result message to the dialogue history and triggers channel B to refresh the snapshot before the next round of model calls.

[0064] In some embodiments, the session task planning and execution method of the intelligent agent operation platform further includes: external query and display.

[0065] Specifically, it provides an HTTP API for querying the to-do list by entity and session, which is displayed on the agent user interface's to-do panel. It shares the same source as the model-side snapshot (the same to-do list storage interface ITodoListStore), allowing the user interface to view the progress of to-dos in real time. The list items can be accepted and managed in a completed state, solving the problem of poor user visibility.

[0066] Based on the same inventive concept, here is a structural schematic diagram of a session task planning and execution device for an intelligent agent operating platform. Figure 5 The structure of the electronic device 500 is shown in the figure. The electronic device 500 is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0067] The electronic device 500 may include: at least one processor 510; and a memory 520 communicatively connected to the at least one processor; wherein the memory 520 stores instructions executable by the at least one processor 510, the instructions being executed by the at least one processor 510 to enable the at least one processor 510 to execute: the session task planning and execution method of the intelligent agent operation platform according to any embodiment of this application.

[0068] It should be noted that the electronic device 500 can be represented in the form of a general-purpose computing device, such as a server device.

[0069] In practice, the components of electronic device 500 may include, but are not limited to: at least one processor 510, at least one memory 520, and a bus 530 connecting different system components (including memory 520 and processor 510), wherein bus 530 may include a data bus, an address bus, and a control bus.

[0070] In implementation, memory 520 may include volatile memory, such as random access memory (RAM) 5201 and / or cache memory 5202, and may further include read-only memory (ROM) 5203.

[0071] The memory 520 may also include a program tool 5205 having a set (at least one) of program modules 5204, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0072] The processor 510 performs various functional applications and data processing by running computer programs stored in the memory 520.

[0073] Electronic device 500 can also communicate with one or more external devices 540 (e.g., keyboard, pointing device, etc.). This communication can be performed through input / output (I / O) interface 550. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public network, such as the Internet) via network adapter 560, which communicates with other modules in electronic device 500 via bus 530. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.

[0074] In this specification, the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the descriptions of the embodiments described later are relatively simple, and relevant parts can be referred to the descriptions of the foregoing embodiments.

[0075] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for planning and executing session tasks in an intelligent agent operating platform, characterized in that, The session task planning and execution method includes: Maintain a task list, wherein the task list uses the agent entity identifier and the session identifier as a joint key; Register at least one task list management tool with the large language model; Receive the user message for the current dialogue round and parse it to obtain the corresponding session identifier and the intelligent agent entity identifier; Determine whether the user message contains a preset multi-step working intent; If present, a plan priority hint constraint is injected into the context message set to be sent to the large language model to perform the following planning guidance operation: The large language model is constrained to generate a natural language response for task planning in the current inference round, and is restricted from initiating arbitrary tool call requests in the current inference round. The large language model is guided to initiate a call request to the task list management tool in the inference rounds following the current inference round, based on the task plan. In response to receiving a call request from the large language model for the task list management tool, the task list management tool is executed to write the multiple structured sub-tasks decomposed from the large language model into the task list list corresponding to the composite key. In the multi-turn inference interactions triggered by the large language model to execute the sub-tasks, before each time the context message set is sent to the large language model, the following task list snapshot message refresh is performed to maintain the consistency of the large language model across multiple calls: Parse the historical message set corresponding to the current interaction; A filtering mechanism is used to remove snapshot messages of the historical task list from the historical message set; the snapshot messages of the historical task list carry preset tags. Based on the union key, read the latest task status from the task list to reconstruct the latest task list snapshot message; The latest task list snapshot message is incorporated into the context message set to generate the final context message set sent to the large language model, so that the large language model can perceive the latest state of the task list in the current inference round.

2. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The determination of whether the user message contains a multi-step working intent includes: The user message is trimmed using a gating decision algorithm; Determine whether the pruned user message meets any of the following conditions. If it does, then the user message is determined to have a multi-step working intent: There are pre-defined multi-step planning keywords, to-do keywords, or sequential logical connectives used to indicate the order of steps; There are pre-defined keywords for multi-step work intentions; The text satisfies a preset heuristic rule, which includes at least one of the following: the text length is greater than or equal to a preset length threshold, there is a text newline character, or there is an enumerated tag sequence. There are preset tool or data manipulation intent words.

3. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The method of registering at least one task list management tool with the large language model includes: When the application starts, the task list storage interface, the task list management tool provider interface, and the corresponding tool instances are registered in the dependency injection container. The tool instances include single addition tool, batch addition tool, removal tool, and status change completion tool. Instantiate the agent and check if the preset to-do list function activation flag is true; If true, then the tool instances are aggregated through the task list management tool provider interface to obtain an initial task list management tool list; The initial task list management tool list is merged and deduplicated with the business tool list configured in the agent instance to generate a target toolset for the large language model to perceive and call.

4. The session task planning and execution method of the intelligent agent operation platform according to claim 3, characterized in that, The method of registering at least one task list management tool with the large language model also includes: Configure preset tool metadata for the task list management tool. The tool metadata includes a unique tool name, function description, and pattern definition for constraining the input parameter format, so that the large language model can make tool call decisions in the inference rounds. The execution of the task list management tool involves writing multiple structured sub-tasks decomposed from the large language model into the task list corresponding to the composite key, including: When the large language model initiates a tool call request according to the pattern definition, the target session identifier is extracted through the Hypertext Transfer Protocol Context Accessor interface; By using the runtime context of the server-side intelligent agent, the currently active intelligent agent instance is captured in real time, and the target intelligent agent entity identifier is extracted. Using the target session identifier and the target intelligent agent entity identifier as the target union key, the task list storage interface is driven to write the multiple structured subtask items decomposed from the large language model into the task list list, so that the target union key used in the writing phase is consistent with the union key used when reading and refreshing the task list snapshot message.

5. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The step of receiving the user message of the current dialogue round and parsing it to obtain the corresponding session identifier and the intelligent agent entity identifier includes: At runtime, an empty merge assignment mechanism is used to parse and complete the session identifier and the intelligent agent entity identifier from multiple data sources in descending order of priority. The data sources, listed in descending order of priority, include: Data items in the Hypertext Transfer Protocol request context, asynchronous local storage backup, custom tags for distributed tracking activities, session identifiers for agent sessions, and the current running context message set.

6. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The constraint that the large language model generates a natural language response for task planning in the current inference round includes: A strict plan priority flag has been applied to diagnose the tool-invocation state of the current inference round.

7. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The restriction that the large language model can initiate arbitrary tool calls in the current inference round includes at least one of the following control modes: If the large language model is detected to have initiated a request to call any tool in the current inference round, the request is allowed and the corresponding tool is executed, and a violation call log is generated. In the next inference round, before sending the next round of context message set to the large language model, the task list snapshot message refresh operation is triggered to reconstruct the latest task list snapshot message; The latest task list snapshot message is used to overwrite the state of the input context of the large language model in order to achieve asynchronous correction. Enable the interception access control state to intercept any tool call requests initiated by the large language model in the current inference round.

8. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The session task planning and execution method of the intelligent agent operation platform also includes: If the received user message for the current dialogue round is empty, then skip the injection of the plan priority hint constraint; If, when executing the task list management tool, it is detected that the current running context is missing the session identifier or the agent entity identifier, an error code indicating a missing context is returned to the large language model to prompt a retry within the current session link. If the task list management tool detects that the storage capacity of the task list has exceeded the limit or the title is invalid when executing the task list management tool, it returns the corresponding error code to the large language model to trigger the large language model to adaptively perform title optimization or step convergence optimization in the next inference round.

9. The session task planning and execution method of the intelligent agent operation platform according to claim 1, characterized in that, The step of incorporating the latest task list snapshot message into the context message set includes: Locate the index position of the last user message corresponding to the current interaction, and insert the latest task list snapshot message after the index position of the last user message.

10. A session task planning and execution device for an intelligent agent operation platform, characterized in that, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute: the session task planning and execution method of the intelligent agent operating platform as described in any one of claims 1-9.