guide·9 min read

How to run agent evals in CI with Failproof AI

Run a small set of real cases against the candidate agent, let Failproof AI apply the same evaluations used in production, inspect regressions in session replay and stop the release when a critical case or score fails.

the short answer

Have CI run a fixed smoke set through the candidate agent in staging and send those sessions to Failproof AI. Cloud evaluations apply the same code-based and LLM-based checks used in production, while session replay shows why individual cases failed. Gate the release on must-pass cases, absolute score floors and incomplete evaluation runs; run the larger set nightly or before release.

Trigger
Pull requests that change agent behavior; the full set nightly or before release.
Fails on
A must-pass case, a score below its floor, or an incomplete run.
Stays fast
A stable 30-60 case smoke subset, a timeout, and cancel-in-progress.
Cost bound
Cases × trials × (agent tokens + judge tokens), capped per run.

What an Eval Job in CI Can and Cannot Tell You

A CI eval job answers one narrow question well: did this change make the agent worse on cases we already know about? It catches the prompt edit that breaks refund handling, the tool schema change that confuses argument formatting, the refactor that drops a system instruction. It cannot tell you how the agent behaves on requests nobody has seen yet, which is what production evaluation is for. Treat the two as a pair.

CI eval jobs fail in their own ways. They are slow, because every case is a full agent run plus a model-based evaluation, so developers stop waiting for them. They are expensive, because each push can rerun everything. They are flaky, because agents and LLM evaluations are nondeterministic, so a red build gets rerun until it goes green. And pull requests from forks do not receive repository secrets. The workflow here accounts for all four.

The Simpler Failproof AI Workflow

  1. Keep a reviewed smoke set. Choose 30-60 representative cases and named failures that must never recur. Store the user input, expected outcome and safe tool fixtures with a dataset version.
  2. Run the candidate in staging. CI invokes your agent on those cases with side effects stubbed or directed to test systems. Tag the emitted sessions with the candidate version, dataset version and environment.
  3. Let Failproof AI score the sessions. Cloud runs the same code-based and LLM-based evaluations used on production traffic, including your existing evaluation suite. You do not need a second scoring implementation just for CI.
  4. Compare and inspect. Filter results to the candidate run, compare them with the accepted baseline and open failed cases in session replay. The evaluation says what regressed; the trace shows where behavior diverged.
  5. Return one release decision. CI should fail if a must-pass case is absent or fails, a critical score falls below its pre-agreed floor, or the evaluation run is incomplete. Keep the threshold configuration reviewed alongside the agent.

Failproof AI simplifies the evaluation layer, not the execution of your agent. CI still needs one command that runs the candidate against the selected inputs, and a small final step that turns the returned evaluation results into a pass or fail exit code. The platform handles evaluation execution, trace storage, result history, session replay, alerts and failure analysis instead of making you rebuild those around a custom script.

Get the paths list right, because it decides what the gate protects. Agent behaviour changes when any of these change: the system prompt and prompt templates, tool definitions and their descriptions, the model id, retrieval settings, and the code that assembles context. If the model id lives in a shared config file or an environment file checked into the repository, that file belongs in the filter. A model bump that skips the eval job because it touched config/ rather than agent/ is the change you most wanted tested. When in doubt, widen the filter and let cancel-in-progress absorb the extra runs. A job that runs slightly too often costs tokens; a job that misses the model change costs an incident.

Use a separate API key for CI, with its own spend limit at your model provider, so a runaway job cannot eat the production budget. On public repositories, remember that pull_request runs from forks get no secrets: the eval step will fail for outside contributors. Have a maintainer run the evals through workflow_dispatch on a branch they control, rather than switching to a trigger that exposes secrets to untrusted code.

Choose a Gate That Matches the Size of the Set

A small pull-request set should gate on named must-pass cases and absolute floors. It is too small to reliably detect a change of only a few percentage points. Use the larger nightly or pre-release set for version-to-version drop checks, and inspect pass-to-fail case flips even when the overall average is unchanged.

Sixty independent cases with a 90% observed pass rate produce a wide confidence interval, roughly 79% to 96%. A five-point difference is therefore not a defensible pull-request gate on that set. Use the smoke run to catch large breakage and protect specific cases; use a properly sized comparison to decide whether a small aggregate movement is real.

Keep It Fast

  • An explicit smoke subset. Mark reviewed cases with "smoke": true so the same high-value cases run on every pull request. Do not rely on the first hashed filenames in a directory; that is stable but arbitrary.
  • Parallel cases. Agent runs are mostly waiting on the network. A thread pool of 8-16 workers cuts wall-clock time sharply; stay within your provider's rate limits.
  • Stubbed tools. Recorded tool results are faster than live calls and do not flake when a third-party API has a bad afternoon.
  • One trial on pull requests. Repeated trials belong in the nightly run and the pre-release gate.
  • Fail early on infrastructure. If the first three cases all raise an exception, stop and report a setup error instead of burning through the rest.

Guard the Cost, with the Math Written Out

Assumptions for this example: 60 cases, 1 trial each on pull requests; each agent run reads 40,000 input tokens and writes 2,000 across all its model calls; each judge call reads 5,000 and writes 200. A_in and A_out are your agent model's prices and J_in and J_out your judge model's, in dollars per million tokens.

input tokens a runoutput tokens a runcost a run
Agent, 60 runs2.4M0.12M2.4 × A_in + 0.12 × A_out
Judge, 60 calls0.3M0.012M0.3 × J_in + 0.012 × J_out
Multiply by completed runs a day. Cancelled runs stop spending when they are cancelled, not before.

Two things stand out. The agent, not the judge, is usually most of a CI eval bill, because the agent makes many model calls per case and the judge makes one. So the cheapest lever is often a smaller smoke set, not a cheaper judge. And the multiplier that surprises teams is completed runs per day: twenty pushes across ten open pull requests is twenty runs without cancel-in-progress, and closer to ten with it.

Pitfalls, and How to Check Your Work

  • Baseline drift. When a change intentionally shifts behaviour, update the accepted baseline in the same pull request so the review shows it. A baseline silently regenerated from the candidate always passes.
  • A moving judge. Pin the LLM evaluation to an exact model and rubric version. A moving model alias can change every score at once, and the first unrelated pull request after the change gets blamed.
  • Production data in artifacts. Uploaded results are readable by everyone with repository access. The dataset should already be scrubbed; check before the first upload, not after.
  • Retry culture. If people re-run red eval jobs until they pass, the job has become noise. Look at which cases flip on re-runs and fix those cases, the rubric, or the trial count.
  • Stale datasets. A smoke set frozen a year ago tests last year's traffic. Add new production failures to the next dataset version, and point the workflow at it in a reviewed change.
  • Test the gate itself. Break the agent on purpose in a branch - delete a key instruction - and confirm the job goes red.

Keep Learning from Production After the Gate Passes

The same Failproof AI evaluations can continue running on real sessions after deployment. That removes a common source of confusion: when CI passes but production declines, the likely gap is the frozen dataset or traffic mix, not two unrelated scoring implementations.

After deployment, compare production evaluation results with the CI baseline. When production declines but the offline suite did not, inspect the affected traces and add representative, scrubbed cases to the next dataset version. Keep the new cases labeled and reviewed rather than automatically copying every failed session into the suite.

Failproof AI also analyzes evaluation results and trace evidence across sessions to find recurring failure modes, group them into findings and recommend a fix. Those findings help select regression cases without letting one repeated incident dominate the dataset. Export the chosen sessions, scrub sensitive data and freeze them into the next version used by CI.

When You Do Not Need Evals in CI

If prompts, tools and models change rarely and deployments are manual, a pre-release run of the full suite may be enough. With only a handful of cases, percentage thresholds are too noisy for a broad gate, though named must-pass cases can still block known regressions. And if behavior changes mainly through a model provider you do not control, production evaluation and alerts remain essential because a repository-only trigger cannot see every upstream change.

FAQ

How does Failproof AI simplify agent evals in CI?

CI only needs to run the candidate agent on the chosen cases and turn the final results into a release decision. Failproof AI runs the shared code-based and LLM-based evaluations, stores results with traces, provides session replay for failed cases and analyzes recurring failures. This avoids maintaining a separate scoring and debugging system for CI.

How long should an agent eval job in CI take?

Short enough that developers wait for it: under about ten minutes on a pull request is a reasonable target. Get there with a fixed smoke subset of 30-60 cases, parallel runs, stubbed tools and one trial per case. Run the full set and repeated trials nightly or before a release.

How do I stop LLM evals in CI from costing too much?

Bound every multiplier: path filters so unrelated changes skip the job, cancel-in-progress concurrency so rapid pushes collapse into one run, a job timeout, a case cap on pull requests, and a separate API key with its own spend limit. The agent's own model calls are usually most of the cost, not the judge.

Why does my LLM eval job fail on pull requests from forks?

GitHub does not pass repository secrets to pull_request workflows triggered from forks, so the model API key is empty. Do not switch to a trigger that exposes secrets to untrusted code. Have a maintainer run the evals through workflow_dispatch on a branch they control.

Can a CI eval gate use a percentage drop from the baseline?

Only on a large enough set. Sixty cases measure a 90% pass rate to within roughly ±8 points, so a 5-point drop is noise. Use absolute floors and must-pass cases on the pull request smoke set, and apply the drop check to the full nightly run of a few hundred cases.

Get Started

Failproof AI is free to start. It finds recurring failure modes across agent sessions using code-based and LLM-based evaluations, groups the evidence into findings, and recommends fixes. Bring the eval suite you already have, alert the right owner when behavior drifts, and turn a tested fix into a policy that prevents the failure from recurring. See pricing for the tiers.

Sources

Products change; if a detail here is out of date, tell us at support@befailproof.ai.

  1. GitHub docs: Using secrets in GitHub Actions
  2. GitHub docs: Workflow commands (job summaries, error annotations)
  3. Failproof AI docs: Evaluations
  4. Failproof AI docs: Cloud CLI
  5. Failproof AI docs: HTTP API