LedgerAgent:面向策略合规工具调用智能体的结构化状态管理方法
客服领域的工具调用智能体需跨轮维护任务状态并遵守领域策略。标准方法将状态隐含在提示词中,易导致信息过时或策略违规。LedgerAgent 是一种推理时方法,将观察到的任务状态单独维护于分类账中并渲染到提示词;在改变环境的工具调用前,用分类账检查状态依赖的策略约束以阻止违规。在四个客服领域和混合开源/闭源模型上,LedgerAgent 的平均 passk 指标优于标准基于提示的工具调用方法,在多轮一致性指标上提升最大。
Policy-adherent tool-calling agents in customer-service domains must maintain task states across turns while calling tools and obeying domain policies. Task states consist of relevant facts, identifiers, constraints, and conditions observed through user interaction and tool calls. In standard agents, task states are not represented separately. Observations, tool returns, and policy instructions are placed in the prompt, leaving agents to reconstruct the relevant states from the prompt each time they decide what to do next. This design makes state management implicit, creating two common failure modes. An agent may retrieve the right facts but later ground its decision in stale, missing, or incorrect information; and a syntactically valid tool call may still violate a domain policy that depends on the current task state. We introduce LedgerAgent, an inference-time method for tool-calling agents that maintains observed task states in a separate ledger and renders the states into the prompt. The ledger is also used to check state-dependent policy constraints before environment-changing tool calls are executed, blocking policy violations. Across four customer-service domains and a mixed panel of open- and closed-weight models, LedgerAgent improves average passk over a standard prompt-based tool-calling approach, with the largest gains under stricter multi-trial consistency metrics.