By Sagar Shankaran, Founder of CallSphere
Build an eval loop for Claude agents: harvest failures, grade trajectories with programmatic and LLM judges, and gate releases on quality.
Key takeaways
Every team building Claude agents eventually hits the same wall: they make a prompt tweak that fixes one annoying case and silently breaks five others they never tested. With deterministic software you'd catch that in CI. With agents, most teams have no CI — they eyeball a few examples, declare victory, and ship. The fix is an eval loop: a repeatable, automated way to measure agent quality on a representative set of cases and refuse to release changes that regress it. Evals are what turn agent development from vibes into engineering, and this post is a concrete guide to building one for Claude.
An eval loop is a feedback cycle: you run your agent against a curated dataset of inputs, grade each output against a known standard, aggregate into a score, and use that score to decide whether a change is an improvement. The loop runs every time you touch the prompt, swap a model, add a tool, or change orchestration. Done right, it gives you the same confidence a unit-test suite gives a backend engineer — you can refactor aggressively because the suite will catch what you broke.
The reason this is non-negotiable for agents is that agents have enormous behavioral surface area. A single change to a tool description can shift which tools the model selects across hundreds of scenarios. Without an eval loop, you simply cannot know whether you made things better or worse; you only know about the one case you happened to look at.
Your eval dataset is the heart of the system, and its quality determines everything. The best datasets are not invented — they are harvested. Every time the agent fails in development or production, capture the input, the trajectory, and what the correct behavior should have been, and add it as a case. Over a few weeks you accumulate a dataset that reflects how your agent actually fails, which is far more valuable than a clean set of textbook examples.
flowchart TD
A["New agent change"] --> B["Run on eval dataset"]
B --> C["Grade each case"]
C --> D{"Programmatic check?"}
D -->|Yes| E["Exact / rule grader"]
D -->|No| F["LLM judge grader"]
E --> G["Aggregate score"]
F --> G
G --> H{"Score >= threshold?"}
H -->|Yes| I["Allow release"]
H -->|No| J["Block & show regressions"]Aim for coverage over volume early on. A few dozen cases that span your real intents, edge cases, and known failure modes is worth more than a thousand near-duplicate happy paths. Tag each case by category so you can see where a regression landed, not just that the overall number dropped.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
A grader is the function that turns one agent run into a pass/fail or a score. The art is matching the grader to the case. For anything with a checkable answer — did the agent call issue_refund with the correct amount, did it extract the right date, did the SQL return the expected row — use a programmatic grader. These are fast, free, and perfectly reliable.
For open-ended outputs — a drafted email, a summary, an explanation — you need a judgment call, and the practical tool is an LLM judge: a separate Claude call given the input, the agent's output, and a rubric, asked to score it. Here is a compact judge prompt shape:
JUDGE = """You are grading an AI agent's reply.
Rubric: (1) factually correct vs. the provided context,
(2) actually resolves the user's request, (3) no fabricated details.
Return JSON: {"score": 1-5, "reason": "..."}
User request: {input}
Context: {context}
Agent reply: {output}"""Keep judge rubrics specific and few-dimensional; vague rubrics produce noisy scores. And validate your judge against a handful of human-labeled cases so you trust it before relying on it to gate releases.
A subtle but critical point: for agents, the final answer is not the whole story. An agent can reach a correct answer through a wasteful, risky, or wrong path — calling a destructive tool it shouldn't have, looping ten times, or guessing an argument that happened to be right. Your evals should inspect the trajectory: which tools were called, in what order, with what arguments. Assert that the refund agent never called delete_account, that the lookup took the direct path, that no tool was called with a fabricated ID. Trajectory checks catch the dangerous near-misses that answer-only grading misses entirely.
In practice this means your grader has access to the full list of tool calls and arguments, not just the final text. You write assertions the way you would write security tests: a denylist of tools that must never appear for a given case, an expected sequence for the canonical path, and bounds on how many steps the agent took. When a change causes the agent to start reaching the right answer through a riskier path, these assertions fail loudly and early, before that behavior ever reaches production. That is the difference between an eval that protects you and one that merely flatters you.
The payoff is the gate. Run the full eval on every candidate change in CI, compute the aggregate and per-category scores, and block the release if it falls below your threshold or regresses against the current production baseline. This is the mechanism that lets a team move fast safely: anyone can propose a prompt or tool change, and the eval loop — not a senior engineer's gut feel — decides whether it ships. Surface a clear diff of which cases newly passed and which newly failed so the author knows exactly what their change did.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
One nuance worth planning for: because the agent is probabilistic, a single run can pass or fail by luck. For cases that sit near the boundary, run them a few times and treat the case as passing only if it clears the bar consistently, or track a pass rate rather than a binary. This flakiness is real, and pretending it away leads to a suite that blocks good changes and waves through bad ones. Decide your tolerance for non-determinism up front and bake it into the gate.
| Grader type | Best for | Tradeoff |
|---|---|---|
| Programmatic | Checkable answers, tool calls | Fast and exact, but narrow |
| LLM judge | Open-ended quality | Flexible, but needs validation |
| Trajectory assert | Tool path & safety | Catches near-misses, needs setup |
An eval is an automated test that runs your agent against a fixed dataset of inputs and grades each output against a known standard, producing a score you can compare across versions. It is the agent equivalent of a unit-test suite — the mechanism that tells you objectively whether a change improved or regressed quality.
Begin with a few dozen cases that span your real intents, edge cases, and known failure modes — coverage matters more than volume early on. Grow the set by harvesting every new failure from development and production, which steadily makes the suite reflect how your agent actually breaks.
Use exact or programmatic graders whenever the answer is checkable — a specific tool call, an extracted value, an expected database result — because they are fast and perfectly reliable. Reserve an LLM judge for open-ended outputs like drafts and summaries, and validate that judge against human labels before trusting it to gate releases.
Both. Answer-only grading misses agents that reach a correct result through a dangerous path — calling a destructive tool, looping, or guessing arguments. Add trajectory assertions that verify the tool path and forbid unsafe calls so you catch the near-misses that pure answer checks let through.
The same eval discipline keeps conversational agents trustworthy. CallSphere gates its voice and chat agents on evals so every released change to how they answer, route, and book is measured before it reaches a real caller. Hear the result at callsphere.ai.
Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Why the first four minutes of a 2:14 a.m. hospice call cost real money, and how a 2026 assistant that quotes only your own approved documents shortens them.
Carrier shortlists are built by software before dawn. What makes a 38-truck fleet invisible: stale MCS-150, no lane page, and a phone that stops at 6pm.
Build a 200-case test set from your own janitorial work orders, grade the agent, and widen its authority in stages. Includes the five pass/fail call types.
How a dealership funding clerk starts Tuesday with a sorted exception queue instead of a schedule, and what four fewer days in transit is actually worth.
The truck order and the retail price file cannot be undone. How independent grocers scope an acting AI assistant to everything else without losing control.
Case managers send one referral to eight agencies and families ask assistants to compare. What makes a home health or hospice agency invisible to both.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI