ChatPaper.aiChatPaper

智能体上下文管理:通过将智能体记忆与成本视为生命周期与架构问题来加以解决

Agentic Context Management: Solving Agent Memory and Cost by Treating Them as Lifecycle and Architecture Problems

July 23, 2026
作者: Gaurav Dadhich
cs.AI

摘要

生产环境中AI智能体的失败通常并非源于推理能力不足,而更多是因为它们无法有效管理自身推理上下文的内容:包括对话历史、冗长的提示词、复杂的工具定义以及持续膨胀的工具输出。智能体会被自身累积的历史信息淹没,每次交互都会产生更高的令牌成本,导致跨对话及对话内部的记忆缺失。现有方案将其视为存储-检索问题,但我们认为这种界定过于狭隘。主动管理智能体持有的信息是一个完整的生命周期过程,而不仅仅是存储行为:它涵盖决定需要记忆的内容、提取并结构化信息、按数据类型选择存储方式、在保留溯源信息的基础上进行整合与遗忘、判断当前相关的信息、预测下一步所需内容、以及在预算限制下压缩上下文而不丢失关键信息。在真实生产环境中,这套机制不仅作用于单个用户,更需跨越组织层级架构。我们将这一体系命名为"智能体上下文管理"(Agentic Context Management, ACM),并将其分解为五大原语:架构设计、信息摄取、范围界定、预测预判、压缩与整合。随后进行经济学论证:原始上下文累积会导致令牌成本随对话长度呈二次方增长,粗糙摘要虽能实现线性成本但伴随准确性断崖式下降,唯有经过验证的压缩方案方能保持线性成本与保真度。我们描述了参考实现系统Maximem Synap,该系统将五大原语作为多租户服务实现,在第六节详述的配置下,于LongMemEval基准测试中达到92%准确率,在LoCoMo测试中达到93.2%。最后探讨现有基准尚未覆盖的维度——延迟、令牌效率、语境衰退抵抗性,以及该领域未来将面临的决策层与组织层上下文管理挑战。
English
Production AI agents' failures are less often due to an inability to reason well and more often because they cannot manage what is in their reasoning context: conversation histories, large prompts, large tool definitions, and ballooning tool outputs. Agents drown in their own accumulating history while paying a token cost that grows every turn, producing missing recalls within and across conversations. The incumbent response treats this as a storage-and-retrieval problem. We argue that framing is too narrow. Actively managing what an agent holds in mind is a lifecycle, not merely a store: it spans deciding what to remember, extracting and structuring it, choosing the right store per data type, consolidating and forgetting while preserving provenance, deciding what is relevant now, anticipating what is needed next, and compacting context to a budget without losing what matters. In serious production this operates not over a single user but across an organizational scope hierarchy. We name this discipline Agentic Context Management (ACM) and decompose it into five primitives: architecting, ingesting, scoping, anticipating, and compacting & consolidation. We then make the economic case: naive context accumulation grows token cost quadratically in conversation length, crude summarization buys linear cost at the price of an accuracy cliff, and only validated compaction achieves linear cost with preserved fidelity. We describe a reference implementation, Maximem Synap, that realizes the five primitives as a multi-tenant service and reports 92% on LongMemEval and 93.2% on LoCoMo under the configuration detailed in Section 6. We close with dimensions existing benchmarks do not yet capture, latency, token efficiency, and context-rot resistance, and the frontier of decision-level and organization-level context the category points toward.