Harness: LLM-reviewed tool approvals (auto-approve low-risk calls, defer the rest to a human)
Summary
A harness capability that sends each tool call needing approval to a reviewer model first. The reviewer grades the call's risk with a structured output. Calls below a configurable threshold are approved automatically. The rest go through the normal DeferredToolRequests / ApprovalRequired flow to a human. This is the "auto-review" approval mode that Codex and Claude Code ship for shell commands.
Prior art
converge-ai-labs/agent-foundation a13n_harness/capabilities/tool_review.py:
- It uses a
ToolRiskLevelladder and aToolReviewPolicywith a globalrisk_thresholdand per-tool rules (selectors). - A replaceable
ToolReviewerprotocol has a defaultAgentToolReviewerthat runs a small Pydantic AI agent withToolOutput. It bounds usage and records the reviewer's usage separately. - The review input includes run evidence (recent context, cwd), and the reviewer never gets execution authority.
What we have today
- Core:
ApprovalRequired,DeferredToolRequests,HandleDeferredToolCalls(human or programmatic approval). - Harness:
Shellpolicies (allowlists/patterns),ToolGuardrail(arbitrary callback),PromptInjectionDefender,TrajectoryJudge.
Nothing packages "a model grades this call and decides approve/escalate" with a policy surface. ToolGuardrail with a hand-written agent can approximate it.
Sketch
ToolReview(model=..., threshold='high', tools=[...], rules={...}), sitting in front of HandleDeferredToolCalls. It would emit a span per review (risk, decision, reviewer usage), keep content behind include_content, and integrate with CLAI2's approval UI as an "auto" mode.
Source: pydantic/pydantic-ai