Intelligent agent context management system and equipment based on importance sampling

Through the global context manager, task stack manager, recursive execution engine, importance sampler and context compressor, the context information maintenance and collaboration problems of intelligent agent systems in complex scenarios are solved, and the system performance and task processing efficiency are improved.

CN120803622APending Publication Date: 2025-10-17GUANGZHOU LINGWHALE TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510949395.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

When faced with complex scenarios of multi-step collaboration and multi-dimensional information integration, existing intelligent agent systems have problems such as imperfect context information maintenance, imperfect sub-agent collaboration mechanisms, and information accumulation caused by serial processing. They lack effective information compression and optimization strategies, resulting in degraded system performance.

Method used

It adopts a global context manager, task stack manager, recursive execution engine, importance sampler and context compressor, manages eight categories of context information through a classified storage structure, realizes task splitting, recursive execution, importance sampling and compression, coordinates the workflow of each component, and optimizes resource allocation in combination with the task scheduler.

Benefits of technology

It improves the overall performance and task processing capabilities of the intelligent system in complex scenarios, improves the problems of insufficient context information management and selection relevance, alleviates information overload, controls the recursion depth, and optimizes resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803622A_ABST
    Figure CN120803622A_ABST
Patent Text Reader

Abstract

The invention discloses an agent context management system and device based on importance sampling, and belongs to the technical field of artificial intelligence and agents, the agent context management system and device based on importance sampling comprise a global context manager used for maintaining and managing eight types of context information; the task stack manager is used for receiving a new request and performing task splitting; and the recursive execution engine is used for executing the task in a recursive mode and controlling the recursive depth. Eight types of context information are maintained through a global context manager, splitting and storage of complex tasks are achieved through a task stack manager, a recursive execution engine provides an efficient task execution mechanism and controls the recursive depth, an importance sampler selects related contexts based on a joint probability model, and the task execution efficiency is improved. And the context compressor combines the sampling fragments into a final context, and the task scheduler coordinates the working process of each component, so that a complete agent collaborative context management system is constructed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of artificial intelligence and agent technology, and specifically relates to an agent context management system and device based on importance sampling. BACKGROUND

[0002] The continuous development of artificial intelligence technology has promoted the wide application of agent systems in multiple application fields. Agent systems can handle various complex intelligent tasks by simulating human cognitive processes, including environmental perception, information processing, decision reasoning, and behavior execution.

[0003] Existing agent architecture design is mainly based on a single task processing mode, and when facing complex scenarios that require multi-step cooperation and multi-dimensional information integration, it often shows obvious limitations. In particular, in terms of task decomposition strategy and context information maintenance, existing systems are difficult to achieve effective coordination management and resource optimization.

[0004] In actual deployment and application processes, the agent management system often encounters technical problems such as incomplete information transmission, low execution efficiency, and unbalanced resource allocation. For application scenarios that require continuous memory retention and deep logical reasoning, the comprehensive performance of existing systems often cannot achieve the expected results.

[0005] The progress of large language models and deep learning technology has brought stronger semantic understanding and generation capabilities to agent systems. However, in terms of global context information maintenance, complex task structured decomposition, and recursive execution mechanism optimization, agent management systems still face important technical bottlenecks.

[0006] In the current agent collaboration framework, a planner is usually used to decompose tasks, and then subtasks are assigned to multiple sub-agents for parallel processing. Although this parallel architecture can improve processing speed, it can cause serious context information inconsistency problems. Different sub-agents may have differences in task understanding and processing methods, making it difficult to effectively integrate the final results.

[0007] Taking enterprise-level software development as an example, a sub-agent responsible for data layer design may choose a relational database solution, while a sub-agent responsible for user interface development may use a NoSQL database interface design. This mismatch in technical architecture can seriously affect the overall stability and user experience of the system.

[0008] In order to solve the above collaboration problems, the industry has tried to pass the original instruction information to each sub-agent, hoping to provide more unified guidance information. Although this method improves information sharing to some extent, the depth and breadth of sharing are still limited, and it cannot completely solve the context consistency problem.

[0009] With the increasing complexity of agent systems, the industry has proposed a development idea of changing from instruction engineering to context engineering. Context engineering not only transmits the original instructions, but also includes the complete context information such as the input query, interaction history, reasoning process and execution record of the planner, providing more comprehensive information support for sub-agents.

[0010] However, the context engineering method still has limitations and cannot completely solve the information consistency problem. Therefore, the industry further proposes a serial processing mode, that is, sub-agents execute tasks in a specific order. The output results of the previous agent are transmitted as context information to the subsequent agent, ensuring the continuity and consistency of information transmission.

[0011] Although the serial processing mode can ensure information consistency, with the increase in the number of agents, context information will continue to accumulate, causing the model to be unable to effectively process excessively long input sequences. When the context length exceeds the processing upper limit of the model, the system performance will decrease sharply, and even processing exceptions may occur.

