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.