Agent Evaluation

AI Agent Regression Testing in CI: Gates That Catch Real Failures

Build AI agent regression gates with versioned manifests, isolated trials, matched comparisons, and release rules that distinguish regressions from noise.

· · 7 min read

Prepared with AI research assistance. Sources are linked throughout; worked examples are illustrative unless stated otherwise. Editorial approach.

An AI agent regression gate should detect a harmful change before release without treating every stochastic variation as a defect. That requires two kinds of evidence: deterministic checks on the system's contracts, and repeated task evaluations with an explicit decision rule. A single green transcript is weak evidence. A permanently noisy gate is also weak because people learn to ignore it.

This guide proposes a CI design for a hypothetical support agent. The example thresholds, task counts, and policies illustrate engineering decisions; they are not measured results or universal release requirements.

Version the evaluated system, not only the prompt

An agent's behavior depends on its model, instructions, tool definitions, retrieval corpus, authorization policy, execution code, and grader. If the prompt commit is unchanged but the retrieval index or tool response shape changes, yesterday's evaluation may no longer describe today's candidate.

Create a release manifest that identifies the complete evaluation configuration. For a mutable hosted model alias, record the requested identifier, any returned model-version metadata, execution time, and relevant provider settings. If exact model reproducibility is unavailable, say so rather than presenting an alias as an immutable artifact.

An illustrative manifest could look like this:

candidate: support-agent-rc17
code_commit: example-commit
prompt_bundle: support-policy-v8
tool_contracts: orders-v4
retrieval_snapshot: policies-2026-11-10
eval_dataset: support-regression-v12
grader_bundle: support-rubric-v5
execution_limits:
  max_tool_calls: 8
  deadline_seconds: 60

The actual manifest should also identify the model configuration and test environment. Keep secrets outside the artifact. Store enough provenance to distinguish a behavioral regression from an accidental test-environment change.

Version graders independently. Making a rubric stricter can lower scores without changing the candidate. A grader change needs calibration and a baseline rerun before the new score is compared with old results.

Separate exact invariants from variable outcomes

A useful gate should not ask a language model whether a forbidden mutation happened when the simulator can answer exactly. Check authorization decisions, database changes, tenant boundaries, output schemas, and action counts with code.

For the hypothetical support agent, deterministic assertions might require that a rejected refund leaves the payment ledger unchanged, a successful cancellation targets the requested order, and a repeated operation identifier produces no second mutation. These are application-specific invariants. They should remain stable even when the wording or tool-call sequence varies.

Evaluate task quality separately: did the agent resolve the issue, preserve relevant uncertainty, and explain a pending outcome accurately? Anthropic's evaluation guidance distinguishes the final environmental outcome from what an agent says happened, and recommends multiple trials because outputs vary. It also distinguishes regression suites from capability exploration. Anthropic: Demystifying evals for AI agents.

A regression gate protects accepted behavior. An exploratory benchmark can intentionally contain unsolved tasks. Combining both into one pass percentage makes it unclear whether a low score represents a regression or a known limitation.

Build a staged pipeline with explicit evidence

Martin Fowler describes deployment pipelines as stages that provide increasing confidence while balancing feedback time against deeper testing. Apply that principle to agent evaluation instead of running every expensive task on every edit. Deployment Pipeline.

For this proposed workflow:

Stage Evidence collected Proposed release consequence
Contract checks Schemas, permissions, deterministic transitions, simulator effects Any invariant failure blocks
Small task suite Common resolutions and known critical failures Investigate every new failure
Release evaluation Repeated baseline/candidate trials across task families Apply predeclared quality and resource rules
Limited rollout Outcomes under real traffic and dependencies Expand only with operational evidence

Use change information to select additional suites. A tool-schema change should exercise all consumers of that contract; a retrieval change should exercise affected policy families. Always retain a small mandatory cross-cutting suite so selection logic cannot omit a critical boundary accidentally.

Run broader combinations periodically. Testing every model, prompt, corpus, tool version, and environment combination quickly becomes impractical. Keep the currently deployed baseline, proposed release, supported migration paths, and known high-risk interactions mandatory. Record which combinations were not evaluated.

Compare baseline and candidate on matched tasks

Suppose the release evaluation contains 100 representative tasks and three trials per task. Run both the baseline and candidate against the same task inputs and reset environment. Interleave or randomize execution order to reduce confounding from provider load or temporary dependency behavior.

