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

AK's Picks LLM MQIA Long Context Agent Agent Memory Agent Eval Benchmarks AI Systems and Hardware VDRAD
生产环境中AI智能体的失效,较少源于其推理能力不足,而更多是因为它们无法有效管理自身推理所依赖的上下文内容:包括对话历史、冗长的提示词(prompts)、庞大的工具定义,以及急剧膨胀的工具输出结果。智能体在自身不断累积的历史信息中“溺亡”,同时每一轮交互还需承担持续增长的token开销,从而导致对话内部及跨对话场景下关键信息的遗漏与召回失败。当前主流应对思路将此问题简单视为存储与检索问题。我们认为,这种视角过于狭隘。对智能体“心智中所持内容”的主动管理,本质上是一个完整的生命周期过程,而不仅仅是一项静态存储任务:它涵盖决定应记忆哪些内容、从中提取并结构化关键信息、为不同类型的数据选择最适配的存储机制、在保留溯源依据的前提下进行信息整合与遗忘、动态判断当下所需的相关信息、前瞻性预判后续交互所需的上下文,并在严守token预算约束的前提下,对上下文进行高效压缩而不丢失核心语义。在真正严肃的生产实践中,这一机制的运作范围并非局限于单个用户,而是需覆盖组织层级的完整作用域——从个体到团队、部门乃至整个企业。我们将这一系统性能力命名为“智能体上下文管理”(Agentic Context Management, ACM),并将其解构为五大基础原语(primitives):架构设计(architecting)、数据摄入(ingesting)、范围界定(scoping)、前瞻预测(anticipating),以及压缩与整合(compacting & consolidation)。随后,我们从经济学角度论证:朴素的上下文累积方式会使token成本随对话长度呈二次方增长;粗粒度摘要虽可将成本压至线性,却会引发准确率的断崖式下降;唯有经过验证的上下文压缩技术,才能在实现线性成本增长的同时,完整保持语义保真度。我们介绍了一个参考实现方案——Maximem Synap,该系统以多租户服务形式落地上述五大原语,并在第6节详述的配置下,在LongMemEval基准测试中取得92%的得分,在LoCoMo基准测试中达到93.2%的得分。最后,我们指出当前现有评测基准尚未涵盖的三个关键维度:响应延迟(latency)、token利用效率(token efficiency),以及上下文老化抵抗能力(context-rot resistance);并进一步展望该领域的发展前沿——即面向决策层级与组织层级的上下文建模与协同治理。
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.
许愿