An AI agent architecture system and method based on document as agent
Patent Information
- Application Number
- CN202610739736.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-18
AI Technical Summary
该模式存在以下问题:大型语言模型每次调用需加载大量知识内容(约50Ktokens),实际利用率仅10-20%,造成Token资源浪费
本发明提供一种基于文档即智能体的AI智能体架构系统及方法,通过智能体定义模块根据预设定的tokens数量阈值设置智能体的配置文件,可以通过较少数量tokens实现轻量化智能体定义,还通过边车模式进行智能体、索引和知识库的加载,实现Token使用效率的提升,降低Token消耗。
Smart Images

Figure CN122595981A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, specifically to an AI intelligent agent architecture system and method based on document-as-an-agent. Background Technology
[0002] Currently, AI agent architectures generally adopt the Agent as Prompt model, where the agent uses a large Prompt containing the necessary knowledge. This model has the following problems: large language models need to load a large amount of knowledge content (approximately 50K tokens) for each call, with an actual utilization rate of only 10-20%, resulting in a waste of token resources.
[0003] In traditional solutions, agents need to embed domain knowledge through pre-training or fine-tuning, and knowledge updates require retraining the model, resulting in high maintenance costs. Existing agent architectures such as LangChain and AutoGPT, while providing agent orchestration capabilities, still rely on traditional vector databases or static knowledge bases for knowledge management, failing to achieve modularity, reusability, and dynamic composition of knowledge. The following technical problems also exist: Low token utilization efficiency: Traditional architectures require embedding all knowledge into the Prompt, consuming approximately 50K tokens, with an actual utilization rate of only 10-20%.
[0004] High knowledge maintenance costs: updating knowledge requires rewriting the entire Prompt or retraining the model.
[0005] Poor system scalability: Adding new knowledge causes the Prompt to bloat, and its performance is affected by length limitations.
[0006] Version management is difficult: knowledge updates cannot be independently version controlled, and conflicts arise in team collaboration.
[0007] The transmission of expert experience is difficult: professional knowledge is hard to pass on in a structured and modular way.
[0008] Low collaboration efficiency: Knowledge is repeatedly loaded during cross-agent collaboration, increasing communication costs. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide an AI agent architecture system and method based on documents as agents. It uses knowledge documents as the core carrier of agents, adopts a sidecar mode knowledge loading mechanism, reduces token consumption, and improves token utilization.
[0010] To achieve the above objectives, the present invention is implemented using the following technical solution: In a first aspect, the present invention provides an AI agent architecture system based on document-as-agent, comprising: The agent definition module is used to set the agent's configuration file and construct the agent based on a pre-defined threshold for the number of tokens. Modular knowledge document repository, comprising several knowledge document repositories categorized by domain and function: A dynamic knowledge loading engine is used to dynamically load relevant modular knowledge document libraries for intelligent agents based on pre-acquired problem characteristics, using a sidecar pattern. A multi-agent coordinator is used to coordinate the work of several agents.
[0011] Furthermore, the step of dynamically loading relevant modular knowledge document bases for the agent using a sidecar mode based on pre-acquired problem characteristics includes: Initialization phase: Loading the agent; Index loading phase: Load the definition document of the knowledge document library corresponding to the agent; On-demand loading phase: Extract problem features based on the input problem, and dynamically load relevant modular knowledge document libraries for the agent based on the problem features.
[0012] Furthermore, the number of tokens in the definition document is ≤5000.
[0013] Furthermore, the number of tokens in the knowledge module is 2000~5000.
[0014] Furthermore, the threshold for the number of tokens is 500.
[0015] Furthermore, the configuration file is a YAML configuration file, which includes basic metadata, role characteristics, core behaviors, and menu commands.
[0016] Furthermore, the knowledge document base is a Markdown knowledge document base; The classification based on domain and function includes: Based on pre-imported document data, the knowledge document library is divided into the following categories according to the classification principles of domain and function: algorithm library, constraint library, target library, and domain library.
[0017] Furthermore, the feature is that each of the knowledge document bases adopts a pre-defined standardized template.
[0018] Furthermore, the coordination of several intelligent agents to work includes: Parallel coordination: Multiple agents load the required knowledge simultaneously and work in parallel; Serial coordination: Agents pass state and context sequentially; Hierarchical coordination: The main agent coordinates multiple sub-agents.
[0019] Secondly, this invention provides an AI agent architecture method based on document-as-agent, applicable to any of the aforementioned document-as-agent AI agent architecture systems, comprising the following steps: Based on the preset token quantity threshold, configure the agent's configuration file and construct the defined agent: Based on pre-imported document data, it is categorized according to domain and function to build a modular knowledge document base: Based on the pre-acquired problem characteristics, the sidecar mode is used to dynamically load relevant knowledge document libraries for the agent; Coordinate the work of several intelligent agents.
[0020] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: This invention provides an AI agent architecture system and method based on document-as-agent. The agent definition module sets the agent configuration file according to a pre-set token quantity threshold, which can achieve lightweight agent definition with a small number of tokens. Furthermore, the sidecar mode is used to load agents, indexes and knowledge bases, thereby improving token usage efficiency and reducing token consumption.
[0021] In this invention, the document simultaneously serves as both a knowledge carrier and an intelligent behavior executor. This design achieves the unification of knowledge and behavior at the document level. By separating the knowledge base from the intelligent agent's runtime, it enables dynamic loading on demand, avoiding the loading of irrelevant knowledge. The knowledge modules in this invention can be updated independently without affecting the intelligent agent definition, thereby supporting knowledge version management and team collaboration. Attached Figure Description
[0022] Figure 1 This is a system architecture diagram of an AI agent architecture system based on document-as-agent provided in an embodiment of the present invention; Figure 2 This is a flowchart of the dynamic knowledge loading mechanism of the document-as-agent AI agent architecture system provided in this embodiment of the invention; Figure 3 This is a sequence diagram of the agent workflow of an AI agent architecture system based on document-as-agent provided in an embodiment of the present invention. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0024] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are used only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0025] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances. Example
[0026] Please see Figure 1 and Figure 3 This embodiment introduces an AI agent architecture system based on documents as agents, including an agent definition module, a modular knowledge document library, a dynamically loaded knowledge engine, and a multi-agent coordination manager.
[0027] The agent definition module is used to set the agent's configuration file and construct the agent based on a pre-defined token quantity threshold. The modular knowledge document library includes several knowledge document libraries categorized by domain and function. The dynamic knowledge loading engine dynamically loads relevant knowledge document libraries for the agent using a sidecar approach based on pre-acquired problem characteristics. The multi-agent coordination manager coordinates the work of several agents.
[0028] Among them, such as Figure 2 As shown, the step of dynamically loading knowledge modules from the modular knowledge document base for the agent based on the input question characteristics using the sidecar mode specifically includes: Initialization phase: Loading the agent; Index loading phase: Execute pre-defined critical_actions (core behaviors) and load the README.md (definition document) of the knowledge document base corresponding to the agent. On-demand loading phase: Extract problem features based on the input problem, and dynamically load relevant knowledge document libraries for the agent based on the problem features.
[0029] In this embodiment, the number of tokens for the definition document is ≤5000. The number of tokens for the knowledge module is 2000~5000.
[0030] The configuration file is a YAML configuration file, including basic metadata, role characteristics, core behaviors, and menu instructions. As a lightweight YAML configuration file, each agent definition is limited to 500 tokens and includes basic metadata, role characteristics, core behaviors, and menu instructions. The metadata includes ID, name, and role positioning.
[0031] For example, the knowledge document base is a Markdown knowledge document base; Categorization based on domain and function includes: Based on the pre-imported document data, it is divided into the following categories according to domain and function: algorithm library (algorithm-library / ), constraint library (constraint-library / ), objective library (objective-library / ), and domain library (domain-library / ).
[0032] In addition, each knowledge module uses a standardized template, which contains the following fields, as shown in Table 1 below.
[0033] Table 1: Fields of the Standardization Module
[0034] In this embodiment, several intelligent agents are coordinated to work, specifically including the following three coordination modes: Parallel coordination: Multiple agents load the required knowledge simultaneously and work in parallel; Serial coordination: Agents pass state and context sequentially; Hierarchical coordination: The main agent coordinates multiple sub-agents.
[0035] In summary, the document-as-agent AI agent architecture system of the present invention has the following characteristics: Based on the design that the document itself is an intelligent agent, the document simultaneously assumes the dual role of knowledge carrier and intelligent behavior executor, realizing the unification of knowledge and behavior at the document level.
[0036] Furthermore, this invention separates the knowledge base from the agent runtime, enabling on-demand dynamic loading and avoiding the loading of irrelevant knowledge. Knowledge modules are updated independently without affecting the agent definition. It supports knowledge version management and team collaboration. Knowledge updates are transformed from traditional prompt rewriting or model retraining into simple document editing. Traditional updates take days and require specialized AI engineers. This solution updates in just a few minutes, which business experts can directly operate. Maintenance efficiency is reduced from days to minutes, a significant improvement. New knowledge is no longer limited by prompt length, allowing for unlimited expansion of the knowledge base. It supports dynamic combinations of thousands of knowledge modules, version management and dependencies between modules, and allows multiple teams to develop different knowledge modules in parallel. This invention also improves token efficiency through a three-layer mechanism of lightweight definition, index loading, and on-demand modules.
[0037] Furthermore, this invention establishes a precise mapping between agent behavior and document content, enabling agent behavior to be traced back to specific document content; document updates automatically affect agent behavior; and it supports version control and auditing of agent behavior. Through document templating, it achieves the standardization and modularization of expert experience. By establishing domain knowledge standard templates, it supports the rapid input and verification of expert experience, ultimately enabling the reuse of knowledge across projects and teams.
[0038] In this embodiment, when multiple agents collaborate, they share a knowledge index to avoid redundant loading. Traditional collaboration involves each agent loading knowledge independently, resulting in high duplication rates. This solution shares the knowledge index and loads it on demand, improving collaboration efficiency.
[0039] Example 2: This example provides a document-as-agent AI agent architecture method, applicable to the document-as-agent AI agent architecture system in Example 1, including the following steps: Based on the preset token quantity threshold, configure the agent's configuration file and construct the defined agent: Based on pre-imported document data, it is categorized according to domain and function to build a modular knowledge document base: Based on the pre-acquired problem characteristics, the sidecar mode is used to dynamically load relevant knowledge document libraries for the agent; Coordinate the work of several intelligent agents.
[0040] The specific functions of each module described above are explained in the relevant content of the method in Embodiment 1, and will not be repeated here.
[0041] Example 3: This example provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described in Example 1.
[0042] Example 4: This example provides a computer device, including: Memory, used to store computer programs / instructions; A processor for executing the computer program / instructions to implement the steps of any of the methods described in Embodiment 1.
[0043] Example 5: This example provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the method described in any one of Examples 1.
[0044] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
[0045] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0046] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0047] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0048] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure and not to limit its protection scope. Although this disclosure has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading this disclosure, they can still make various changes, modifications or equivalent substitutions to the specific implementation of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the pending claims.
Claims
1. An AI agent architecture system based on document-as-agent, characterized in that, include: The agent definition module is used to set the agent's configuration file and construct the agent based on a pre-defined threshold for the number of tokens. A modular knowledge document repository, comprising several knowledge document repositories categorized by domain and function: A dynamic knowledge loading engine is used to dynamically load relevant modular knowledge document libraries for intelligent agents based on pre-acquired problem characteristics, using a sidecar pattern. A multi-agent coordinator is used to coordinate the work of several agents.
2. The AI agent architecture system based on document-as-agent as described in claim 1, characterized in that, The process of dynamically loading relevant modular knowledge document bases for the agent based on pre-acquired problem characteristics using a sidecar approach includes: Initialization phase: Loading the agent; Index loading phase: Load the definition document of the knowledge document library corresponding to the agent; On-demand loading phase: Extract problem features based on the input problem, and dynamically load relevant modular knowledge document libraries for the agent based on the problem features.
3. The AI agent architecture system based on document-as-agent as described in claim 2, characterized in that, The number of tokens in the definition document is ≤5000.
4. The AI agent architecture system based on document-as-agent as described in claim 2, characterized in that, The number of tokens in the knowledge module is 2000~5000.
5. The AI agent architecture system based on document-as-agent as described in claim 1, characterized in that, The threshold for the number of tokens is 500.
6. The AI agent architecture system based on document-as-agent as described in claim 1, characterized in that, The configuration file is a YAML configuration file, which includes basic metadata, role characteristics, core behaviors, and menu commands.
7. The AI agent architecture system based on document-as-agent as described in claim 1, characterized in that, The knowledge document library is a Markdown knowledge document library; The classification based on domain and function includes: Based on pre-imported document data, the knowledge document library is divided into the following categories according to the classification principles of domain and function: algorithm library, constraint library, target library, and domain library.
8. The AI agent architecture system based on document-as-agent as described in claim 7, characterized in that, Each of the aforementioned knowledge document repositories uses a pre-defined standardized template.
9. The AI agent architecture system based on document-as-agent as described in claim 1, characterized in that, The coordination of several intelligent agents to perform their work includes: Parallel coordination: Multiple agents load the required knowledge simultaneously and work in parallel; Serial coordination: Agents pass state and context sequentially; Hierarchical coordination: The main agent coordinates multiple sub-agents.
10. A document-as-agent AI agent architecture method, characterized in that, An AI agent architecture system based on document-as-agent as described in any one of claims 1 to 9, comprising the following steps: Based on the preset token quantity threshold, configure the agent's configuration file and construct the defined agent: Based on pre-imported document data, it is categorized according to domain and function to build a modular knowledge document base: Based on the pre-acquired problem characteristics, the sidecar mode is used to dynamically load relevant knowledge document libraries for the agent; Coordinate the work of several intelligent agents.