You test an AI agent workflow by replaying real historical cases through it in a sandbox, then comparing what the agent proposed to do against what your staff actually did. Passing a set of prompt checks tells you the model can follow instructions. It does not tell you the workflow will behave when a refund request arrives with a missing order number and a customer who has already emailed twice.
Most pilots that stall were never tested this way. They were demoed on clean examples, approved on the strength of the demo, and then met production data, which is never clean.
A prompt that passes is not a workflow that works
Unit-testing a prompt checks one step in isolation: given this input, does the model return something reasonable? That is useful, and it is a small fraction of what can go wrong. A production workflow also has tool calls that time out, records that disagree, permissions that differ by role, and approval steps that route to someone on leave.
The usual shortcut is to write a dozen representative test cases by hand. The problem is that the person writing them already knows how the process is supposed to work. Their cases are tidy, and the real inbox is not. The cases that hurt you are the ones nobody thought to write.
A second shortcut is to let the agent run against live data with write access switched off and call that testing. It is better than nothing, but nobody is comparing its output against a known-correct answer, so “it looked fine” becomes the result. Quiet wrong answers are the ones that survive into production.
Replay history, and let your staff be the answer key
You already have the best test set available: every case your team handled over the last several months, with the decision they made. Replay those cases through the workflow in an isolated environment, with the same inputs the staff member saw and tool access pointed at copies or read-only snapshots. The agent proposes actions; nothing executes.
Then compare each proposed action to what a person actually did. Where they match, you have weak evidence of competence. Where they disagree, you have the real finding. Disagreement is not noise to be averaged away. Each one is either an agent error, a case where the human was wrong or inconsistent, or a rule nobody had written down. All three are worth knowing before go-live.
That last category is where most of the value sits. When the agent consistently declines something staff routinely approve, the usual explanation is an unwritten exception that lives in someone’s head. Replay surfaces it. It also feeds the Knowledge principle directly, because the fix is grounding the agent in the actual policy and not the documented one.
Replay is also the place to test the seams. A workflow with several agents has handoffs that a single-step test never exercises, which is the situation described in what happens when Agent B rejects Agent A’s work. And you should deliberately inject failures, because tool calls do fail, as covered in why AI agents break when a tool call fails.
In our deployments we treat the replay as part of the governance record. Each proposed action is written against the policy that would have applied and the reason the agent gave, so the same Audit trail that exists in production exists in the test. When someone later asks why a threshold was set where it was, the answer is in the replay results, not in anyone’s memory.
Disagreement rates tell you where the gates go
Once you have replay results, sort them by action type, not overall accuracy. A 95 percent match rate is meaningless if the 5 percent includes payments, deletions, or messages to customers. A workflow can be excellent at drafting summaries and unfit to issue credits, and a single blended number hides that.
This is how Governance gets decided with evidence instead of optimism. Actions with high agreement and low cost of error can move toward running without a human. Actions with real disagreement, or with consequences that are hard to reverse, keep an approval gate. Some actions belong on the list of things the agent never does at all, as we argue in what an AI agent should never be allowed to do.
Coverage of rare cases is never complete
Replay cannot test what has not happened yet. If a case occurs once every two years, it may not appear in your history, or may appear twice, which is too few to say anything about. The same is true of cases that arise because the agent itself changes how work flows, and of anything involving a system you have since changed.
History is also biased. It records what people decided, including their shortcuts, their inconsistency, and decisions that were wrong but never caught. An agent that matches your staff perfectly may simply have learned to reproduce their mistakes.
This is why approval gates stay on longer than people want. The pressure to remove them arrives right after the first clean week, and a clean week is weak evidence. A reasonable approach is to loosen a gate only after the production audit trail shows a sustained stretch of approvals that were rubber-stamped without edits, and to keep sampling afterward. Gates that are too loose do nothing, and gates that are too tight erase the savings. Finding the point between is judgment, and it needs revisiting.
The question to sit with
If you wanted to know today how an agent would have handled the last hundred difficult cases your team resolved, could you find out without running it on live data? If the answer is no, you have no way of finding where it disagrees with your people before your customers do. A Book a diagnostic call is one way to start working that out.