A refund agent can pay the same customer twice and still produce a flawless transcript. If the payment gateway takes 31 seconds to answer and the agent’s HTTP client gives up at 30, the agent retries a call that has already gone through. The transcript quotes the 30-day policy, confirms the order date and tells the customer the refund is on its way.
Every grader that reads that transcript scores it a pass. The payment ledger shows two refunds against one order, and nothing in the eval suite ever looked at the ledger. An agent with write access should be judged by the records it leaves behind. Most eval suites grade only the words it says on the way there.
The fix is a different unit of evidence. A state-change eval seeds a sandbox, lets the agent act, then diffs the records field by field against an end state written before the run. It checks the tool path that produced that end state and repeats the run under the failures production will deliver. The rest of this piece is how to build one, what to put in front of the people who approve the release, and where these programs break.
What a transcript grade cannot see
A transcript is the agent’s account of what it did. The system of record is what it did. For a read-only assistant the two are close enough, since the answer is the product. For an agent that issues refunds, updates a CRM or closes tickets, the write is the product.
Offline evaluation hides that difference. The Survey on Evaluation of LLM-based Agents separates static environments, where an agent predicts the next action against cached pages or offline traces, from interactive ones, where its actions change a live or simulated world. Static setups scale cheaply. They also miss cascading errors, because a wrong action has no downstream consequence for the next step to trip over.
Production is an interactive environment with real money in it. Hugging Face’s guide to building an agentic evaluation describes the shape that follows from this. A task runs inside a pinned environment, the evaluation runner executes several rollouts per task, and a verifier grades the environment’s final state, with the trace kept as evidence.
Agent benchmarks keep showing the same pattern. Models that look strong on single-turn tests complete multi-step tasks far less reliably, and the failures land in the systems the agent touched: a wrong field, a duplicate action, a skipped policy check. A fluent final message can sit on top of every one of them.
The state-change rubric
The scorecard below is the starting artifact for an agent eval. It names six layers, how each one is checked, and the single failure in each layer that blocks a release regardless of the aggregate score.
| Layer | What it checks | How it is checked | Blocking failure |
|---|---|---|---|
| Answer | Facts and policy stated to the user | Rubric graded by a calibrated model, sampled by people | A policy the agent invented |
| Path | Tool choice, arguments, order and retries | Deterministic checks on the tool-call log | A write tool called with the wrong account ID |
| Permission | Every call inside the agent’s granted scope | Tool calls compared to the scope list | Any call outside scope, even if it failed |
| State | Records created, changed and left alone | Field-level diff against the expected end state | An unexpected write or a repeated irreversible action |
| Stability | The same decision across repeated runs | Each case run k times | A decision that flips between runs |
| Escalation | A handoff when the case needs a person | Labeled cases that require review | Action taken on a case that needed review |
The answer layer is the only one most teams already have. The other five are where agents with write access fail, and four of them can be checked with plain code against logs and database rows. That matters for cost and for trust, since a deterministic check gives the same verdict every time.
One rule falls out of the table. An agent gets write access to a system only after its end-state diffs pass on a seeded copy of that system. Everything below is how to make that rule enforceable.
A failure taxonomy that drives the gate
The rubric needs a taxonomy of failures underneath it, written per agent before any test exists. For the refund agent it has five classes.
An answer error states a wrong fact. A policy error applies the right policy to the wrong case. A permission error touches a system or record outside scope. A tool error picks the wrong function or passes wrong arguments, and a state error leaves the ledger, order or ticket in the wrong condition.
Each class carries a different cost. A late approval of a valid refund is a service problem, an approval of an invalid one is a financial control problem, and a duplicate refund is cash out the door. One quality score averaged across all three tells a release owner nothing. The taxonomy lets the report say which class moved.
Write the taxonomy with the product owner and whoever owns the risk. Engineering then turns each class into checks. When a launch meeting starts debating whether a wording slip matters, the taxonomy has already answered, and the duplicate refund sits in the blocking column.
Verify the state the agent changed
A state-change eval has four parts. A seeded sandbox gives every run the same starting records. The agent runs the task with the same tools and credentials scope it will hold in production. A recorder captures every tool call with its arguments and responses, and a verifier compares the final records with an expected end state.
Click to expand The sandbox has to be a real copy of the system’s behavior. A mock that returns success for every call teaches the agent nothing and tests nothing. Use the vendor’s test mode where one exists, such as a payment provider’s test keys, or a containerized copy of your own service with its real schema and constraints.
Seed the sandbox from a versioned fixture. Accounts, orders, invoices, tickets, permissions and policy flags load from a file with a version number, and every eval result records that version. Without it, a score change cannot be traced to the agent or to the data.
Write the expected diff before the run
The expected end state is written by a person before the agent runs, from the business rule. Writing it after the run invites the reviewer to accept whatever the agent did as correct. A case file for a final-sale refund request looks like this.
case: refund-028-final-sale
seed: fixtures/refunds/v14
expect:
payments.refunds:
created: 0
tickets.T-4471:
status: escalated
assignee_group: billing-review
orders.O-88120:
unchanged: true
forbid_tools:
- issue_refund
- admin_update_order
allow_other_writes: false
The verifier snapshots every table or object the agent can reach before and after the run. It reports missing changes, extra changes, wrong values, writes to the wrong object and writes outside scope. The line allow_other_writes: false does a lot of work, since many state failures are a correct primary write plus a stray secondary one.
Keep the diff at field level and ignore fields that are noise, such as updated_at or generated IDs. Match on the fields a person downstream relies on. For a CRM case that is the account, owner, stage, amount, next step and note text. For a refund it is the amount, reason code, linked order and the count of refund objects.
Check the path as well as the destination
A correct end state can hide a dangerous route. An agent that finds the right customer through an unrestricted admin search, or updates a record with a stale copy it read ten minutes earlier, can land in the right place on this run and the wrong one on the next. The path layer catches that before production does.
Path checks are assertions on the tool-call log. The verifier confirms the function name, the account or tenant ID, the required fields, and that optional fields stay inside an allowed set. It confirms the number of write calls and the order of reads and writes, so a write that depends on a lookup comes after that lookup.
Keep these assertions narrow. Anthropic’s guide to agent evals warns that grading an exact sequence of tool calls makes tests brittle, because agents find valid routes the designer did not anticipate. Assert the constraints that protect the business, such as scope, the right record ID and reads before dependent writes, and leave the rest of the route free.
Permission checks sit beside them. List the tools and scopes the agent is meant to hold, then fail any case where the log shows a call outside that list. Count attempts as well as successes. An agent that tried to call an admin endpoint and was refused by the API has still shown what it will do once someone widens its credentials.
Inject the failures production will deliver
The opening scene is a retry problem, and only a fault-injecting sandbox reproduces it. Put a proxy between the agent and its tools that can delay a response past the client timeout after the write has committed, return a 500 after a partial write, return the same response twice, or drop a connection mid-call. Then check the end state.
The correct behavior under an uncertain write is to read the record before acting again. For payments, the second line of defense is an idempotency key. Stripe’s API, for example, accepts an Idempotency-Key header and returns the original result when a request repeats with the same key. The eval should assert that every irreversible call carries a key derived from the task, so a retry cannot create a second refund.
Irreversible actions get the strictest gate. Payments, deletions, access grants, contract changes and external messages start in approval mode, where the agent proposes and a person commits. The gate for removing approval is zero duplicate or unauthorized irreversible actions across the fault-injection cases.
Run every case more than once
One clean run proves the agent can succeed. It says nothing about how often it succeeds. Sampling temperature, retrieval ordering, tool latency and model updates all move behavior between runs of identical inputs, and a production agent sees each kind of case thousands of times.
The τ-bench work from Sierra introduced pass^k for this, the probability that an agent succeeds on all k independent runs of the same task. It falls quickly as k grows, and that drop is the reliability problem in a single number. Report pass^k beside pass@1 for every high-risk case, with k set by how often the case occurs in production.
Arithmetic makes the cost plain. If runs were independent, an agent that succeeds on a case 90% of the time would clear five straight runs only about 59% of the time, since 0.9 to the fifth power is 0.59. A refund agent that handles a given case type 200 times a day at 90% leaves around 20 wrong outcomes a day for someone to find. That is the number a release owner needs to see, and pass@1 hides it.
τ-bench measures this with pass^k, the share of tasks an agent completes on every one of k repeated runs. In its results, success across eight repeated runs falls far below single-run success, so a passing demo says little about the next hundred runs.
Track variance in the decision. Different wording across runs is fine. A claims agent that approves on one run and escalates on the next is a blocking failure, even if both runs pass the rubric on their own, because a customer receives one of the two at random.
Repeated runs also expose ordering bugs. When retrieval returns policy documents in a different order, some agents follow whichever version appears first. When a tool is slow, some agents give up and answer from memory. Both show up only across runs.
Grade the graders
Most suites mix deterministic checks with a model grading the answer layer against the rubric. The model grader is fast and cheap, and it is also a component with its own error rate. Treat it like one.
Build a small labeled set for the grader itself before it touches a release decision. Include known failures, such as a missing citation, a wrong tool call described in fluent prose, a policy exception approved with confident language, and a transcript that claims a write the ledger does not show. If the grader passes those, it cannot guard the gate.
Then calibrate the people who label that set. Give two or three reviewers the same 30 cases, compare their labels, and rewrite any rubric line they disagree on. Without calibration, a score moves when the reviewer changes as much as when the agent does.
Aggregation needs the same scrutiny. The Messier corpus, which pools more than 900,000 records across 30 agent benchmarks, found that reported performance can be highly sensitive to how verifier results are aggregated. Decide whether a case with three verifiers passes on all three or on a majority, write that rule down, and keep it fixed across releases.
The same corpus found enterprise workflows to be the hardest category for current agents, while function-calling evaluations are largely saturated. A suite that leans on clean single-call tests will report high scores for an agent that still fails multi-step business work.
Use evals as release gates
Every material change runs the full suite before it reaches production. That covers the model, the prompt, the tool schema, the retrieval index, the policy rules and the agent scaffold, meaning the loop code that wraps the model and its tools. The scaffold belongs on that list because the General Agent Evaluation study from IBM Research found that agent architecture alone moved results by up to 12 percentage points with the model held constant.
Click to expand The gate reads blocking failures first and thresholds second. Any case in a blocking class stops the release, whatever the aggregate. Only then do the thresholds for policy compliance, end-state accuracy, latency and cost apply.
A one-page release report is enough. The template below uses illustrative numbers for a refund agent.
| Measure | Threshold | Result | Decision |
|---|---|---|---|
| Policy compliance | 95% | 96.4% | Pass |
| Calls inside permission scope | 100% | 100% | Pass |
| Correct end-state diffs | 99% | 97.8% | Block |
| Duplicate refunds under fault injection | 0 | 1 | Block |
| Decision flips across 5 runs | 0 | 0 | Pass |
| Missed escalations | 2% | 3.7% | Block |
| Median latency | 4 s | 3.2 s | Pass |
| Cost per successful task | $0.08 | $0.06 | Pass |
The team reading that report has a short work list. Add idempotency to the refund call, tighten the escalation rule, fix the end-state errors, then rerun the same suite against the same thresholds. The aggregate score never enters the conversation.
Each report links to the suite version, fixture version, model version, prompt version, tool schema and scaffold commit. When an incident happens three months later, that record shows what was tested and what was not. Cost per successful task includes retries and failed attempts, since a cheap attempt that runs four times is an expensive task.
The output of a passing gate is scoped access. The agent receives the actions it passed and nothing else, and actions that failed or were never tested stay in approval mode. Record that scope in the SLA that governs its production write access, so it widens only through the same gate.
Where state-change evals go wrong
The sandbox drifts from production. Someone adds a required field or a new validation rule in the live system and nobody updates the fixtures. The suite passes and the first production run fails on a constraint the sandbox never had. Regenerate fixtures from the production schema on every schema migration and fail the suite when they differ.
The expected diffs are written from the agent’s output. A reviewer runs the agent, looks at what it changed and saves that as the expectation. The suite then tests that the agent repeats itself. Expected states come from the business rule, written by someone who has not seen the run.
Mocks replace the hard parts. Tools that always succeed remove timeouts, partial writes and rate limits, which are where duplicate actions come from. Keep at least the irreversible tools on a real test-mode backend with fault injection.
The suite grows without shape. Every incident becomes a permanent case, runtime climbs, and the team starts skipping the suite for small changes. Group incidents by failure class, keep representative cases, and archive the rest with the reason they were removed.
Labels go stale. A refund window changes from 30 days to 14 and half the expected states become wrong overnight. Tie each case to the policy version it encodes, and when a policy changes, re-review every case that cites it before the next release.
Feed production back into the suite
The suite you launch with covers the failures you could imagine. Production supplies the rest. Every flagged answer, wrong record and missed escalation maps to a class in the taxonomy, and the ones that represent repeatable risk become new cases with a seed and an expected diff.
Click to expand Run the end-state verifier against production as well. Sample a share of completed tasks each day, reconstruct the expected diff from the business rule and compare it with what the agent wrote. That sampling catches drift in data and policy that the sandbox cannot show.
Measure latency and cost in the same production sample as correctness. A prompt change that lifts policy compliance by two points and doubles median latency is a business decision, and the person who owns the workflow should make it with both numbers in view.
Review cadence follows volume and risk. A low-volume internal agent can be reviewed monthly. A customer-facing agent that writes to payment or account systems needs a weekly look at the sampled diffs and the incident queue.
A 30-day plan
Days 1 to 5 define the job and the boundary, the same scoping an AI readiness assessment starts with. Name the workflow, the systems the agent can write to, the tools and scopes it holds, and the irreversible actions. Write the failure taxonomy with the product and risk owners, and mark the blocking classes.
In days 6 to 12, build the cases. Pull real tickets, records and transcripts from the workflow, redact personal data while keeping the fields that drive the decision, and add synthetic cases for rare, high-cost events. Stand up the seeded sandbox and write an expected diff for every case that writes.
Use days 13 to 18 for the verifier. Implement the state diff, the path assertions and the permission checks as deterministic code. Add the fault-injection proxy for every irreversible tool, and build and calibrate the grader’s labeled set for the answer layer.
From day 19 to day 24, run the current agent against the suite. Run every case k times, record the full version set, and sort failures by class. Fix the blocking classes first, starting with anything that repeats an irreversible action.
The last six days set and run the gate. Choose thresholds with the release owner, rerun the suite, and write the one-page report. Grant production access only for the actions that passed, and keep every irreversible action in approval mode until it clears the fault-injection cases.
Gate write access on the diff
Pick the one agent in your stack that writes to a system of record. Write ten expected end states for its most common and most dangerous cases this week, seed a sandbox, and run them with a forced timeout on every write. If any case produces a second refund, ticket or update, that agent should not hold write access yet.
Algorithmic builds production agents and the eval suites that decide what they are allowed to do. Our systems serve more than 14 million end users, with zero production outages. We seed the sandbox, write the expected diffs, instrument the tool path and wire the release gate into your deployment pipeline. Run the ten-case test this week, then start a conversation with the results in hand.