[0012] In view of the challenge of context information overload, the industry proposes a technical solution of using a lightweight model for information compression. Through information entropy analysis and importance evaluation algorithm, the context information is intelligently compressed and prioritized, reducing the data volume while retaining the core information, and ensuring that the model can be normally processed.

[0013] In summary, the main technical challenges faced by existing agent management systems in processing complex tasks include imperfect context information maintenance, imperfect sub-agent cooperation mechanism, information accumulation problem caused by serial processing, and lack of effective information compression and optimization strategies. These technical bottlenecks seriously limit the actual effect and performance of the agent system in complex application scenarios. SUMMARY

[0014] The technical problem to be solved by the present application is to overcome the shortcomings of the prior art and provide an agent context management system and device based on importance sampling.

[0015] The technical solution adopted to solve the above technical problems is: including a global context manager for maintaining and managing eight categories of context information; a task stack manager for receiving new requests and performing task splitting; a recursive execution engine for executing tasks in a recursive manner and controlling the recursion depth; an importance sampler for performing context importance sampling based on a joint probability model; a context compressor for combining the sampled fragments into the final context; and a task scheduler for coordinating the workflow of each component.

[0016] Further, the global context manager includes a target information management unit, a user input management unit, a historical dialogue management unit, an intermediate state management unit, an external memory management unit, an environment configuration management unit, a metadata management unit, and an agent collaborative context management unit. The manager adopts a classified storage structure and is organized and stored according to eight categories of context information, including a target information storage area, a user input storage area, a historical dialogue storage area, an intermediate state storage area, an external memory storage area, an environment configuration storage area, a metadata storage area, and an agent collaborative context storage area, for storing eight categories of context information of the agent system.

[0017] Further, the target information management unit is used for maintaining and managing main task descriptions and target setting information, supporting multi-level target decomposition and target priority sorting. The user input management unit is used for processing and managing specific request information of the user, and has input preprocessing and intent recognition functions. The historical dialogue management unit is used for storing and managing multi-round dialogue records of the user and the agent, and adopts a dialogue tree structure to store dialogue history.

[0018] Further, the intermediate state management unit is used for tracking task execution logs, progress states, and variable tables, supporting state snapshot and state rollback functions. The external memory management unit is used for managing retrieved documents, rules, and sample information, and integrates RAG (Retrieval-Augmented Generation) technology. The environment configuration management unit is used for maintaining environment settings, boundary conditions, and constraint conditions, and supports dynamic environment setting updates.

[0019] Further, the metadata management unit is used for managing metadata such as timestamps, authors, and priorities, and provides context tracing and version control functions. The agent collaborative context management unit is used for managing subtask allocation and inter-agent communication content, and supports multi-agent collaboration state tracking. The task stack manager includes a task receiving unit, a task analysis unit, a task splitting unit, a stack management unit, and a task dependency unit. The task receiving unit is used for receiving new task requests input by the user, and supports multiple input formats, including text, voice, and structured data. The task analysis unit analyzes task characteristics through natural language processing (NLP) and machine learning (ML) algorithms, and identifies task types; The task splitting unit splits a complex task into a plurality of atomic sub-tasks according to a task dependency graph and a complexity evaluation, each sub-task containing task description, priority, dependency relationship and execution parameter information. The stack management unit adopts a first-in first-out (FIFO, First In First Out) and last-in first-out (LIFO, Last In First Out) strategy to manage the execution order of the tasks, supporting priority queue and dynamic task scheduling. The task dependency unit adopts a directed acyclic graph (DAG, Directed Acyclic Graph) to manage the task dependency relationship, ensuring the coordination consistency between sub-agents.

[0020] Further, the recursive execution engine includes a recursion controller, a task executor, a state checker, a recursion limiting unit, an exception processor and a result aggregation unit. The recursion controller sets a maximum recursion level limit to prevent infinite recursion, controls the depth and flow of recursive execution, and supports both depth-first and breadth-first recursion strategies; The task executor supports both synchronous and asynchronous execution modes for executing specific task logic. The state checker monitors memory usage, execution time and recursion depth in real time, and monitors the recursion execution state and resource usage. The recursion limiting unit adopts a dynamic threshold adjustment and adaptive limiting mechanism to ensure the safety of recursive execution; The exception processor includes timeout processing, resource exhaustion processing, deadlock detection and loop detection mechanisms for handling exceptions during recursive execution. The result aggregation unit supports both incremental aggregation and full aggregation modes for aggregating intermediate results of recursive execution; The importance sampler includes a joint probability calculation unit, a candidate context generation unit, an importance scoring unit, a Top-K (Top-K Selection, Top-K Selection) selection unit and a sampling quality control unit. The joint probability calculation unit uses Bayesian networks and Markov chain models to calculate the joint probability distribution of historical records, memories, agent states, collaboration logs and meta-information; The candidate context generation unit is used to generate candidate context fragments from multiple sources, supporting semantic retrieval, keyword matching and similarity calculation. The importance scoring unit uses attention mechanisms and neural networks to score the importance of candidate contexts based on joint probability models; The Top-K (Top-K Selection, Top-K Selection) selection unit uses heap sorting and quick selection algorithms to select the top K context fragments with the highest importance scores for efficient selection. The sampling quality control unit ensures the quality and diversity of the sampled contexts by setting a correlation threshold and diversity constraint.

