All patterns · 09 of 13 · Assurance

Agentic patterns: Replay testing

Thirty-two logged decisions are replayed on the new model version. Six come back different, and one of those is wrong.

A new model version is out. The assistant runs on Claude Sonnet 5 and has decided 32 invoices. Before switching to Sonnet 5.5, every logged request is replayed and compared.

Demo: Thirty-two decisions, replayed. Recorded on 26 November 2026 with Claude Sonnet 5 and Claude Sonnet 5.5: the model’s answers are real, replayed here. The invoices and records are a small simulation.

What you just saw

What the replay testing demo shows

The principle

What is replay testing?

Replay testing is an assurance pattern in which logged production requests are sent again to a new model version, and every answer is compared with the one on record before the new version goes live.

A model in production is a dependency you do not control. The provider releases a successor, sets a retirement date for the version you use, and the same prompt starts to give different answers. Usually better ones. The trouble is that better on average says nothing about the specific decisions your process makes.

Replay testing treats the production log as a test set. Every logged request is sent again to the candidate model and the typed answers are compared. In the demo, 32 invoice decisions made by Claude Sonnet 5 are replayed on Claude Sonnet 5.5: 26 are unchanged and 6 change. One of the six is a plain regression, a surcharge above the contract cap that the old model queried and the new one pays. Replaying the old model against its own log changes 1 of 32, which is the noise to hold the 6 against.

Where it applies

  • Any process where a model’s decision is logged with its full request
  • Model version updates, prompt changes and provider switches
  • Regulated settings where a model change needs a documented impact assessment
  • Finding the noise floor of a process before judging any change

Where it does not

  • Free-text output with no typed decision to compare
  • Processes that log too little to rebuild the request
  • As the only test: the log holds yesterday’s cases, and a new model can fail on tomorrow’s

Fill the boxes

One shape, three ways to build it

The pattern exists with or without AI. The design decision is which boxes deserve a model, and what that costs in money, speed and auditability. In the first run above, 97 steps were done: 64 by code, 32 by a model, 1 by a person.

All code

A rule engine is replayed against its own log after every change. Any difference is a defect, because nothing in it is sampled.

Cost
Free
Speed
Seconds for the whole log
What the auditor gets
A list of differences, each one a defect

Hybrid shown above

The candidate model answers the logged requests, code compares the typed fields, and a person reads only the changed decisions.

Cost
$0.10 of model calls in the run above
Speed
A minute for 32 decisions
What the auditor gets
Every changed decision, old and new, side by side

All agents

A second model judges whether each new answer is as good as the old one. Useful for free text, and one more model to keep an eye on.

Cost
Two model calls per decision
Speed
Twice as long
What the auditor gets
A model’s opinion on each change

codemodelagentperson

What it costs

The price of each run, and of ten thousand

Replaying 32 decisions cost ten cents, about a third of a cent each. A full month of production decisions replayed before a model switch is a rounding error next to one wrong payment.

Measured from the runs recorded with Claude Sonnet 5 and Claude Sonnet 5.5 on 26 November 2026. Model calls only: people’s time and infrastructure come on top.

RunModel callsCost per replayed decisionPer 10,000 replayed decisions
Replay on the new model32$0.0032$32.23
Replay on the same model32$0.0033$32.60

In a regulated process

What the auditor gets

A model change in a regulated process needs an impact assessment. The replay is that assessment in a form anyone can check: the population tested, the number changed, the noise floor, each changed case with both answers, and the name of the person who reviewed them and released the switch. The same file answers the question after an incident: would the old model have decided this differently?

Lineage

Where the shape comes from

Software engineers call it a regression test, or a characterisation test when the recorded behaviour is the specification. Risk managers call it backtesting and run a challenger model beside the champion. The technique is the same. What is new is that the component under test changes on the provider’s schedule, and that it flips some answers even when nothing has changed.

Also known as Regression testing (software engineering) · Characterisation test; golden master (software engineering) · Backtesting; challenger model (model risk management, SR 11-7)

Advice

Questions I ask before using it

  • Do we store every request in full, so that it can be sent again?
  • Which fields count when we compare: the action, the amount, the reason?
  • How many decisions change when nothing changes? Without that figure the rest means little.
  • Who reviews the changed decisions, and what stops the switch until they have?

Asked often

Replay testing: short answers

What is replay testing?

Replay testing is an assurance pattern in which logged production requests are sent again to a new model version, and every answer is compared with the one on record before the new version goes live.

When should you use replay testing?

Typical uses: any process where a model’s decision is logged with its full request; model version updates, prompt changes and provider switches; regulated settings where a model change needs a documented impact assessment. It is a poor fit for free-text output with no typed decision to compare.

How do you test a new model version before switching?

Store every production request in full. Send the stored requests to the new version, compare the typed answers with the logged ones, and have a person review each difference before the switch.

How many decisions change with a new model version?

In this demo, 6 of 32 between Claude Sonnet 5 and Sonnet 5.5, against 1 of 32 when the old model was replayed against itself. The figure depends on how many of your cases are borderline.

Is a newer model always better for my process?

On average, probably. Case by case, no. In the demo the newer model handled several borderline invoices more sensibly and also paid one surcharge the policy forbids. Only a replay on your own cases shows which.

What does replay testing cost to run?

In the demo, model calls cost between $0.0032 and $0.0033 per replayed decision, which is $32.23 to $32.60 per 10,000 replayed decisions. Replaying 32 decisions cost ten cents, about a third of a cent each. A full month of production decisions replayed before a model switch is a rounding error next to one wrong payment. Measured from the runs recorded with Claude Sonnet 5 and Claude Sonnet 5.5 on 26 November 2026.

The demo in detail

The run in words “Replay on the new model”, step by step

An accounts payable assistant on Claude Sonnet 5 has decided 32 invoices: 24 ordinary ones and 8 that the policy does not settle cleanly. The provider releases Claude Sonnet 5.5. Before anyone switches, the 32 logged requests are replayed on the new model and every decision is compared with the old one. The second run replays them on the old model, to see how much changes without any update.

  1. INV-11, PO number mistyped: the log says pay in full €7,350. The replay says ask the supplier.
  2. INV-13, surcharge above the agreed cap: the log says ask the supplier. The replay says pay in full €8,720.
  3. INV-16, goods half received: the log says pay part €2,539.80. The replay says hold.
  4. BRD-1, surcharge plus tolls: the log says ask the supplier. The replay says pay part €8,400.
  5. BRD-4, description nearly matches: the log says ask the supplier. The replay says pay in full €1,450.
  6. BRD-5, credit note amount differs: the log says ask the supplier. The replay says pay part €5,950.
  7. A person reviews every changed decision before anything is switched.
  8. Done. 26 decisions are unchanged and 6 changed. One of the six now pays a surcharge above the contract cap, which the old model queried.
Building it This demo runs on plain Python and the Claude API: when I would pick it, and when not

This demo uses no agent framework: plain Python replays logged requests against another model and compares the typed answers. Other frameworks can carry the same pattern; this is when I would pick this one.

Reach for it when

  • The process is yours and you want to read every line that touches money
  • A decision table, a loop and a few API calls cover the job
  • You need the recording and the control points more than a framework’s features

Skip it when

  • Runs must survive a crash or wait days for a person: take a durable workflow engine
  • Several teams build agents and need one shared way of working
  • You would end up rebuilding checkpoints, retries and tracing by hand

In the framework’s own terms. Every production decision is stored with its full request. A replay sends the identical requests to the candidate model and compares action and amount field by field, so a reworded reason does not count as a change and a different payment does.

Framework
Plain Python and the Claude API (anthropic SDK 2.10)
Licence
MIT
Model
claude-sonnet-5, claude-sonnet-5-5
Watch time
~2 min
Go deeper Sources

Contact

Questions, ideas or a conversation?

I’m always glad to hear from people working on AI, product strategy, transformation or software.