Logo
Overview
Agentic Evals for Production AI Agents

Agentic Evals for Production AI Agents

November 22, 2026
20 min read

Why Production Agents Need Evals

A prompt change can alter which tools an agent calls, which arguments it passes, and what it does when a dependency fails. A model upgrade can do the same thing without changing a line of application code. If either change goes out to production, you need a way to tell which behaviors improved and which regressed.

Take a refund workflow. The normal path is straightforward: verify the customer, check eligibility, and issue the refund. The harder case is a timeout at the payment boundary. The payment service might have already committed the refund. If the agent retries with a new idempotency key, the second call can create another refund while the final reply still looks correct. A unit test for the payment client can verify how the API honors an idempotency key. You also need to know whether the agent reuses that key when recovery is up to it.

Where the key comes from is a design decision with eval consequences. If the tool layer derives it deterministically, for example as a hash of session ID, payment ID, amount, and currency, the model can’t mint a fresh one, and the eval verifies that the derivation holds across retries and restarts. If the model supplies the key as a tool argument, the eval is the only place you will see whether it reuses it under pressure. Either way, the property you care about is end to end: one customer request, at most one refund.


Part 1: From LLM Evals to Agentic Evals

What an LLM eval measures

An LLM eval measures how a model or prompt performs on a defined task. Give it a set of inputs, run the model, and score the outputs against an expected answer or a rubric. For example, you could give a model anonymized support messages and grade whether it extracts the correct order ID. A deterministic check can compare the returned ID against a label. A rubric can grade whether a generated answer is grounded in a supplied policy excerpt.

test input + supplied context → model call → output → grader

This setup can also grade a proposed tool call. Given the order details and refund policy, did the model choose the right tool and produce the expected arguments? That gives you a focused test of one decision. An end-to-end run has to establish whether the system got those order details in the first place, whether they belonged to the caller, and what happened when the tool received the request.

What changes when the model can act

An agentic eval runs the agent’s execution loop against a controlled environment. The agent can call a tool, see the result, and decide what to do next. The initial prompt is only one input to that loop. A tool response can change the rest of the trajectory, and a tool call can leave side effects that outlast it.

user task + seeded state → agent ↔ tools → response, trace, final state → graders

For a tool-using support agent, each artifact answers a different question.

What to gradeEvidenceExample assertion
ResponseCustomer-facing messages and relevant tool resultsThe agent accurately reported the refund status.
TrajectoryTool calls, arguments, results, and their orderThe agent verified ownership before attempting the refund.
OutcomeState read directly from the test environmentExactly one refund was added for the intended payment.

A trace explains how the run reached its outcome. A direct state check verifies the outcome itself. For read-only agents, that distinction may be less important. For agents that write to a database, send messages, or move money, it determines what your tests can catch. Anthropic’s guide to agent evals


Part 2: Anatomy of an Eval Harness

ComponentResponsibility
Eval setDefines the input, initial state, and expected behavior for each case.
RunnerSeeds a fresh environment for each trial, invokes the agent, and collects artifacts.
EnvironmentProvides the tools, test data, and dependency failures the case needs.
TraceCaptures observable actions, tool results, timing, and the final response.
GradersCheck the response, trace, and state and return verdicts with evidence.
AggregationReports results by case and workflow and feeds release gates.

Run the same agent entry point you use in production. Replace its dependencies where you need control, then capture the final state from a source the agent does not control. Record the model, prompt, tool, fixture, and grader versions for each run so you can compare candidates against the same baseline.

The runner owns the trial lifecycle

A case describes a task and the conditions under which it runs. A trial is one execution of that case. One suite with 100 cases and five trials per case produces 500 runs. The runner is responsible for making those trials independent of each other.

case + agent configuration + trial ID
→ seed isolated state and install tool fault rules
→ run agent with scoped tools, credentials, and a deadline
→ stop the run and capture state at a defined completion point
→ persist transcript, tool events, state evidence, and usage
→ grade artifacts and store per-check verdicts
→ tear down or expire the environment

