By Sagar Shankaran, Founder of CallSphere
Build an eval loop for self-hosted Claude managed agents: trajectory and outcome metrics, LLM-as-judge graders, golden datasets, and CI release gates.
Key takeaways
You can't safely ship changes to a managed agent on vibes. Tweak a tool description, swap Sonnet for Opus, add a new MCP server, and the agent's behavior shifts in ways no single manual test will catch. Autonomous agents fail probabilistically and at the trajectory level — they reach the right answer the wrong way, or the wrong answer through a plausible-looking path — so the only honest way to know whether a change helped is to measure it across many cases. That measurement loop is an eval suite, and for managed agents it has to grade not just final answers but how the agent got there.
This post shows how to build an eval loop for self-hosted Claude agents: what to measure, how to grade it, how to assemble a golden dataset, and how to wire the whole thing into a release gate so a regression blocks the deploy instead of reaching production. The aim is a number you trust enough to ship on.
An eval is only as useful as its definition of success, so start by writing it down per task type. For a data-lookup agent, success might be: correct answer, used the read tool (not a hallucination), under N turns, no destructive calls. For a code-fixing agent: tests pass, diff is minimal, no unrelated files touched. Notice these are outcome metrics (was the result correct?) and trajectory metrics (was the path sound?). Managed agents need both, because an agent that guesses the right answer without checking the source is one prompt change away from guessing wrong.
An eval is, in short, a repeatable measurement of agent quality against a fixed dataset with explicit success criteria. If you can't state the criteria for a task, you can't grade it — so writing them is the real work.
Match the grader to the question. Deterministic graders — exact match, regex, JSON-schema checks, "did the test suite pass" — are fast, free, and unambiguous; use them whenever the correct answer is well-defined. Code assertions on the trajectory check structural facts: did the agent call get_invoice before issue_refund? did it stay under the turn limit? did it avoid the delete_* tools? LLM-as-judge handles the open-ended cases — was the explanation clear and correct, was the tone appropriate — where there's no single right string. Use Claude itself as the judge with a precise rubric, and validate the judge against human labels on a sample so you trust its scores.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
# trajectory assertion (pseudocode)
assert tool_calls_in_order(traj, ["get_invoice", "issue_refund"])
assert max_turns(traj) <= 8
assert no_tool_used(traj, prefix="delete_")
assert final_answer_matches(case.expected)
Mix graders within one suite: deterministic where you can, judge where you must. The deterministic checks catch hard regressions cheaply; the judge catches quality drift the assertions miss.
flowchart TD
A["Change: prompt / tool / model"] --> B["Run agent over golden dataset"]
B --> C["Grade each case"]
C --> D["Deterministic + assertions"]
C --> E["LLM-as-judge for open-ended"]
D --> F{"Pass rate >= threshold?"}
E --> F
F -->|No| G["Fail CI, block deploy"]
F -->|Yes| H["Ship + log scores as baseline"]
The branch at F is the entire point: the eval score becomes a gate. A change that drops pass rate below your bar fails the build the same way a unit test would. Without that gate, evals are just dashboards you'll eventually stop reading.
Your dataset is the foundation, and the best source is real traffic. Sample actual tasks the agent has handled, label the correct outcome, and include the messy ones — ambiguous requests, edge cases, the inputs that previously broke things. Crucially, every production bug becomes a permanent eval case: when you fix a loop or a wrong-tool incident, capture that exact scenario so the suite catches any regression forever. Aim for coverage across task types and difficulty rather than a huge undifferentiated pile; a focused set of 50–150 well-chosen cases that spans your real failure modes beats thousands of near-duplicate easy ones.
Refresh the set as your agent's job evolves. New tools, new task types, and new edge cases all need representation, or your eval score will drift away from reality and stop predicting production behavior.
Quality isn't the only axis that can regress. A prompt change that nudges accuracy up two points while tripling token cost and doubling latency is usually a bad trade. Record per-case tokens and wall-clock time alongside the pass/fail and surface all three in the eval report. Then your release gate can enforce a budget: ship only if quality holds and cost and latency stay within bounds. This is how you avoid the slow drift where each "improvement" makes the agent a little more expensive until the economics stop working.
An eval that runs manually runs rarely. Wire the suite into your pipeline so it executes on every change to a prompt, tool definition, model choice, or MCP server. Use the Message Batches API for the run so a large dataset evaluates cheaply and in parallel, post the scores as a status check, and block merge on a failing gate. Store each run's results so you can see trends and diff two runs to find exactly which cases a change broke — that diff is often the fastest path to understanding a regression.
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.
| Question | Grader | Cost |
|---|---|---|
| Is the answer exactly correct? | Exact match / regex | Free |
| Did tests pass / schema hold? | Deterministic check | Free |
| Right tools, right order, turn limit? | Trajectory assertions | Free |
| Was the explanation clear & sound? | LLM-as-judge (rubric) | Low per case |
An agent eval is a repeatable measurement of agent quality against a fixed golden dataset using explicit success criteria. For managed agents it grades both the outcome (was the result correct?) and the trajectory (were the right tools used, in the right order, within limits?). The result is a score you can track over time and gate releases on.
Coverage matters more than size. A focused set of 50–150 cases spanning your real task types, difficulty levels, edge cases, and past failures is usually more useful than thousands of near-duplicate easy ones. Grow it deliberately: every production bug should become a permanent case so the suite catches regressions forever.
Only after calibrating it. Write a precise rubric, then check the judge's scores against human labels on a sample to confirm they agree. Use deterministic graders wherever the answer is well-defined and reserve LLM-as-judge for open-ended quality. Re-validate the judge if you change the rubric or the underlying model.
Make it a CI gate. Run the suite on every change to a prompt, tool, model, or MCP server; block merge if the pass rate falls below threshold or if cost and latency exceed budget. Store results to diff runs and find exactly which cases a change broke. That turns evals from a dashboard into a guardrail.
CallSphere runs the same eval discipline — trajectory grading, golden datasets, and release gates — behind voice and chat agents, so every change to how they answer calls and book work is measured before it ships. See it live 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.
Anthropic's Claude Fable 5 and Mythos 5 explained: pricing, availability, frontier benchmarks, the dual-model safeguard architecture, and what they mean for AI agents.
Where Claude Code, MCP, and multi-agent systems are taking GTM engineering next, and how to prepare your team now for standing and multi-agent workflows.
Where Claude Cowork and the Claude agent ecosystem are heading next — standing agents, MCP, skills as a moat — and the concrete moves to prepare your team now.
The metrics, leading signals, and anti-metrics that prove Claude Cowork is working — acceptance rate, time-to-outcome, and why usage counts mislead.
Shipping an agentic GTM workflow is easy; proving it works is hard. The metrics, signals, and eval loops that show a Claude Code rebuild is paying off.
A realistic end-to-end Claude Cowork use case: a quarterly vendor-spend review from vague ask to shipped deliverable, with every agentic step shown.
© 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