[0021] Further, the core algorithm of the importance sampler is based on joint probability distribution modeling, which includes the following steps: Step one: Context information collection and preprocessing Eight categories of context information are collected from the global context manager: target information, user input, historical dialogue, intermediate state, external memory, environment configuration, metadata, and agent coordination context. Each category of information is preprocessed to extract key feature vectors and form a candidate context segment set where each segment contains a type label, a timestamp, a content vector, and metadata information; Step two: Multi-factor scoring function calculation Four scoring factors are calculated for each context segment Relevance score: where is the current task query, is the semantic embedding function; Time weight: where is the difference between the segment creation time and the current time, is the time decay parameter; Priority score: where is the type weight of the eight categories of information, is the preset importance score; Redundancy penalty: where is the redundancy calculation based on semantic similarity; Step three: Recursive execution state-aware modeling Considering the current state of the recursive execution engine, including the recursion depth , execution path , and resource usage , a conditional probability model is established: where , , are the adjustment functions of recursion depth, execution path, and resource state, respectively, is the coordination score based on the agent coordination state; Step four: Joint modeling of agent coordination context Considering the subtask allocation and coordination state in the agent coordination context, a joint probability distribution is constructed: where represents the agent coordination state, and the energy function is: where ​is the relevance weight, which controls the influence of the relevance of the context fragment to the current task query on the importance score. is the time weight, which controls the influence of the temporal freshness of the context segment on the importance score. is the priority weight, which controls the influence of the preset priority of the context segment on the importance score. is the redundancy penalty weight, which controls the degree of influence of information redundancy on importance score. Adjust the weight for recursive depth and control the influence of recursive execution depth on context selection. Adjust the weight of the execution path to control the influence of the task execution path on the context selection. Adjust the weight for resource status and control the influence of system resource usage on context selection. The collaborative scoring weight controls the influence of the collaborative state of the agent on the context selection; Step 5: Task stack-aware importance distribution construction Based on the current state of the task stack manager, including task dependencies, priority queues, and execution history, a task-aware importance distribution is constructed: in, is the task stack status, For task relevance-based scoring; Step 6: Importance sampling with context length constraint. Importance sampling is performed under the length constraint of the context compressor. Sample M candidate vectors , calculate the importance weight for each sample vector: in is the length penalty function, is the maximum context length limit; Step 7: Optimal subset selection for multi-objective optimization Based on importance weights and context quality evaluation, the optimal context subset is selected under the coordination of the task scheduler: in is the context quality evaluation function, which comprehensively considers the integrity, relevance and diversity of eight categories of information. To evaluate the efficiency of the function, we consider computational complexity, storage overhead, and transmission cost.

[0022] Further, the context compressor includes a context analysis unit, a compression strategy unit, a fragment combination unit, a length control unit, and a quality evaluation unit. The context analysis unit uses a combination of semantic analysis and structural analysis to analyze the structure and content of the sampled context fragments; The compression strategy unit is used to develop context compression strategies and algorithm selection, supporting various strategies such as summary compression, keyword extraction, and semantic compression. The fragment combination unit uses attention mechanism and weighted fusion for intelligent combination, intelligently combining the selected context fragments; The length control unit uses dynamic truncation and adaptive compression mechanism to ensure that the final context does not exceed the preset length limit. The quality evaluation unit evaluates the quality and integrity of the compressed context through integrity, relevance, and consistency indicators; The task scheduler includes a workflow coordination unit, a resource allocation unit, a load balancing unit, a performance optimization unit, and a monitoring feedback unit. The workflow coordination unit uses state machines and workflow engines to manage the process, coordinating the workflow and timing relationship of each component; The resource allocation unit dynamically allocates computing resources and storage resources according to task priority and resource demand. The load balancing unit achieves load balancing through task migration and resource reallocation, supporting multi-node deployment and distributed processing; The performance optimization unit includes cache optimization, parallel processing, and algorithm optimization, which is used to optimize the overall performance and processing efficiency of the system. The monitoring feedback unit provides real-time monitoring, alarm, and performance analysis functions, monitoring system status and providing feedback information.

[0023] Further, the system also includes a user interface module, a data storage module, a security control module, and an extension interface module. The user interface module supports multiple interaction methods, including text input, voice input, and graphical interface, for receiving user input and displaying system output; The data storage module uses a distributed storage architecture, supports data backup and recovery, and is used for persistent storage of system data and configuration information. The security control module includes identity authentication, permission control, and data encryption functions to ensure system security and data privacy protection; The extension interface module provides standardized API (Application Programming Interface) interfaces and plug-in development frameworks to support third-party plug-ins and functional extensions.