Give each trial its own tenant or database namespace and scope caches, queues, and idempotency records to the same boundary. A transaction rollback only resets writes made inside that transaction. A job the agent enqueued on a shared worker can keep running after rollback and leak into the next trial. If completion depends on a worker, wait for an observable terminal state or an explicit deadline before taking the final snapshot. When the deadline expires, stop or fence outstanding work before reusing resources. A TTL gives you a cleanup path when the runner itself crashes.

Store raw run artifacts and grader verdicts with separate version IDs. You can then regrade an existing trace when you fix a rubric without paying to rerun the agent. If the rubric needs evidence the runner never captured, regenerate the affected trials. A manifest should also include the agent build, model settings, tool schema revision, fixture digest, judge model and rubric revision, and execution budgets. Pinning inputs keeps comparisons interpretable even when the provider produces different samples on each run.

Give the runner separate concurrency limits for agent calls, judge calls, and shared sandbox dependencies. Record queue time separately from execution time. If two variants run at different loads, a difference in p95 latency can reflect harness saturation. Alternate baseline and candidate trials across the run when shared services vary over time.

Instrument the tool boundary

Capture events in the application or tool gateway, where calls and results actually happen. For a write, record the trial ID, call ID, tool name, sanitized target, operation identifier, timestamps, and status. For concurrent calls, record the causal links you need to reconstruct prerequisites. A sorted list of spans is useful for debugging, but start order alone cannot prove that one call completed before another began.

For the ownership check, require successful verification for the same caller and payment before the write starts. A lookup of a different payment, a failed verification, and a check that is still running are three different ways a naive trace.includes('verify_owner') assertion can pass incorrectly. Where possible, emit an authorization decision at the capability boundary so the assertion can use that event directly.

A minimal event schema and a happens-before check look like this:

type ToolEvent = {
trialId: string
callId: string
parentCallId?: string // causal link for nested or fan-out calls
tool: string
callerId: string
target: { paymentId?: string }
startedAt: bigint // process.hrtime.bigint() in the gateway
endedAt?: bigint // undefined while the call is in flight
status: 'ok' | 'error' | 'denied'
}
function everyRefundWasPreVerified(
events: ToolEvent[],
callerId: string,
paymentId: string,
): boolean {
const writes = events.filter(
e => e.tool === 'issue_refund' && e.target.paymentId === paymentId,
)
return writes.every(write =>
events.some(
v =>
v.tool === 'verify_owner' &&
v.callerId === callerId &&
v.target.paymentId === paymentId &&
v.status === 'ok' &&
v.endedAt !== undefined &&
v.endedAt <= write.startedAt,
),
)
}

Comparing endedAt to startedAt is only valid when both come from the same monotonic clock, which is one reason to emit events from a single gateway process. Across services, propagate a causal ID (a trace context or the verification’s callId passed into the write) and assert on that link instead of on wall-clock time. Note that every on an empty list returns true: this check says nothing about whether a refund happened. That is the state assertion’s job.

Choose the environment by failure mode

EnvironmentWhat it buys you
Stateful fakeFast, repeatable control over failures such as a write that commits before a timeout.
Recorded responsesRealistic payloads for read-heavy tools, with replayable inputs and outputs.
Sandbox integrationCoverage for live contracts and behavior such as authentication, persistence, and idempotency.

A replay can return a recorded success response while the current implementation would fail to write anything. Use a stateful environment for cases that assert side effects. Keep the fast suite on controlled dependencies and exercise critical contracts against a sandbox on a schedule or before release.

Replay should fail explicitly on an unexpected call. Matching on tool name alone can hand the agent a valid-looking response for the wrong record. Match the arguments that determine behavior and normalize incidental values such as request IDs. For repeated calls with identical arguments, define which recorded result applies on each attempt. A retry that receives the original timeout forever is a different case from a retry that recovers.


