How to set up regression testing for AI agents
Set up regression testing by building a test set from real failures, scoring runs with evaluators, setting a pass bar in advance, and comparing outcomes before and after each change.
By Arun Prasad · Published · Last updated
On this page
Why regression testing matters for AI agents
The reliable way to catch a prompt or model change that breaks an agent before release is to re-run the same cases and compare.
Regression testing for an AI agent means re-running a fixed set of realistic cases after every prompt, model, tool or retrieval change, and checking that outcomes still meet the pass bar you set. This guide covers LLM and agent regression, not general software QA.
AI agents don't fail like normal software. A tool can return a 200 and the task can still fail. Standard monitoring shows the request went through, not whether the answer was right. Say you shorten a system prompt to save tokens. Every tool call still succeeds, but the agent now skips a required confirmation step, and users leave without getting what they came for. No alert fires. A fixed set of cases, scored the same way before and after the change, is how you see it.
Step 1: Decide what counts as a regression
A regression is a change in whether the user got what they came for, not only an error or a failed step. Write that goal down for each scenario before you build anything else.
For a refund agent, the goal might be "the customer gets a correct refund decision and the right next step." A run where every step succeeds but the decision is wrong counts as a failure under this definition. This matches how PRISM by Block Convey's Agent Observability works: it tracks the outcome against the user's goal, not just span status (a span is one step inside a trace, such as a single tool call, and whether each one reported success). Whatever tool you use, one written goal per scenario gives every later step something to check against.
Step 2: Build a test set from real failures
Start from conversations that already failed, plus a few cases you must never break.
Group them by pattern so the set covers different kinds of failure instead of 50 copies of one. To find the patterns, PRISM's Agent Intelligence groups repeated failures and shows how many sessions share each one. That tells you which failure types deserve a case, and which are one-offs. Pick a few cases per pattern, and add the paths you never want to break, such as a cancellation or a payment.
If you have no production data yet, build the set by hand or generate it. Synthetic Scenarios in PRISM writes simulated users from your app description and Knowledge Base, and a failing scenario becomes a regression test. See Synthetic Scenarios for how it works.
Step 3: Pick checks that score each run
Use deterministic rules wherever the answer can be checked exactly, and an LLM judge for the rest. Each needs a written criterion so the same run gets the same kind of verdict every time.
- Deterministic rules give the same verdict for the same input, with no model involved. In PRISM they run on 100% of sessions. Use them for things like "the reply contains no card number" or "the refund tool was called with an order ID."
- LLM-as-judge has a model read the exchange. Use it for what rules can't capture, such as whether the answer addressed the user's question. Write the criterion plainly: what a pass looks like and what a fail looks like.
In PRISM, each verdict links to the rule, the span, the source checked and the reason, so you can see why a case failed. Core scores are on the Free plan. Custom evaluators and the Evaluators Hub need a paid plan. Paid plans from $20/month.
Step 4: Set a pass bar before you change anything
Decide the pass rate a change must reach before you run it, so the result can't be argued afterward. The right number depends on how costly a failure is for your agent, and it is a team decision.
The stakes vary: an agent that drafts internal summaries can tolerate more misses than one that issues refunds. Write the bar down, for example "nearly every case passes, and no case from the never-break list fails." Setting the threshold before you see results is what stops the bar from drifting to wherever the new version landed.
Step 5: Compare before and after on the same cases
Run the current version and the changed version on the same cases with the same evaluators, then compare pass rates per scenario. A single overall number hides a scenario that got worse while others got better.
For multi-step agents, check more than the final reply: test agents, not just single-turn outputs. Look at the tool calls, retries and handoffs. In PRISM, Agent Runs show steps, tool calls, retries, handoffs and state, when your integration sends them.
How this looks in production
In PRISM, a failure traced to a likely cause becomes a backlog item, and once a fix is merged PRISM compares pass rates for the 7 days before and the 7 days after the merge.
The path goes like this:
- PRISM traces a failure to a likely cause, such as the prompt, a missing source, retrieval, stale state or tool choice.
- AI Remediation suggests a change and adds it to a backlog. Each item has severity, suggested fix, owner, expected impact and status.
- After a fix is merged, PRISM compares pass rates across the 7 days before and the 7 days after.
The homepage describes the whole loop: create a scenario (Synthetic Scenarios), run the app, PRISM finds the issue, you review it in Observability (traces, sessions) and Agent Intelligence, Evaluators run checks (automatic tasks run about hourly), AI Remediation suggests the fix, and you run it again.
The limits:
- The comparison covers the 7 days before and the 7 days after the merge.
- There is no re-run by date range, intent or replay set, and no nightly suite.
- There is no "Validated" status. The comparison is a number for you to read.
- A person merges every change. For code changes, PRISM opens a draft pull request only when your team has turned remediation on and granted write access, and only if at least 80% of replays pass. A person reviews and merges it.
To find the patterns PRISM shows and build your first test set from real data, start a free trace.
Common mistakes
A regression gate usually breaks in one of three places: the test set, the checks or the pass bar.
- A test set made only of easy cases. A set of clean, polite requests passes every time and tells you nothing. Fix: seed it with real failures and the cases you must never break (Step 2).
- Judging only the final reply. An agent can reach a plausible answer through a wrong tool call or a skipped step. Fix: check tool calls, retries and handoffs too, for example in Agent Runs or your own trace data, and write evaluator criteria for them (Step 5).
- Picking the pass bar after seeing the results. The bar drifts to wherever the new version landed. Fix: set it first and write it down (Step 4).
- Treating a passing run as permanent. A fixed test set doesn't cover new user behavior. Fix: keep checking real runs after release and add new failure patterns to the set.
What is regression testing and re-testing?
Re-testing re-runs a test that failed, to confirm the specific fix worked. Regression testing re-runs the wider set, to confirm nothing else broke. In this guide, Step 2 builds the wider set, and Step 5 runs the before-and-after comparison on it. For agents, do both: confirm the failing scenario now passes, then confirm the rest of the set still meets the bar.
Find the failures worth testing first
Trace one agent and see which failure patterns repeat across sessions.
Free to start, 100 credits each month.