[0024] Further, it includes a processor; and a memory for storing computer executable instructions; a computer program stored in the memory and executed by the processor, when the computer program is executed by the processor, any method of the intelligent agent context management system based on importance sampling in any of claims 1-8 is implemented. The computer readable storage medium stores a computer program of an importance sampling based agent context management system and device.

[0025] The beneficial effects of the present application are as follows: (1) the present application maintains eight categories of context information through a global context manager, a task stack manager realizes the splitting and storage of complex tasks, a recursive execution engine provides an efficient task execution mechanism and controls the recursion depth, an importance sampler selects relevant contexts based on a joint probability model, a context compressor combines the sampled fragments into the final context, and a task scheduler coordinates the work processes of various components, thereby constructing a complete agent collaborative context management system; (2) the global context management mechanism of the present application helps to maintain the integrity and consistency of the eight categories of context information, realizes the reasonable splitting and ordered execution of complex tasks through the task stack management, improves the flexibility and efficiency of task processing and prevents infinite recursion through the recursive execution engine, realizes intelligent context selection in combination with the importance sampler, ensures that the context information does not exceed the preset limit through the context compressor, and realizes the optimal allocation of system resources through the task scheduler, so that the present application helps to solve the context limitation problem and improve the overall performance and task processing capacity of the agent system; (3) the present application helps to improve the problem of insufficient context information management through the management of eight categories of context information, helps to improve the relevance problem of context selection through the importance sampling mechanism, helps to alleviate the context information overload problem through the intelligent compression algorithm, and helps to improve the depth control problem of task execution through the recursive execution control, thereby providing a new solution for the key problems such as context limitation and coordination difficulty between sub-agents in the traditional agent system. BRIEF DESCRIPTION OF DRAWINGS

[0026] Figure 1 is a flowchart of the importance sampling algorithm of the present application; Figure 2 is a schematic diagram of the agent management system architecture of the present application; Figure 3 is a flowchart of the agent management method of the present application; Figure 4 is a structural schematic diagram of the global context manager of the present application; Figure 5 is a schematic diagram of the computing device of the present application. DETAILED DESCRIPTION

[0027] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application.

[0028] As Figure 1 shown, the embodiment of the agent context management system and device based on importance sampling, the core algorithm of importance sampler is based on joint probability distribution modeling, specifically including the following steps: Step one: context information collection and preprocessing Collect eight categories of context information from the global context manager: target information, user input, historical dialogue, intermediate state, external memory, environment configuration, metadata and agent collaborative context. Preprocess each category of information, extract key feature vectors, and form a candidate context segment set Each segment contains type label, timestamp, content vector and metadata information; Step two: multi-factor scoring function calculation Combine the task information in the current task stack to calculate four scoring factors for each context segment Relevance score: Where is the current task query, is the semantic embedding function; Time weight: Where is the difference between the segment creation time and the current time, is the time decay parameter; Priority score: Where is the type weight of the eight categories of information, is the preset importance score; Redundancy penalty: Where is the redundancy calculation based on semantic similarity; Step three: recursive state-aware modeling Considering the current state of the recursive execution engine, including the recursion depth , execution path and resource usage , establish a conditional probability model: Where , , are the adjustment functions of recursion depth, execution path and resource state respectively, is the collaborative score based on the agent collaboration state; Step four: joint modeling of agent collaborative context Considering the subtask allocation and collaboration state in the agent collaborative context, construct the joint probability distribution: Where ​The agent cooperation state is represented, and the energy function is: wherein is a relevance weight, controlling the influence degree of the relevance between the context segment and the current task query on the importance score, is a time weight, controlling the influence degree of the time freshness of the context segment on the importance score, is a priority weight, controlling the influence degree of the preset priority of the context segment on the importance score, is a redundancy penalty weight, controlling the influence degree of avoiding information redundancy on the importance score, is a recursion depth adjustment weight, controlling the influence degree of the recursion execution depth on the context selection, is an execution path adjustment weight, controlling the influence degree of the task execution path on the context selection, is a resource state adjustment weight, controlling the influence degree of the system resource usage on the context selection, is a cooperation score weight, controlling the influence degree of the agent cooperation state on the context selection; Step five: task stack-aware importance distribution construction. According to the current state of the task stack manager, including task dependency relationship, priority queue and execution history, the task-aware importance distribution is constructed: wherein is the task stack state, is the score based on task relevance; Step six: importance sampling under context length constraint. Importance sampling is performed under the length limit of the context compressor, and M candidate vectors are sampled from the importance distribution The importance weight of each sampling vector is calculated: wherein is a length penalty function, is a maximum context length limit; Step seven: optimal subset selection based on multi-objective optimization. Based on the importance weight and the context quality evaluation, the optimal context subset is selected under the coordination of the task scheduler: wherein is a context quality evaluation function, considering the integrity, relevance and diversity of the eight categories of information, is an efficiency evaluation function, considering the computational complexity, storage overhead and transmission cost.

