The test set that runs every night

How we build evaluation for an enterprise AI agent: real cases, three layers of graders, and a report someone reads before lunch.

By Nabil Ahmed6 minute read

Flight controllers at their consoles in Mission Control during the Apollo 13 return
The Mission Operations Control Room during the Apollo 13 emergency return, April 16, 1970. Photo: NASA Johnson Space Center (S70-35368).

Most AI pilots are judged the same way: someone tries a dozen questions, the answers look good, and the demo goes well. OpenAI's own evaluation guide calls this "vibe-based evals" and lists it as an anti-pattern. Hamel Husain, who has built LLM products for years, puts it more bluntly: the unsuccessful products he has seen "almost always share a common root cause: a failure to create robust evaluation systems."

This note describes the evaluation setup we build on most engagements: a test set taken from real cases, three layers of graders, and a run every night that produces a report a person actually reads. The running example is an agent that triages inbound support cases in a CRM. It's a composite, but every piece of it is something we've built.

1. Build the set from real cases

Start with 50 to 200 cases drawn from production logs or the system of record, not invented ones. Sample on purpose. You want the common case, but you also want the cases that make pilots look bad:

  • accounts with duplicates, merged records and missing owners
  • long email threads where the actual request is in the fourth reply
  • cases in other languages, with attachments, or with no body at all
  • cases the agent should refuse or hand to a person

Each case gets an expected outcome agreed with the people who do the work today. Store the set as plain JSONL in the same repository as the agent, so it's reviewed and versioned like code:

{"id": "case-0142", "input": {"case_id": "500Hs00001XyZ", "subject": "Invoice shows wrong PO", "body": "..."},
 "expect": {"queue": "Billing", "priority": "P3", "must_call": ["lookup_account"], "must_not_call": ["issue_refund"]},
 "rubric": "Reply acknowledges the PO mismatch and asks for the correct PO number. Does not promise a credit.",
 "tags": ["billing", "duplicate-account"], "source": "prod-2026-09"}

The tags field matters later. It's how the nightly report tells you which kind of case got worse, not just that the overall score dropped.

2. Grade in three layers, cheapest first

Deterministic checks. Most failures that matter can be caught with ordinary code. Is the output valid JSON? Is the queue one of the allowed values? Did the agent call the account lookup before writing? Did it stay away from tools it shouldn't touch? These checks are fast and free, and they never disagree with themselves.

Reference checks. Compare structured fields with the expected answer, such as the queue, the priority and the extracted order number. Use exact matching where it's fair, and normalize first (case, whitespace, date formats) where it isn't.

A model as judge, only for what's left. Tone, whether a reply actually answers the question, and whether a summary leaves out something important need judgment. A strong model can do that grading well. In the MT-Bench study, Zheng and colleagues found that GPT-4 as a judge agreed with human preferences over 80% of the time, about the same rate at which humans agree with each other. The same paper documents position, verbosity and self-enhancement biases, so set the judge up carefully:

  • Ask for a pass or fail on one criterion at a time, with a short written reason. Don't ask for a 1-to-10 score.
  • Use a different model from the one being tested where you can.
  • Check the judge against people. Have a domain expert label 50 or so outputs, and measure how often the judge agrees before you trust it.

That last step is never finished. Shankar and colleagues call it criteria drift: people refine what "good" means as they look at more outputs, so the rubric and the judge have to be revisited as well.

import json, math

def check_deterministic(case, out):
    fails = []
    exp = case["expect"]
    if out.get("queue") != exp["queue"]:
        fails.append(f"queue: got {out.get('queue')!r}, want {exp['queue']!r}")
    called = [c["name"] for c in out.get("tool_calls", [])]
    fails += [f"missing call: {t}" for t in exp.get("must_call", []) if t not in called]
    fails += [f"forbidden call: {t}" for t in exp.get("must_not_call", []) if t in called]
    return fails

JUDGE_PROMPT = """You are grading one reply from a support triage agent.
Criterion: {rubric}
Case: {case}
Reply: {reply}
Answer with JSON: {{"pass": true or false, "reason": ""}}"""