The 300 trials reveal variation, but they are not necessarily 300 independent examples of production demand. Repetitions of one task share its wording, documents, and difficulty. Report task-level summaries and preserve the individual trial results. When estimating uncertainty in the comparison, use a method that respects the grouping, such as resampling whole tasks rather than individual trial rows.

Pairing helps isolate differences, but it does not make provider-generated outputs identical. Shared random seeds, where supported, are an experimental aid rather than a guarantee of the same execution. Keep tool simulators and initial state equivalent; do not force the candidate to replay the baseline's chosen actions when testing autonomous behavior.

Define the acceptable degradation before inspecting the result. A hypothetical team might allow at most a two-percentage-point reduction in task success while requiring no observed authorization violations. The sample may be too small to establish that margin. An inconclusive comparison should trigger more evidence or a restricted release, not an automatic pass because a conventional significance test failed to detect a difference.

Dataset design and leakage control belong in building agent evaluation datasets. A beautifully calculated interval cannot repair an unrepresentative task bank.

Understand what zero observed failures proves

Safety-related checks often use a zero-observed-failures release rule. That is a useful policy, but zero is not a population failure-rate estimate with zero uncertainty.

Under an idealized model of independent, identically distributed Bernoulli trials, observing zero failures in n trials gives a one-sided 95% exact upper bound of 1 - 0.05^(1/n) on the failure probability. With 300 such trials, that bound is approximately 0.994%. This is an illustrative calculation obtained by solving the probability of zero failures; it is not a claim about the support agent.

NIST explains binomial confidence intervals and why exact methods can be appropriate with small failure counts. NIST: Confidence intervals for a proportion.

The assumptions matter. Three repetitions of 100 selected tasks generally do not justify treating the data as 300 independent samples from future production traffic. A shared missing policy can affect many trials together, and adversarial cases are deliberately selected rather than randomly sampled. Report the empirical result and the assumptions behind any statistical statement.

For release gating, combine observed critical-failure rules with targeted boundary tests and a justified statistical comparison of ordinary task quality. Do not hide a rare severe failure inside a favorable average score.

Distinguish agent variance from a broken harness

A tool simulator that leaks state between tasks can make an unchanged agent appear unstable. Parallel tests can collide on shared identifiers, clocks can cross expiry boundaries, and cleanup can finish after the next test starts.

pytest's documentation identifies uncontrolled state, ordering dependencies, and overly strict assertions as common sources of flaky tests. It also cautions against permanent quarantine mechanisms that stop failures from affecting the build. pytest: Flaky tests.

For the proposed harness, give every trial an isolated namespace and a resettable ledger. Inject a controlled clock for expiry tests. Preserve request and response artifacts with sensitive fields removed. Classify failures as agent behavior, grader disagreement, or infrastructure failure, with evidence for the classification.

Do not rerun until green. If a model task fails once and succeeds twice, retain all three outcomes. A bounded retry may be appropriate for an evaluation service outage, but the outage must remain visible and must not be silently counted as a correct agent result. An expired quarantine should block or require an explicit owner decision.

Make the gate produce a reviewable decision

The CI report should identify the manifest, task-family changes, critical failures, uncertainty in quality comparisons, cost and latency changes, and missing evidence. Link a small number of representative traces rather than asking reviewers to inspect hundreds of transcripts without guidance.

Keep the deployment artifact tied to that report. Rebuilding with a different prompt or corpus after evaluation breaks the evidence chain. If a material component changes, rerun the relevant gate against the new manifest.

Finally, use a limited production rollout to test assumptions that offline fixtures cannot reproduce. Provider outages, actual user ambiguity, and long-delayed outcomes need online agent evaluation. CI establishes a bounded case for release; operations must keep checking it.

Frequently asked questions

Should any failed agent trial block a release?

A critical invariant violation can justify blocking immediately. Ordinary task variation needs a predefined aggregation and uncertainty rule. The distinction should reflect consequence, not whichever classification produces a green build.

Can temperature zero replace repeated trials?

No. Model settings do not control every source of variation in providers, tools, retrieval, or concurrent execution. Repetition should target the variability relevant to the release decision, alongside deterministic environment checks.

Is a larger evaluation suite always better?

No. Duplicated easy cases can inflate confidence while missing important task families. Improve coverage, labels, isolation, and failure diagnostics before adding volume, then choose sample sizes around the decision you need to make.

Source reference list

AI Agent Evaluation
Regression Testing
Continuous Integration
Agent Reliability