[0029] ​The context compressor includes a context analysis unit, a compression strategy unit, a fragment combination unit, a length control unit, and a quality evaluation unit. The context analysis unit uses a combination of semantic analysis and structural analysis to analyze the structure and content of the sampled context fragments.

[0030] The compression strategy unit is used to develop context compression strategies and algorithm selection, supporting various strategies such as summary compression, keyword extraction, and semantic compression. The fragment combination unit uses attention mechanisms and weighted fusion for intelligent combination, intelligently combining selected context fragments.

[0031] The length control unit uses dynamic truncation and adaptive compression mechanisms to ensure that the final context does not exceed the pre-set length limit. The quality evaluation unit evaluates the quality and integrity of the compressed context through integrity, relevance, and consistency indicators.

[0032] The task scheduler includes a workflow coordination unit, a resource allocation unit, a load balancing unit, a performance optimization unit, and a monitoring feedback unit. The workflow coordination unit uses state machines and workflow engines to manage processes, coordinating the workflow and timing relationship of each component.

[0033] The resource allocation unit dynamically allocates computing resources and storage resources based on task priority and resource requirements. The load balancing unit achieves load balancing through task migration and resource reallocation, supporting multi-node deployment and distributed processing.

[0034] The performance optimization unit includes cache optimization, parallel processing, and algorithm optimization, used to optimize the overall performance and processing efficiency of the system. The monitoring feedback unit provides real-time monitoring, alarm, and performance analysis functions, monitoring system status and providing feedback information, coordinating the workflow of the global context manager, task stack manager, recursive execution engine, importance sampler, and context compressor.

[0035] The system also includes a user interface module, a data storage module, a security control module, and an extension interface module. The user interface module supports multiple interaction methods, including text input, voice input, and graphical interface, for receiving user input and displaying system output.

[0036] The data storage module uses a distributed storage architecture, supporting data backup and recovery, for persistent storage of system data and configuration information. The security control module includes identity authentication, permission control, and data encryption functions, used to ensure system security and data privacy protection.

[0037] The extension interface module provides standardized API (Application Programming Interface) interfaces and plug-in development frameworks, supporting third-party plug-ins and functional extensions.

[0038] As shown in Figure 2 An agent context management system based on importance sampling includes a global context manager for maintaining and managing eight categories of context information; a task stack manager for receiving new requests and task splitting; a recursive execution engine for recursively executing tasks and controlling the recursion depth; an importance sampler for context importance sampling based on a joint probability model; a context compressor for combining the sampled segments into the final context; a task scheduler for coordinating the workflow of each component.

[0039] The global context manager includes: a target information management unit for maintaining and managing main task descriptions and target setting information; a user input management unit for processing and managing specific request information of users; a historical dialogue management unit for storing and managing multi-round dialogue records of users and agents; an intermediate state management unit for tracking task execution logs, progress states and variable tables; an external memory management unit for managing retrieved documents, rules and example information; an environment configuration management unit for maintaining environment settings, boundary conditions and constraint conditions; a metadata management unit for managing meta information including timestamps, authors and priorities; an agent collaborative context management unit for managing subtask allocation and inter-agent communication content.

[0040] The task stack manager includes: a task receiving unit for receiving and processing new task requests; a task analysis unit for analyzing task properties and complexity; a task splitting unit for splitting complex tasks into executable subtasks; a stack management unit for managing the stacking, stacking and priority ordering of the task stack; a task dependency unit for processing the dependency relationship between subtasks; The recursive execution engine includes: a recursion controller for controlling the depth and flow of recursive execution; an execution monitoring unit for monitoring task execution status and performance indicators; a recursion limitation unit for setting and executing maximum recursion level limits; an exception handling unit for handling abnormal situations in the recursive execution process; a result aggregation unit for aggregating intermediate results of recursive execution; The importance sampler includes: a joint probability calculation unit for calculating the joint probability distribution of historical records, memories, agent states, collaboration logs and meta information; a candidate context generation unit for generating candidate context segments from multiple sources; an importance scoring unit for importance scoring of candidate contexts based on a joint probability model; A Top-K selection unit for selecting the top-K context segments with the highest importance scores; a sampling quality control unit for ensuring the quality and diversity of the sampled context.

[0041] As shown in Figure 3As shown, the system architecture executes the flow of the embodiments of the present application, and the specific flow is as follows: Among them, the system initializes and starts various core components, including the global context manager, the task stack manager, the recursive execution engine, the importance sampler, the context compressor, and the task scheduler.

[0042] As shown, the global context manager includes a target information management unit, a user input management unit, a historical dialogue management unit, an intermediate state management unit, an external memory management unit, an environment configuration management unit, a metadata management unit, and an agent collaborative context management unit. The manager adopts a classified storage structure and organizes and stores eight categories of context information, including a target information storage area, a user input storage area, a historical dialogue storage area, an intermediate state storage area, an external memory storage area, an environment configuration storage area, a metadata storage area, and an agent collaborative context storage area, for storing eight categories of context information of the agent system. Figure 4

