LedgerAgent: Structured State for Policy-Adherent Tool-Calling Agents
TL;DR Highlight
고객서비스 AI 에이전트가 정책을 위반하는 tool call을 실행 전에 차단하는 '원장(Ledger)' 기반 상태 관리 방법론
Who Should Read
고객서비스, 예약, 결제 등 비즈니스 정책을 지켜야 하는 tool-calling 에이전트를 개발하는 백엔드/AI 개발자. 특히 멀티턴 대화에서 tool 반환값을 기반으로 정책 준수 여부를 검증해야 하는 상황에 처한 개발자.
Core Mechanics
- 기존 에이전트는 tool 반환값을 그냥 프롬프트에 쌓아두는데, 대화가 길어지면 모델이 예전 정보를 잘못 참조하거나 빠뜨리는 'state grounding 실패'가 발생한다.
- LedgerAgent는 tool 성공 반환값을 schema-anchored typed dictionary(Ledger)에 따로 저장하고, 매 턴마다 이 Ledger를 프롬프트에 추가로 주입해서 모델이 현재 상태를 정확히 참조하게 한다.
- 환경을 변경하는 tool call(주문 취소, 환불 처리 등)은 실행 전에 'Policy Gate'를 통과해야 하고, Gate는 Ledger 필드를 기반으로 정책 준수 여부를 코드 predicate로 검사한다.
- Gate 결과는 3가지: ALLOW(그대로 실행), REVISE(위반 이유를 모델에 돌려줘서 수정 기회 제공), BLOCK(거부 및 종료).
- Ledger 업데이트와 Policy Gate는 모두 deterministic 연산이라 추가 LLM 호출이 없다. 토큰 오버헤드만 있고 API 비용은 기존 에이전트와 동일.
- GPT-5.2, GPT-4.1, Kimi K2.5, GLM-5, MiniMax M2.5, Qwen3-30B 등 6개 모델에서 모두 성능 향상이 확인돼 특정 모델에 종속되지 않는다.
Evidence
- GPT-4.1 백본 기준 pass^1(1번 시도 성공률) +12.2pp, pass^4(4번 모두 성공하는 일관성) +10.1pp 향상 (retail+airline 도메인).
- GPT-5.2 백본 기준 pass^1 +15.5pp 향상.
- 비교 대상인 IRMA(헬퍼 에이전트 3개를 쓰는 방법)보다 pass^1 +3.7pp, pass^4 +7.4pp 높으면서 IRMA는 토큰 53.1% 오버헤드인 반면 LedgerAgent는 토큰 오버헤드 0% (추가 LLM 호출 없음).
- MiniMax M2.5 기준 average pass^1 +7.3pp, average pass^4 +8.3pp 향상. 실패 분석에서 남은 오류의 90.7%는 'missed required action'과 'wrong action arguments'로, 정책 위반 자체는 크게 줄었음을 시사.
How to Apply
- 도메인별로 tool path map(어떤 tool 반환값을 어느 경로에 저장할지)과 policy predicate(어떤 조건을 위반하면 막을지)를 코드로 한 번만 작성하면 된다. 예: 항공권 취소 에이전트라면 `cancel_reservation` tool에 '24시간 이내 예약인가', '여행자 보험이 있는가'를 체크하는 predicate를 붙인다.
- 에이전트 루프에서 tool 반환값을 받을 때마다 Ledger에 흡수(Absorb)하고, 모델 호출 전에 Render(L)로 Ledger 블록을 프롬프트에 추가하면 된다. 환경 변경 tool call 직전에 GateFilter(a, L, Π)를 실행해서 ALLOW/REVISE/BLOCK을 결정한다.
- REVISE 결과를 받으면 위반 이유를 모델에게 피드백으로 넘겨서 스스로 수정하게 한다. 예: 환불 payment method가 원래 결제 수단이 아닌 경우, 어떤 payment method를 써야 하는지 이유와 함께 모델에 돌려주면 모델이 올바른 인자로 재시도한다.
Code Example
Terminology
Related Papers
Show HN: Oak – Git alternative designed for agents
AI 에이전트가 코드 작업을 더 효율적으로 수행할 수 있도록 설계된 새로운 버전 관리 시스템(VCS)으로, lazy mount, JSON-first CLI, 멀티 레포 에이전트 워크스페이스 등을 제공한다. 다만 커뮤니티에서는 Git 대비 실질적 우위가 충분히 증명되지 않았다는 회의적 반응이 많다.
Show HN: Recall – Local project memory for Claude Code
Claude Code 세션이 끝날 때마다 프로젝트 컨텍스트를 처음부터 다시 설명해야 하는 문제를 외부 API 없이 로컬에서 해결하는 Python 기반 오픈소스 도구다.
Show HN: We post-trained a model that pen tests instead of refusing
Kimi K2.6 모델을 post-training해서 보안 거부 응답 없이 실제 취약점 스캔과 펜 테스트를 수행하는 CLI 도구 ArgusRed를 공개했다. 오픈 모델을 조금만 조정하면 AI 기반 해킹 도구를 누구나 만들 수 있다는 점에서 보안 커뮤니티에 논란이 되고 있다.
Sovereign Execution Brokers: Enforcing Certificate-Bound Authority in Agentic Control Planes
LLM 에이전트가 AWS/K8s를 직접 건드리지 못하게, 모든 인프라 변경을 암호화 인증서로 묶어 중간 브로커가 강제 검증하는 보안 아키텍처.
Data Intelligence Agents: Interpreting, Modeling, and Querying Enterprise Data via Autonomous Coding Agents
SQL 한 줄 못 써도 CSV 올리면 DB 만들고 자연어 질문에 SQL 자동 생성·검증까지 해주는 3-에이전트 시스템, 7개 벤치마크 모두 SOTA 달성.
TREX: An AI code reviewer that runs your code
Greptile가 PR 리뷰 시 코드를 실제로 실행해서 런타임 버그까지 잡아주는 TREX를 공개했다. 정적 분석만으로는 발견할 수 없는 race condition, UI 회귀, 상태 의존 로직 버그까지 커버한다.
Related Resources
Original Abstract (Expand)
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 \textsc{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, \textsc{LedgerAgent} improves average pass\textasciicircum{}k over a standard prompt-based tool-calling approach, with the largest gains under stricter multi-trial consistency metrics.