arXiv:2510.14881cs.AIcs.IT2025-10

用轻量态预判+按需请求,让大模型更可靠地操作复杂系统。

The Gatekeeper Knows Enough

  • 先用低精度状态预判,需要时才请求高精度信息。
  • 实测提升可靠性,减少token消耗,支持大规模系统交互。
  • 适合构建稳定可控的代码、文档等复杂系统智能代理。

大型语言模型(LLMs)日益被用作自主代理,但其实际效用受限于有限的上下文窗口和因模型无状态性及低效上下文管理导致的状态不同步。这些限制引发输出不可靠、行为不可预测和资源浪费,尤其在与代码库、文档等大规模结构化敏感知识系统交互时更为明显。为此,我们提出门控协议(Gatekeeper Protocol),一种领域无关的新框架,用于规范代理与系统间的交互。该协议要求代理首先在最小化、低保真的“潜在状态”表示上操作与推理,并仅在必要时按需请求高保真上下文。所有交互通过统一的JSON格式进行,作为声明式、状态同步的协议,确保代理对系统的认知始终可验证地契合系统真实状态。我们以Sage为参考实现,在软件开发场景中验证了该协议的有效性。结果表明,该方法显著提升代理可靠性,计算效率提高,有效降低令牌消耗,并支持与复杂系统的可扩展交互,为构建任何结构化知识领域的更鲁棒、可预测、可信的AI代理提供了基础方法。

原文摘要 · Abstract (English)

Large Language Models (LLMs) are increasingly deployed as autonomous agents, yet their practical utility is fundamentally constrained by a limited context window and state desynchronization resulting from the LLMs' stateless nature and inefficient context management. These limitations lead to unreliable output, unpredictable behavior, and inefficient resource usage, particularly when interacting with large, structured, and sensitive knowledge systems such as codebases and documents. To address these challenges, we introduce the Gatekeeper Protocol, a novel, domain-agnostic framework that governs agent-system interactions. Our protocol mandates that the agent first operate and reason on a minimalist, low-fidelity "latent state" representation of the system to strategically request high-fidelity context on demand. All interactions are mediated through a unified JSON format that serves as a declarative, state-synchronized protocol, ensuring the agent's model of the system remains verifiably grounded in the system's reality. We demonstrate the efficacy of this protocol with Sage, a reference implementation of the Gatekeeper Protocol for software development. Our results show that this approach significantly increases agent reliability, improves computational efficiency by minimizing token consumption, and enables scalable interaction with complex systems, creating a foundational methodology for building more robust, predictable, and grounded AI agents for any structured knowledge domain.

AI代理上下文管理代码生成状态同步

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。