Part 3: Test Cases, State Transitions, and Fault Injection

A useful eval case specifies what the agent receives, what already exists, and what must be true when the run ends. Here is a fixture for an ambiguous payment timeout:

id: refund-timeout-after-commit
input: "Refund order 4812."
initial_state:
order_id: "4812"
payment_id: "pay_4812"
owned_by_current_user: true
refund_eligible: true
refunds: []
fault: commit_first_refund_then_timeout
expected:
refund_count_delta: 1
payment_id: "pay_4812"
amount_cents: 4900
currency: USD

The injected fault matters. A timeout before the write and a timeout after the write look the same to the caller, but the second already changed state. A test that only throws from the tool before it writes cannot exercise post-commit recovery.

The following in-memory fake makes that ordering explicit. Create a new instance per trial. As in most payment APIs, the idempotency key identifies the operation, and reusing a key with different parameters is a conflict rather than a silent replay.

type RefundRequest = {
paymentId: string
amountCents: number
currency: string
idempotencyKey: string
}
function createRefundFake() {
const ledger = new Map<string, RefundRequest>()
let injectTimeout = true
return {
refund(request: RefundRequest) {
const existing = ledger.get(request.idempotencyKey)
if (existing) {
if (
existing.paymentId !== request.paymentId ||
existing.amountCents !== request.amountCents ||
existing.currency !== request.currency
) {
throw new Error('409: idempotency key reused with different parameters')
}
return { status: 'initiated', ...existing }
}
// Commit first, then fail: the caller can't tell this from a pre-write timeout.
ledger.set(request.idempotencyKey, { ...request })
if (injectTimeout) {
injectTimeout = false
throw new Error('Timeout waiting for the payment service response')
}
return { status: 'initiated', ...request }
},
snapshot: () => Array.from(ledger.values(), refund => ({ ...refund })),
}
}

A retry with the original key returns the recorded refund. A new key adds a second ledger entry. This fake exercises the recovery contract in a single process. A sandbox test with concurrent requests is where you verify that the real backing service enforces the contract atomically.

The core assertion can run as ordinary TypeScript. In this example, refundsAddedSince reads the complete set of additions across the isolated ledger and projects them onto the fields shown below.

const env = await createTestEnvironment(testCase)
const before = await env.ledger.snapshot()
const run = await agent.run(testCase.input, { tools: env.tools })
const addedRefunds = await env.ledger.refundsAddedSince(before)
expect(addedRefunds).toEqual([
{ paymentId: 'pay_4812', amountCents: 4900, currency: 'USD' },
])

The assertion catches missing refunds, duplicate additions, and additions against the wrong payment. The trace in run provides the tool calls needed to diagnose the failure. If the workflow can edit or delete existing records, assert the full relevant state diff. For transient side effects such as sending an email that cannot be undone, check the delivery log too.

A status lookup and a retry with the original idempotency key can both satisfy the outcome. Choose which actions to constrain based on policy. For an order owned by another customer, you may need two independent checks: the ledger stayed unchanged and the agent never attempted the write. The first tells you whether the backend protected the resource. The second tells you whether the agent acted within its authorization policy.

Build a dataset that exposes regressions

Use a small case matrix to cover each workflow’s distinct branches. For refunds, vary eligibility, identity, payment status, and dependency behavior. Cases for an already-refunded order, a timeout before a write, and a timeout after a write each verify a different invariant. Vary user phrasing when it changes how the agent resolves intent. Fifty paraphrases of the same request give you a lot of trials on one behavior.

Give every case a stable ID and tags for workflow, failure mode, and severity. Keep development cases, a holdout set, and high-risk regression cases versioned. When a fixture changes, rerun both agent versions on the new fixture before comparing scores. Public benchmarks can help compare broad capabilities. The cases that exercise your product’s actual policies and tool semantics are what give you a release signal.


Part 4: Grade State, Tool Use, and Responses

Code-based checks work well for quantities, forbidden actions, timing budgets, and ordering constraints. Given the same artifacts, the check returns the same result, which makes failures cheap to reproduce.

LLM judges are useful for criteria that involve interpreting language. A narrow rubric for the refund example could ask whether the final response claimed the money had arrived when the tool only confirmed initiation. Give the judge the relevant tool result and ask it to return a verdict with the message or trace evidence behind it.

Human review calibrates those verdicts. Label clear passes, clear failures, and borderline cases. Inspect where the judge disagrees with those labels before giving it a release threshold. Treat a grader error as an incomplete evaluation and surface it in the run report.

Give every verdict a stable contract

Store the check ID, verdict, severity, and evidence references. That lets a dashboard group failures by check even as you update the explanation shown to a reviewer. For the refund status rubric, a verdict could look like this:

{
"checkId": "response.does_not_overstate_refund_status",
"verdict": "fail",
"evidence": ["message:7", "tool-result:refund-2"],
"reason": "The response said the funds had arrived. The tool reported initiation."
}

Give the judge explicit criteria for pass, fail, and insufficient evidence. Validate the response schema and check that cited IDs exist in the supplied artifacts. A valid citation still needs to support the verdict, which is one of the things to check during human review. Treat transcript text as data in the judge prompt, including messages that ask the judge to change its score. A missing tool result can leave the status check ungradable. An available tool result that contradicts the reply is a failure. Make that distinction visible in the aggregate.

Measure judge agreement on a labeled sample and inspect false passes and false fails separately. If only 5% of your calibration examples are true failures, a judge that always passes gets 95% agreement and catches zero defects. Track failure recall and review the errors for each critical criterion. Keep deterministic policy checks authoritative even when the language grader passes.

A worked example: 200 human-labeled traces, 20 of them true failures. The judge flags 14 of the 20 failures and wrongly flags 9 of the 180 passes.

Human: failHuman: pass
Judge: fail149
Judge: pass6171

Raw agreement is 92.5%, which sounds fine. Failure recall is 70%: the judge misses three in ten real defects. Cohen’s kappa corrects agreement for what you’d get by chance given each rater’s base rates:

κ=po−pe1−pe,pe=23⋅20+177⋅1802002=0.808,κ=0.925−0.8080.192≈0.61\kappa = \frac{p_o - p_e}{1 - p_e}, \quad p_e = \frac{23 \cdot 20 + 177 \cdot 180}{200^2} = 0.808, \quad \kappa = \frac{0.925 - 0.808}{0.192} \approx 0.61

Once you know the judge’s true-positive rate (TPR) and false-positive rate (FPR) on failures, you can also correct the failure rate it reports on unlabeled traffic. If the judge flags a fraction p^\hat{p} of traces, the estimated true failure rate is

p=p^−FPRTPR−FPRp = \frac{\hat{p} - \text{FPR}}{\text{TPR} - \text{FPR}}

With TPR=0.70\text{TPR} = 0.70 and FPR=0.05\text{FPR} = 0.05, a judge that flags 12% of traces implies a true failure rate near 10.8%. This only holds while the traffic resembles the calibration set, so recalibrate when the agent, the rubric, or the judge model changes.

Evaluate conversations at the task boundary

Multi-turn cases use the same structure with a user script or simulator. A script can disclose the intended order only after the agent asks for clarification. A simulator can vary phrasing or answers across trials. Give it a fixed goal, a fact sheet, and conditions for revealing each fact. Otherwise it can invent an order number or volunteer the answer in the first turn, and your clarification test silently becomes a lookup test.

End the trial on completion, escalation, or an explicit turn limit. Inspect samples for simulator drift and grade the result against the original fixture. A simulated user’s “thanks, that worked” is evidence about the conversation. The state check still determines whether the requested operation happened.


Part 5: Measure Reliability Across Repeated Trials

Even with a fixed fixture, different runs can take different paths. Reset the environment for every trial, and run the baseline and candidate on the same cases. Keep the grader and fixture versions fixed for that comparison.

CaseSuccessful trialsPassed all fourPassed at least once
Ordinary refund4/4YesYes
Timeout after commit3/4NoYes
Suite result7/81/22/2

The trial pass rate is 87.5%. With four trials per case, the observed pass^4 is 50%, and pass@4 is 100%. The first estimates how often all four attempts succeed on the same case. The second estimates how often at least one succeeds. Use pass@k when the system can try multiple times safely and reliably verify or select a successful result. It describes a different operating mode from an agent that gets one attempt per customer. τ-bench paper

If you run nn trials per case and observe cc successes, estimate both metrics for any k≤nk \le n from the fraction of size-kk subsets that meet the criterion, then average across cases:

pass@k=1−(n−ck)(nk),passk=(ck)(nk)\text{pass@}k = 1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}, \qquad \text{pass}^k = \frac{\binom{c}{k}}{\binom{n}{k}}

Both are unbiased, unlike computing 1−(1−p^)k1 - (1 - \hat{p})^k or p^k\hat{p}^k from the per-case success rate p^\hat{p}. Chen et al., 2021

function choose(n: number, k: number): number {
if (k < 0 || k > n) return 0
let result = 1
for (let i = 1; i <= k; i++) result = (result * (n - k + i)) / i
return result
}
const passAtK = (n: number, c: number, k: number) =>
1 - choose(n - c, k) / choose(n, k)
const passHatK = (n: number, c: number, k: number) =>
choose(c, k) / choose(n, k)
// Timeout-after-commit case: n = 4, c = 3
passAtK(4, 3, 4) // 1
passHatK(4, 3, 4) // 0
passHatK(4, 3, 2) // 0.5

pass^k falls quickly as kk grows: a case with a 90% per-trial success rate has pass^8 near 43%. That decay is the point. It shows how a small per-trial failure rate turns into frequent failures for users who come back to the same workflow repeatedly.

Compare versions by case

Report numerators and denominators. With uneven trial counts, the pooled pass rate gives more weight to cases with more completed trials. Averaging per-case rates gives each case equal weight. Use production traffic weights only if you are estimating traffic-wide quality and have representative cases within each slice. A high-risk suite that intentionally overrepresents unusual failures should be interpreted on its own terms.

For a baseline comparison, compute the candidate-minus-baseline score on every case. To estimate uncertainty over the case mix, resample whole cases with replacement and keep both versions’ results together in each draw. Recompute the mean difference for each draw and use the resulting distribution to report an interval. If multiple cases derive from the same original incident, use the incident as the resampling unit. The interval depends on how representative those groups are. Running the same ten fixtures a hundred times each tells you more about stochastic variation on those fixtures and little about workflows they never exercised. Paired bootstrap method

type CaseResult = {
caseId: string
incidentId: string // resampling unit
baseline: number // per-case pass rate
candidate: number
}
function pairedBootstrapCI(
results: CaseResult[],
draws = 10_000,
rng: () => number, // seeded, so the report is reproducible
): [number, number] {
const clusters = [...Map.groupBy(results, r => r.incidentId).values()]
const deltas: number[] = []
for (let d = 0; d < draws; d++) {
let sum = 0
let count = 0
for (let i = 0; i < clusters.length; i++) {
const cluster = clusters[Math.floor(rng() * clusters.length)]
for (const r of cluster) {
sum += r.candidate - r.baseline
count++
}
}
deltas.push(sum / count)
}
deltas.sort((a, b) => a - b)
return [deltas[Math.floor(0.025 * draws)], deltas[Math.floor(0.975 * draws)]]
}

The pairing is what makes this efficient. Case difficulty varies far more than the difference between two nearby builds, and subtracting within a case cancels most of that variance. The more strongly baseline and candidate scores correlate across cases, the more an unpaired comparison of two suite-level pass rates overstates the uncertainty.

