LedgerAgent: Policy를 준수하는 Tool-Calling 에이전트를 위한 구조화된 State 관리
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
관련 논문
ctx – 로컬 머신의 코딩 에이전트 히스토리를 검색하는 CLI 도구
Claude Code, Cursor, Codex 등 코딩 에이전트가 이전 세션의 논의·결정·실패 시도를 잊지 않도록 SQLite로 인덱싱해 재사용할 수 있게 해주는 오픈소스 CLI 도구다.
Micro-Agent: Model API 내부 협업으로 Frontier 모델을 이기는 방법 (vLLM Semantic Router)
vLLM 팀이 단일 모델 API 호출 뒤에서 여러 모델이 협업하는 'Micro-Agent' 개념을 공개했습니다. 별도의 에이전트 코드 없이 라우터 레이어에서 모델 조합을 실행해 GPT-4급 결과를 더 저렴하게 낼 수 있다는 아이디어입니다.
Ornith-1.0: 에이전틱 코딩을 위한 자기 개선형 오픈소스 모델
Gemma 4와 Qwen 3.5를 기반으로 파인튜닝한 코딩 특화 오픈소스 모델로, RL(강화학습)을 통해 스캐폴드(에이전트 실행 구조)까지 함께 최적화하는 방식을 주장하지만, 커뮤니티에서는 벤치마크 과최적화에 불과하다는 의심을 받고 있다.
Tool-Augmented Agent에서의 Entity Binding 실패 분석
AI 에이전트가 올바른 도구를 선택해도 잘못된 대상에 실행하는 'Entity Binding 실패' 문제를 정의하고, 이를 막는 실행 정책을 평가한 논문.
Herdr: 터미널에서 여러 AI Agent를 한 번에 관리하는 Agent Multiplexer
여러 AI 코딩 에이전트(Claude, Codex 등)를 하나의 터미널에서 동시에 실행·관리할 수 있는 Rust 기반 오픈소스 툴로, tmux처럼 세션이 유지되고 SSH로 원격 접속도 가능해 멀티 에이전트 워크플로우를 크게 단순화해준다.
Ornith-1.0: 스스로 Scaffold를 생성하는 Agentic Coding LLM
모델이 문제 풀이 전략(scaffold)을 직접 생성하고 개선하는 자기강화 학습 프레임워크를 적용한 오픈소스 코딩 특화 LLM으로, 9B 소형 모델부터 397B 대형 모델까지 라인업을 갖추고 SWE-Bench 등 주요 벤치마크에서 Claude Opus 4.7을 능가하는 성능을 보여줬다.
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.