Add `ToolCallJudge` to assess tool calls before execution
Merged
DO
2mo ago+1998+1998+0123456789012345678901234567890123456789-3-3-0123456789
Why we make these changes
A tool's name alone may not show whether a particular call is risky; its arguments matter. ToolCallJudge uses a second model to assess selected calls before their tool functions run. Closes #9172.
New public surface
ToolCallJudgeandToolCallVerdictinpydantic_ai_harness.tool_call_judge
User-visible behavior
Before: a selected tool call runs after argument validation.
After: configure ToolCallJudge with a tool selector and risk question; a yes blocks the call, a no lets it run, and uncertainty blocks by default.
Verification
tests/harness/tool_call_judge/test_tool_call_judge.pytests/harness/tool_call_judge/test_durable_tool_call_judge.py
What changes for existing users
Nothing unless they add ToolCallJudge; calls outside its selector run unchanged.
- Closes #9172
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.