Report incomplete runs explicitly. An injected tool timeout is part of the case, while a runner that cannot seed the test database never exercised the agent. An agent exceeding its configured turn budget is an agent failure. A missing grader verdict is an evaluation error. If you retry infrastructure errors, keep the original attempt and report how many cases were affected. Selective retries after observed agent failures inflate the measured pass rate.


Part 6: Run Evals in CI and Production

  • On each change, run a small suite covering core workflows, policy boundaries, and known regressions.
  • Nightly or before release, run the full suite with repeated trials. Compare against the production configuration by workflow, and gate on critical failures such as unauthorized or duplicate writes. Report p95 latency and cost per resolved task alongside quality.
  • In production, sample traces and look for patterns such as tool errors, escalations, or repeat contacts. Turn confirmed failures into sanitized offline fixtures. Keep a versioned holdout set for evaluating changes you tuned against the development suite.

Make the release policy explicit

Suppose a candidate improves overall task success by three percentage points, but one of its 120 critical trials writes a duplicate refund. A gate that averages all checks together can approve that build. A gate with a hard invariant for duplicate writes blocks it. The overall metric is useful for comparing quality within the set of builds that satisfy the invariant.

GateExample policy
Critical invariantsNo observed unauthorized or duplicate writes in the required release suite.
Quality by workflowFor each priority workflow, the lower bound on the paired success-rate delta must clear the agreed regression margin.
Performancep95 task latency stays within budget under comparable load. Include agent retries in the measured request.
CostTotal agent execution cost over all attempts divided by resolved tasks stays within budget. Report eval judge cost separately.
Eval healthRequired cases complete and have valid verdicts. If critical evidence is missing, mark the gate inconclusive.

Zero observed critical failures is a release check, not a proof. If nn independent trials produce zero failures, the one-sided 95% upper bound on the per-trial failure rate is 1−0.051/n≈3/n1 - 0.05^{1/n} \approx 3/n (the rule of three). For the 120 critical trials above, a clean run still allows a failure rate of up to about 2.5%. Bounding it below 0.1% takes roughly 3,000 clean trials, and repeated trials of the same case are correlated, so the effective nn is smaller than the raw count. Continue to enforce safeguards in the application and measure real-world incidents. For online evals, record the sampling policy with the results. A sample enriched for escalations is effective for finding failure modes. A representative sample serves a different purpose, estimating how often those failures occur across traffic. Check the two populations separately so that a change in sampling doesn’t look like a change in agent quality.

Start with a workflow where you can query the resulting state independently. Once the harness can reproduce a failure and identify the assertion it violated, you have a regression test you can run against every subsequent prompt, model, and tool change.


Further Reading

  • Fault injection. TigerBeetle explains how its simulator inspects replica state to catch safety and liveness violations that a black-box test can miss. Protocol-Aware Deterministic Simulation Testing
  • Idempotency and retries. The Amazon Builders’ Library covers caller-provided request IDs, late arrivals, and how to handle the same key arriving with different arguments. Making retries safe with idempotent APIs
  • Judge calibration. Hamel Husain walks through labeling examples with a domain expert, measuring agreement on unseen traces, and diagnosing where the judge fails. Using LLM-as-a-Judge For Evaluation
  • Multi-turn user simulation. Sierra’s benchmark lets both the simulated user and the agent act on shared state, so it can test whether the agent successfully guides the user through an action. τ²-bench
  • Statistical comparison. Uber Engineering explains how it handles ratio metrics, estimates uncertainty with bootstrap methods, and reduces variance in online experiments. Under the Hood of Uber’s Experimentation Platform
  • Production release gates. Netflix describes how Kayenta compares canary and baseline metrics and turns those comparisons into rollout decisions. Automated Canary Analysis at Netflix with Kayenta