How to Measure Tool-Calling Accuracy in AI Agents
Tool-calling is where capable agents quietly break. An agent can reason well and still pick the wrong function, pass a malformed argument, or plow on after a tool returns an error. Because these failures look plausible, a single "did the task succeed" score hides them. Measuring tool-calling accuracy means scoring each part of the call separately.
Quick answer: Tool-calling accuracy measures whether an agent picks the right tool, passes correct arguments, and recovers from tool errors. Score it deterministically where possible — exact argument match, schema validation, type checks — and reserve an LLM judge for free-form fields. Measure selection, arguments, and error-handling separately, because one pass/fail hides where it breaks.
What is tool-calling accuracy?
Tool-calling accuracy is not one number. It is a set of dimensions, each of which can fail independently:
- Tool selection — did the agent choose the right tool for the request (and avoid calling one it didn't need)?
- Argument correctness — are the arguments valid against the tool's schema, and semantically right for the request?
- Call sequencing — for multi-step tasks, did it call tools in a workable order and pass results forward correctly?
- Error recovery — when a tool returns an error or empty result, does the agent retry, adjust, or abstain rather than fabricate?
Collapsing these into one pass/fail is the most common measurement mistake. Each dimension fails for a different reason and is fixed in a different place, so a single number tells you that the agent broke without telling you where — which is the only part you can act on.
Which failure modes actually matter?
The dangerous failures are the ones that look fine. A call to the correct tool with a subtly wrong argument. A correct first call that the agent never recovers from once the tool errors. An unnecessary call that burns latency and cost. Happy-path testing — where the tool always returns clean data and the request is well-formed — creates false confidence, because production is never that clean. Weight your cases toward the messy paths.
Deterministic checks vs. LLM judges — when to use which?
Prefer determinism. It is faster, cheaper, and reproducible:
- Tool name → exact match against the expected tool.
- Structured arguments → schema validation, type checks, and exact or normalized match.
- Call count → assert the agent didn't make extra or missing calls.
Only reach for an LLM-as-judge where a field is genuinely free-form and
meaning matters more than string equality — for example, a natural-language
query argument where several phrasings are equally correct. Even then, validate
the judge periodically against human labels, because judge drift quietly
corrupts your numbers.
How do you build a golden set for tool calls?
Combine two sources. Mine real production traces for authentic cases and label them, then add synthetic edge cases to cover failure paths you haven't seen yet — ambiguous requests, missing parameters, tools that error, and near-miss arguments. Synthetic generation is fast but clusters around common patterns, so always review generated cases before they enter your official set.
How big should the set be? Big enough for the risk it carries. Volume is only meaningful when scored against a minimum that rises with the deployment's risk tier, which is why a high-risk pack with fifteen cases scores worse than a low-risk one with the same fifteen. Coverage of the failure paths beats raw count. And keep the set out of places it can leak: a tool-calling eval that ends up in public CI logs loses its value once agents are trained on it — see how to tell if your eval is contaminated.
How do you catch regressions in CI?
Treat tool-calling evals like unit tests. Every pull request that touches a prompt, a model version, or a tool schema triggers an eval run against the golden set, and a run that regresses past your threshold does not merge. Track the dimensions separately over time — a drop in error-recovery rate tells you something very different from a drop in tool selection.
Related
- How to eval a tool-calling agent's correctness — what to measure, and how to prove the eval itself discriminates.
- How to tell if your AI eval is contaminated — why leaked cases quietly destroy these numbers.
- Why AI agent evals go stale — keeping this eval trustworthy over time.
- The tool-calling correctness pack — a verified, ready-to-run suite.
- Tool-calling correctness benchmark — discriminating power measured on a real reference panel.
- Capability packs — the full category.
FAQ
It measures whether an agent selects the correct tool, passes valid arguments, sequences calls correctly, and recovers from tool errors — evaluated as separate dimensions rather than a single pass/fail.
Use deterministic checks (exact match, schema validation, type checks) wherever arguments are structured. Reserve an LLM judge only for free-form fields where meaning matters more than exact string equality.
It scales with the risk of the deployment, not a fixed target. Test-case volume should be scored against a minimum that rises with the deployment's risk tier — on the order of ten cases for a low-risk internal helper, several times that for an agent that can move money or change production state. Volume alone is not the point: a small set that covers failure paths (tool errors, ambiguous requests, missing parameters) discriminates far better than a large set of happy-path cases.
Make the tool return an error or an empty result, then score what the agent does next. Correct behavior is to retry with adjusted arguments, fall back to another tool, or tell the user it could not complete the task. The failure to catch is the agent that proceeds as though the call succeeded and fabricates a result from nothing.
Plausible-looking calls that break on edge cases: the right tool with a subtly wrong argument, or a correct call the agent never recovers from when the tool returns an error.
Yes. Treat them like unit tests: gate every pull request that touches a prompt, model version, or tool schema, and block merges that regress past your threshold.
Keep the case set out of public CI logs and blog posts, rotate cases over time, and periodically perturbation-test it: reword the cases without changing the underlying task and confirm the eval still separates a good agent from a broken one. A pack whose verdicts flip on a harmless rewording was keyed to its own wording, not to the capability.