Education › Evals & Harness › Stage 2: Evals in practice

Evals in CI and production

Regression gates, online evals, sampling production traffic, human review and dashboards.

Intermediate ~40 min read Module 8 of 20

An eval that only runs when someone remembers is a report, not a safety net. Eval operations means wiring evals into the places where change happens: every pull request, every model or prompt update, and continuously on production traffic. This lesson covers tiered offline evals in CI, regression gates that account for noise, caching and cost control, online evals on sampled live traffic, the user signals worth collecting, and the loop that turns production failures into new test cases.

After this module you can
  • Design tiered eval suites for pull requests, nightly runs and releases
  • Write a regression gate that compares against a baseline with noise tolerance
  • Control eval cost with caching, sampling and cheap checks first
  • Run online evals on sampled production traces
  • Close the loop from production failures back into the dataset

Tiered offline evals

TierWhenContents
SmokeEvery pull request, minutes30-100 critical cases, code checks, safety cases
FullNightly and on prompt or model changesWhole dev set, judges, several epochs
ReleaseBefore shipping a new versionHeld-out set, pass^k for agents, human spot checks

The smoke tier must be fast and stable enough that engineers do not learn to ignore it. Put every safety and policy case in it, because those must never regress. The full tier can be slower and noisier, and runs where cost is less painful. The release tier is the one you use for go or no-go decisions, so it uses the held-out set that nobody tunes against.

Treat the eval suite like production code. It lives in the same repository as the prompts and agent code, changes to it are reviewed, and the results of every run are stored with the commit, model version, prompt hash and dataset version. That history lets you answer questions such as "when did refund accuracy start slipping?" months later.

A regression gate that respects noise

Comparing today's score with yesterday's and failing on any drop will flap constantly, because scores vary from run to run. Store a baseline result from the main branch, compare per case and per slice, and fail only on drops larger than the measured noise, or on any failure in must-pass cases.

resultspassregressed IDstraceslow scoresnew casescasesPull requestSmoke tier30-100 casesRegression gatevs baselineMerge + deploycanaryDatasetversionedReview queuelabel causesOnline evalssampled traces
Offline evals gate every change, online evals score sampled production traffic, and reviewed failures become new cases in the dataset that feeds the gate.
gate.py: fail the build on real regressions
python
import json
import sys

base = {r["id"]: r for r in map(json.loads, open("baseline.jsonl"))}
new = {r["id"]: r for r in map(json.loads, open("results.jsonl"))}

must_pass_failures = [i for i, r in new.items() if r.get("must_pass") and not r["passed"]]
broke = [i for i in new if base.get(i, {}).get("passed") and not new[i]["passed"]]
rate = lambda rs: sum(r["passed"] for r in rs) / len(rs)
drop = rate(base.values()) - rate(new.values())

print(f"pass rate drop: {drop:+.1%}; newly failing: {len(broke)}")
for i in broke:
    print("  regressed:", i)
if must_pass_failures or drop > 0.03:      # 3 points = measured run-to-run noise
    sys.exit(1)
.github/workflows/evals.yml: run the smoke tier on pull requests
yaml
name: evals
on:
  pull_request:
    paths: ["prompts/**", "src/agent/**", "evals/**"]
jobs:
  smoke:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install -r evals/requirements.txt
      - run: python evals/run.py --tier smoke --out results.jsonl
        env:
          EVAL_API_KEY: ${{ secrets.EVAL_API_KEY }}
      - run: python evals/gate.py
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: eval-results
          path: results.jsonl

Always upload the results, especially on failure, and print the IDs of newly failing cases so a reviewer can read them directly. A gate that says only "score dropped" sends people back to vibe-checking.

Keeping cost and time under control

  • Cheap checks first: run code scorers on everything; run judges only on cases code cannot decide.
  • Cache: key outputs and verdicts by (model version, prompt hash, input); unchanged cases need no new calls.
  • Trigger by path: only run evals when prompts, agent code or eval files change.
  • Sample in the full tier: stratified samples by slice can track trends between complete runs.
  • Track eval spend as a line item, so the team sees when a suite grows too expensive.

Online evals on production traffic

Offline datasets age: users change, documents change, new intents appear. Online evals score a sample of real production traces continuously, with the same code checks and calibrated judges, and chart the results by slice and version. Alongside them, collect user signals: explicit thumbs up or down, and implicit ones such as the user rephrasing the same question, abandoning the session, escalating to a human, or editing the agent's draft heavily before sending it.

  • Sample traces with personal data redacted and respect retention rules.
  • Alert on sustained drops per slice, not on single bad outputs.
  • Compare versions during rollouts (canary or A/B) using the same online scorers.
  • Watch the distribution of inputs too: a new cluster of questions is an early warning.

Closing the loop

The most valuable output of online evals is new test cases. Route low-scoring and negatively rated traces to a review queue, have someone label the failure cause, and promote representative ones into the offline dataset with a reference answer. Over time the offline suite becomes a record of every way the system has failed, and each fix is protected by a case that will catch it if it returns. Review the suite every few months to retire cases that no longer reflect the product.

Hands-on practice

Put an eval suite behind a CI gate

  1. Take an eval you built earlier and split it into a smoke tier (30 cases, including all safety cases) and a full tier.
  2. Write run.py that writes results.jsonl with id, passed, must_pass and slice for each case.
  3. Record a baseline from the main branch and implement gate.py.
  4. Measure noise: run the smoke tier five times unchanged and record the spread of pass rates; set the threshold above it.
  5. Add the GitHub Actions workflow, open a pull request with a deliberately harmful prompt change, and confirm the gate fails with useful output.
  6. Add an output cache keyed by prompt hash and input, and measure how much a re-run costs.
Cheat sheet

Evals in CI and production — at a glance

Main things to focus on

  • Smoke tier on every PR; full nightly; held-out at release.
  • Every safety case is must-pass in the smoke tier.
  • Gate on drops larger than measured noise, plus must-pass failures.
  • Print regressed case IDs and upload results.
  • Cheap code checks, caching and path triggers keep cost down.
  • Online evals plus user signals; failures become new cases.

Tiers

smoke: 30-100 cases per PRFast safety net
full: dev set nightlyTrends, judges
release: held-out + pass^kGo / no-go
must_pass: trueZero tolerance cases

Gate

baseline.jsonl from mainComparison point
newly failing case IDsWhat broke
threshold > run-to-run noiseAvoid flapping
upload results if: always()Debuggable failures

Cost

cache key: model + prompt hash + inputSkip unchanged
on.pull_request.pathsRun only when relevant
judges only where code cannotFewer calls
stratified samplingCheaper trends

Online

sample + redact tracesScore real traffic
thumbs, rephrase, escalateUser signals
alert on sustained slice dropsNot single outputs
review queue -> new casesClose the loop

Common pitfalls

  • A flaky gate that engineers learn to ignore.
  • Failing on any score drop without measuring noise.
  • Gate output that shows only a number, not the failing cases.
  • Offline datasets that never receive production failures.
  • Online scoring on unredacted personal data.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →