Skip to content
AgenticAIWiki
  1. Learn
  2. Part 3
  3. 20. Regression gates in CI
  4. 20.1

Lesson 20.1 · 1 of 4 · 4 min read · Reviewed 24 Nov 2026

Running evals on every change

By the end, you can

  • Run evals automatically on every change.
  • Choose which evals run when.

Where evals run

pull request --> lint + unit tests + smoke eval (30 cases, a few minutes)
                   red? block merge
merge to main --> standard eval (300 cases)
nightly       --> full eval + slices + agent simulations
before release --> full eval + human spot check

What triggers an eval

Anything that can change model behaviour:

  • Prompt or example files
  • Tool definitionsTool definition: The name, description and input schema that tell the model what a tool does and how to call it. and descriptions
  • Model idModel id: The exact string that names a model in an API request, such as a specific model version. or settings
  • Retrieval config or index version
  • Code that builds the context

Use path filters so a docs-only change doesn’t spend evalEval: A repeatable test that measures how well an AI system performs on a set of cases with defined success criteria. budget.

The gate

A gate is a rule that turns scores into pass or fail:

gates:
  format_valid: {min: 1.00}
  safety:       {min: 1.00}
  policy_accuracy: {min: 0.93, max_drop: 0.02}
  cost_per_success: {max_increase: 0.15}

max_drop compares with the score on the main branch, so a gate catches regressions even when you’re above the absolute bar.

Make it visible

Post a short table of scores and changes on the pull request, with links to failing cases. People fix what they can see.

Key points

  • Treat prompts and agent config like code: every change runs the eval suite before merge.
  • Run a fast, cheap subset on every pull request and the full suite nightly or before release.
  • Fail the check when must-pass criteria drop or a key score falls below its bar.
Hands-on labOn your own machine

Add an eval gate to CI

Make a pull request fail automatically when a smoke eval drops below its gate.

You will have: A CI workflow file, a gates config and a gate script in your own repository, plus one red and one green pull request.

Steps

  1. In a test repository of your own, add gates.yaml with format_valid and safety at min 1.00 and one scored criterion with max_drop 0.02.
  2. Write gate.py: it reads a scores JSON file and gates.yaml, prints a small table, and exits with code 1 if any gate fails.
  3. Add a CI workflow (for example GitHub Actions) that runs on pull requests touching prompts/ or tools/, runs your smoke cases, then runs gate.py.
  4. Store any model API key as a CI secret and read it from an environment variable; never commit it or print it.
  5. Open a pull request that lowers a score on purpose and confirm the check turns red; revert it and confirm green.

Done when

  • A pull request with a deliberate regression shows a failed check and cannot be merged under your branch rules.
  • A docs-only pull request does not run the eval job at all.
  • The job log shows the score table but no key or secret.

Docs: GitHub Actions documentation

Quick checkThe full eval suite takes 40 minutes and costs real money. How should CI handle it?
How sure are you?
Pick an answer and how sure you are