def check_judge(case, out, judge):
    # judge(prompt) -> str is your call to the grading model; keep it separate from the agent's model.
    raw = judge(JUDGE_PROMPT.format(rubric=case["rubric"], case=json.dumps(case["input"]), reply=out.get("reply", "")))
    verdict = json.loads(raw)
    return [] if verdict["pass"] else [f"judge: {verdict['reason']}"]

def wilson(passed, n, z=1.96):
    """95% interval for a pass rate, so a 2-point drop on 60 cases isn't mistaken for a regression."""
    if n == 0:
        return (0.0, 0.0)
    p = passed / n
    d = 1 + z * z / n
    c = (p + z * z / (2 * n)) / d
    h = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
    return (c - h, c + h)
Flight controllers gathered around a console in Mission Control during Apollo 13
Flight controllers around Glynn Lunney's console during Apollo 13, April 15, 1970. Every decision rested on telemetry someone had learned to read. Photo: NASA Johnson Space Center (S70-35014).

3. Run it every night, and on every change

An eval that only runs before a release catches regressions weeks late. Run the full set on a schedule, and run a fast subset on every pull request that touches prompts, tools or retrieval. A scheduled CI job is enough. You don't need a platform to start:

name: nightly-evals
on:
  schedule:
    - cron: "30 20 * * *"   # 20:30 UTC: overnight in the US, early morning in Pune
  workflow_dispatch:
  pull_request:
    paths: ["agent/**", "prompts/**", "evals/**"]
jobs:
  evals:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    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 --set evals/cases.jsonl --repeats 3 --out report.json
        env:
          AGENT_MODEL: ${{ vars.AGENT_MODEL }}
          JUDGE_MODEL: ${{ vars.JUDGE_MODEL }}
      - uses: actions/upload-artifact@v4
        with: { name: eval-report, path: report.json }

A few details decide whether the numbers mean anything:

  • Pin everything and record it. Each report should note the model version, a hash of the prompts, the tool schemas and the date of the data snapshot. If the score moves, you need to know what moved it.
  • Repeat the noisy cases. Models don't give the same answer every time. Running each case three times and counting a case as passed only when it passes every time separates "flaky" from "fixed".
  • Freeze the world. Point the agent at a sandbox or recorded tool responses, so a case doesn't fail because someone closed a real ticket overnight.

4. Write the report for a person

The output that matters isn't the single overall score. It's the difference from last night, broken down by tag, with every newly failing case listed next to its reason:

nightly-evals  2026-10-24 → 2026-10-25   agent: triage@7f3c2e   judge: grader-v4
overall        171/184  92.9%  (95% CI 88.3–95.8)   was 176/184
billing         38/41   ▼ 3    case-0142  judge: promises a credit the policy doesn't allow
                               case-0167  queue: got 'Sales', want 'Billing'
                               case-0170  forbidden call: issue_refund
duplicate-acct  22/24   ▼ 2    case-0088  missing call: lookup_account
non-english     19/19   =
refusals        15/15   =

Three regressions in billing on the night someone changed the refund tool description is something a team can act on before lunch. "Accuracy went from 95% to 93%" isn't.

5. Keep the set alive

  • Every incident becomes a case. When something goes wrong in production, the fix isn't finished until a case that would have caught it is in the set.
  • Hold some cases back. If the same people tune the prompts and see every failing case, the prompts slowly overfit to the test set. Keep a held-out slice that's only run weekly.
  • Retire what no longer applies. Policies change. A case that encodes last year's refund rule is now a wrong answer key.
  • Read the logs anyway. Hamel Husain's advice holds: keep reading real outputs until you stop learning anything new. The set only covers the failures you've already imagined.

None of this needs a vendor platform on day one. A JSONL file, a few hundred lines of Python and a scheduled job will tell you more about an agent than any number of demos. It also gives the people paying for it an answer when they ask whether it still works.


Sources

Start a conversation.

A short paragraph is enough. A principal reads every message and replies within one working day.

Or email hello@farside.works. We use what you send only to reply. Privacy