[0043] The target information management unit is used to maintain and manage the main task description and target setting information, support multi-level target decomposition and target priority sorting. The user input management unit is used to process and manage the specific request information of the user, and has input preprocessing and intent recognition functions. The historical dialogue management unit is used to store and manage the multi-round dialogue record of the user and the agent, and uses a dialogue tree structure to store the dialogue history.

[0044] The intermediate state management unit is used to track the task execution log, progress state and variable table, and supports state snapshot and state rollback functions. The external memory management unit is used to manage the retrieved documents, rules and example information, and integrates the RAG (Retrieval-Augmented Generation) technology. The environment configuration management unit is used to maintain environment settings, boundary conditions and constraint conditions, and supports dynamic environment setting update.

[0045] The metadata management unit is used to manage meta information such as timestamp, author, priority, and provide context tracing and version control functions. The agent collaborative context management unit is used to manage subtask allocation and inter-agent communication content, and supports multi-agent collaboration state tracking.

[0046] The task stack manager includes a task receiving unit, a task analysis unit, a task splitting unit, a stack management unit, and a task dependency unit. The task receiving unit is used to receive the new task request input by the user, and supports multiple input formats, including text, voice and structured data. The task analysis unit analyzes the task characteristics through natural language processing (NLP) and machine learning (ML) algorithms, and identifies the task type.​

[0047] The task splitting unit splits complex tasks into multiple atomic sub-tasks according to the task dependency graph and complexity evaluation, each sub-task containing task description, priority, dependency relationship and execution parameter information. The stack management unit adopts First In First Out (FIFO) and Last In First Out (LIFO) strategies to manage task execution order, supporting priority queue and dynamic task scheduling. The task dependency unit adopts Directed Acyclic Graph (DAG) to manage task dependency relationship, ensuring coordination consistency among sub-agents.

[0048] The recursive execution engine includes a recursive controller, a task executor, a state checker, a recursion limiting unit, an exception handler and a result aggregation unit. The recursive controller sets the maximum recursion level limit to prevent infinite recursion, controls the depth and flow of recursive execution, and supports both depth-first and breadth-first recursion strategies.

[0049] The task executor supports both synchronous and asynchronous execution modes for executing specific task logic. The state checker monitors memory usage, execution time and recursion depth in real time, and monitors recursion execution state and resource usage. The recursion limiting unit adopts dynamic threshold adjustment and adaptive limiting mechanism to ensure the safety of recursive execution.

[0050] The exception handler includes timeout processing, resource exhaustion processing, deadlock detection and loop detection mechanism for handling abnormal situations during recursive execution. The result aggregation unit supports both incremental aggregation and full aggregation modes for aggregating intermediate results of recursive execution.

[0051] The importance sampler includes a joint probability calculation unit, a candidate context generation unit, an importance scoring unit, a Top-K (Top-K Selection) selection unit and a sampling quality control unit. The joint probability calculation unit uses Bayesian network and Markov chain model to calculate the joint probability distribution of historical records, memories, agent states, collaboration logs and meta information.

[0052] The candidate context generation unit is used to generate candidate context fragments from multiple sources, supporting semantic retrieval, keyword matching and similarity calculation. The importance scoring unit uses attention mechanism and neural network to score the importance of candidate contexts based on joint probability model.

[0053] The Top-K (Top-K Selection) selection unit uses heap sorting and quick selection algorithm to select the top K context fragments with the highest importance score for efficient selection. The sampling quality control unit ensures the quality and diversity of the sampled context by setting correlation threshold and diversity constraints.

[0054] As shown in Figure 5 A device of an agent context management system based on importance sampling, comprising a computing device 500, the computing device 500 comprising a plurality of subsystems: an input device subsystem 510, an output device subsystem 520, an external memory subsystem 530, a processor subsystem 550, a main memory subsystem 560, an application software subsystem 570, a communication device subsystem 580, and a bus subsystem for data exchange between the subsystems, comprising an I / O bus 541, a system bus 542 and a memory bus 543. Among them, the application software 570 of the computing device 500 contains a plurality of program instructions for executing the above-mentioned method according to the present application.

[0055] The input device subsystem 510 includes a mouse 512, a keyboard 511, a touch pen, a touch screen and a touchpad, a scanner, a front and / or rear camera 514 for acquiring image video, a microphone 513 for audio input, various signal sensors and other types of input devices. The sensors include light sensors (CMOS and CCD image sensors), acceleration sensors, magnetic sensors, pressure sensors and temperature sensors. This subsystem is designed to input the information from the outside world into the computing device 500 after encoding conversion.

[0056] The output device subsystem 520 includes a printer, a fax machine, a scanner, a display 521 for displaying video images, a speaker 522 for audio output, and other types of output devices. The display can include a cathode ray tube (CRT), a flat panel device of a liquid crystal display (LCD), a projection device and other devices for generating video images. This subsystem is designed to output the information in the computing device 500 to the user and / or the outside environment after conversion.

[0057] The external memory subsystem 530 includes storage devices such as hard disk drives, floppy disk drives and associated removable media, CD-ROM drives, optical disk drives and removable media cartridges and other magnetic disks 532 and disk controllers 531. This subsystem is designed to store the generated information in the computing device 500 into the related devices, and provides persistent storage for program and data files.

[0058] The processor subsystem 550 includes processor cores 551, cache 552, bus interface 553, registers and other processing devices. The processor 550 can be freely combined by a central processing unit (CPU), a graphics processing unit (GPU), an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a microprocessor (MPU), a controller, a microcontroller.

[0059] Processor cores 551 include arithmetic logic unit(s) (ALUs), floating point unit(s) (FPU), digital signal processing core(s) (DSP Core), CUDA core(s), and / or the like. Cache memory includes direct-mapped cache, set-associative cache, and fully-associative cache, which enable data exchange between processor cores 551 and system bus 542. Bus interface 553 is connected to system bus 542. This subsystem is intended to provide serial and / or parallel information processing capabilities for computing device 500.

[0060] Main memory subsystem 560 includes main random access memory (SRAM, RAM) that stores instructions and data during program execution, and read-only memory (ROM, EEPROM, PROM, flash) that stores fixed instructions. Both main random access memory and read-only memory are connected to memory bus 543. This subsystem is intended to temporarily store generated process information within computing device 500 into the relevant device.

[0061] Application software subsystem 570 includes program data 571, computer programs 572, and operating system 573. These software modules are executed by processor 550. In some embodiments, application software 570 can be arranged to execute instructions by multiple processors 550 using computer programs 570 on the operating system. This subsystem is intended to logically process information generated by processor 550 subsystem, providing data construction, processing, and programming of all functionality in the modules described herein.

[0062] Communication device 580 subsystem includes network interface 581. Network interface 581 provides an interface and device for communication with external networks and / or other computing devices. Communication device 580 subsystem can access wireless networks based on communication standards, such as Wi-Fi, 4G, 5G, 6G. Network communication media includes wired media, such as wired networks and / or leased lines, and various wireless media, including acoustic, radio frequency, microwave, infrared, laser, and the like. Communication media can generally be embodied by computer readable instructions, data structures, program modules in modulated data signals, such as carrier waves and / or other transmission mechanisms, and includes any information delivery media. This subsystem is intended to output information within computing device 500 to external networks and other computing devices through communication networks.

[0063] The bus subsystem includes an I / O bus 541, a system bus 542, and a memory bus 543. The various buses are bridged through I / O bridge 540, which connects bus interface 553 based on system bus 542, memory bus 543 to main memory 560, and I / O bus 541 to input devices 510, output devices 520, storage devices 530, and communication devices 580. The subsystem is intended to provide internal communication among the various components and subsystems of computing device 500, and embodiments of the bus subsystem can optionally use multiple buses.

[0064] Computing device 500 is configured to perform the agent management system method according to the present application. In this regard, computing device 500 contains program instructions that perform the above-described method according to the present application.

[0065] The above-described embodiments are merely intended to illustrate the present application, but not to limit the scope of the present application.

Claims

1. An agent context management system based on importance sampling, characterized in that: Includes a global context manager for maintaining and managing eight categories of context information; Task stack manager, which receives new requests and splits tasks; A recursive execution engine for executing tasks recursively and controlling the recursion depth; Importance sampler for context importance sampling based on joint probability model; A context compressor, which combines the sample segments into a final context; Task scheduler, used to coordinate the workflow of each component.

2. The agent context management system based on importance sampling according to claim 1, characterized in that: The global context manager includes: a target information management unit for maintaining and managing the main task description and target setting information; a user input management unit for processing and managing the user's specific request information; a historical dialogue management unit for storing and managing multi-round dialogue records between the user and the agent; an intermediate state management unit for tracking task execution logs, progress status and variable tables; an external memory management unit for managing retrieved documents, rules and sample information; an environment configuration management unit for maintaining environment settings, boundary conditions and constraints; a metadata management unit for managing meta-information, which includes timestamps, authors and priorities; and an agent collaborative context management unit for managing subtask allocation and communication content between agents.

3. The agent context management system based on importance sampling according to claim 2, characterized in that: The task stack manager includes: a task receiving unit for receiving and processing new task requests; a task analyzing unit for analyzing the nature and complexity of tasks; a task splitting unit for splitting complex tasks into executable subtasks; a stack management unit for managing the stacking, popping and priority sorting of task stacks; and a task dependency unit for handling the dependency relationships between subtasks. The recursive execution engine includes: a recursive controller for controlling the depth and flow of recursive execution; an execution monitoring unit for monitoring task execution status and performance indicators; a recursive restriction unit for setting and enforcing a maximum recursive level restriction; an exception handling unit for handling exceptions during recursive execution; and a result aggregation unit for aggregating intermediate results of recursive execution. The importance sampler includes: a joint probability calculation unit for calculating the joint probability distribution of history, memory, agent state, collaboration log and meta-information; a candidate context generation unit for generating candidate context fragments from multiple sources; an importance scoring unit for scoring the importance of candidate contexts based on the joint probability model; The Top-K selection unit is used to select the K context segments with the highest importance scores; the sampling quality control unit is used to ensure the quality and diversity of the sampled context.

4. The agent context management system based on importance sampling according to claim 3, characterized in that: The importance sampler is based on joint probability distribution modeling, specifically including: Collect eight categories of context information from the global context manager: target information, user input, historical dialogue, intermediate state, external memory, environment configuration, metadata, and agent collaborative context; preprocess each category of information, extract key feature vectors, and form a set of candidate context fragments ; Calculate each context segment based on a multi-factor scoring function Importance scores, including relevance scores , time weight , Priority Score and redundancy penalty ; Establish a conditional probability model to jointly model the collaborative context of intelligent agents and construct a joint probability distribution: in, Represents the collaborative state of the intelligent agent, and the energy function is: 。 5. The agent context management system based on importance sampling according to claim 4, characterized in that: The importance sampler also includes optimal subset selection for multi-objective optimization: Based on importance weight Perform importance sampling with context length constraints and select the optimal context subset through multi-objective optimization: The context compressor includes: a context analysis unit for analyzing the structure and content of sampled context segments; a compression strategy unit for formulating context compression strategies and algorithm selection; a segment combination unit for intelligently combining selected context segments; a length control unit for ensuring that the final context does not exceed a preset length limit; and a quality assessment unit for assessing the quality and integrity of the compressed context. The task scheduler includes: a workflow coordination unit for coordinating the workflow and timing relationships of each component; a resource allocation unit for allocating computing resources and storage resources; a load balancing unit for achieving balanced distribution of system load; a performance optimization unit for optimizing the overall system performance and processing efficiency; and a monitoring and feedback unit for monitoring the system status and providing feedback information.

6. The agent context management system based on importance sampling according to claim 5, characterized in that: The workflow of the system includes the following specific steps: Step 1: Receive a new task request from the user; Step 2: Analyze and split tasks through the task stack manager; Step 3: Use the global context manager to maintain eight types of context information; Step 4: Select relevant context based on the joint probability model through the importance sampler; Step 5: Use the context compressor to combine the sample segments into the final context; Step 6: Execute tasks through the recursive execution engine and control the recursion depth; Step 7: The task scheduler coordinates the entire workflow; Step 8: Output the processing results and update the context information.

7. The agent context management system based on importance sampling according to claim 6, characterized in that: The target information management unit supports multi-level target decomposition and target priority sorting; the user input management unit has input preprocessing and intent recognition functions; the history dialogue management unit uses a dialogue tree structure to store dialogue history; The intermediate state management unit supports state snapshot and state rollback functions; the external memory management unit integrates RAG retrieval enhancement generation technology; The environment configuration management unit supports dynamic environment setting updates; the metadata management unit provides context traceability and version control functions; and the agent collaborative context management unit supports multi-agent collaborative status tracking.

8. The agent context management system based on importance sampling according to claim 7, characterized in that: The task receiving unit supports multiple input formats, including text, voice, and structured data; the task analyzing unit uses natural language processing and machine learning algorithms to analyze task features; The task splitting unit performs intelligent splitting based on the task decomposition tree and dependency graph; the stack management unit supports priority queues and dynamic task scheduling; the task dependency unit uses a directed acyclic graph to manage task dependencies; The recursion controller supports both depth-first and breadth-first recursion strategies; the execution monitoring unit monitors execution time, memory usage, and success rate in real time; the recursion restriction unit adopts dynamic threshold adjustment and adaptive restriction mechanisms; the exception handling unit includes timeout processing, loop detection, and resource protection mechanisms; the result aggregation unit supports both incremental aggregation and full aggregation modes; The context analysis unit adopts a method that combines semantic analysis and structural analysis; the compression strategy unit supports multiple strategies such as summary compression, keyword extraction and semantic compression; the fragment combination unit uses attention mechanism and weighted fusion for intelligent combination; the length control unit adopts dynamic truncation and adaptive compression mechanism; the quality assessment unit assesses quality through completeness, relevance and consistency indicators; The workflow coordination unit uses a state machine and workflow engine to manage processes; the resource allocation unit dynamically allocates resources based on task priority and resource requirements; the load balancing unit supports multi-node deployment and distributed processing; the performance optimization unit includes cache optimization, parallel processing and algorithm optimization; the monitoring feedback unit provides real-time monitoring, alarm and performance analysis functions.

9. The device for an agent context management system based on importance sampling according to claim 8, characterized in that: It includes a processor; and a memory for storing computer-executable instructions; a computer program, which is stored in the memory and executed by the processor, and the computer-readable storage medium stores a computer program that can implement an intelligent agent context management system and device based on importance sampling.

Citation Information

Cited By

  • Information processing method, task processing method, electronic device, storage medium and program product

    CN121168507A

  • Information processing method, task processing method, electronic device, storage medium, and program product

    CN121168507B