Automated LLM evaluation turns an expected behavior into a repeatable check. For a production agent, the unit under test is often a conversation with tools and state. A fluent answer can still use the wrong record, invent a price or skip a required handoff. The evaluation needs to inspect those outcomes.
Start with cases that represent decisions
Write scenarios with their initial state, user turns, expected operations and unacceptable outcomes. Include ordinary tasks, authorization boundaries, ambiguous requests and dependency failures. Version the cases alongside the configuration they evaluate.
A golden case is a reference expectation, not an immutable truth. When the product's policy changes, review the expectation with the policy. Keep a held-out set for broader validation so tuning a rubric does not become memorizing the test set.
In the system I work on for a higher-education group, which serves 700,000+ students, a golden case is a scripted scenario with the expectations for each turn written down. A prospective student asks about a program. An enrolled student needs to reschedule. A conversation must end in a handoff. The cases live in the repository next to the code they test, so a change to behavior and the change to its expectations arrive in the same pull request. The gate replays 138 golden cases before a release.
Use deterministic checks where possible
Tool names, required fields, exact amounts and forbidden operations should be checked directly. Reserve model-based judging for qualities that need interpretation, such as whether a response addresses the user's request in context. Give the judge the actual fixture state, including any mocked date.
Illustrative case:
user asks for another customer's invoice
expected: access denied; no protected record returned
checks: authorization decision + actual tool result
judge: optional assessment of the explanation, not permission enforcement
When to use a deterministic check and when to use an LLM judge
The rule I use is short. If plain code can decide it, plain code decides it. Formatting rules, exact figures, whether a tool was called and whether a required phrase appears are assertions. The judge keeps only the questions that need judgment: did the answer address the question, was it correct in substance, and was the tone right.
In practice this splits the expectations of each case. Did the agent call the scheduling tool? Did it refuse to invent a price? Code answers both. Was the answer responsive, in the right register and correct about the program? That goes to the judge. Mixing the two kinds of expectation is the root of most flaky agent suites.
Calibrate the judge against human labels
Compare verdicts with labeled examples, inspect disagreements and revise the rubric. Measure false passes and false failures separately. Repeated judgments or voting can reduce sampling variance; they do not remove a systematic rubric error. Preserve model and rubric versions so a score change can be investigated.
My public education-system case describes building golden cases as code and the evaluation harness around them. It explains concrete failures: a judge using the wrong date, invented formatting defects and shared state that contaminated cases.
LLM judge calibration step by step
Calibration is case-by-case labor against turns labeled by hand.
- Grade a set of conversations by hand.
- Run the judge over the same set.
- List every disagreement between the judge and the human label.
- For each disagreement, decide who was wrong. Sometimes it is the human label.
- Fix the written rubric, not the model, until judge and human agree.
- Keep the rubric in version control next to the cases, so a change to what a good answer means is reviewed like code.
Calibration does not finish. It converges. Each new capability brings new ways to fail, and each one becomes a labeled example for the judge or a plain-code check that the judge no longer touches.
What goes wrong with an uncalibrated LLM judge
An unreliable judge fails good changes and passes bad ones. Engineers then run it again until it is green and stop reading the failures. These are the failures I found on a production system, and how each one was fixed.
- The judge reasons from the real clock. A case about an enrollment deadline fixes its own date. The judge used the real date and failed correct answers about deadlines that looked past. Now the judge is told what day the case believes it is.
- The judge invents a defect. In one calibration round it reported stray formatting characters that were not in the response. No instruction fixes that. Checks of that kind moved to a deterministic-only mode.
- One verdict decides. Asked twice, a judge can give two opinions. Judged checks now run several times on the same conversation and the majority verdict counts. It costs more tokens, and a gate that flickers is not a gate.
- The judge grades against the wrong world. If a case starts with prior history and the judge does not see it, the judge flags the agent for knowing things the user never said. The declared starting state now goes to the judge with the conversation.
The judge is part of the test system. Every rule that applies to the cases applies to the judge too.
Isolate state and fit the gate to the decision
Give each case its own seeded user and state. Clean up test effects and prevent one case from changing another's starting conditions. Run a small smoke set on frequent integration changes and a fuller regression before promotion. Record which candidate was evaluated; a green result for a different configuration is not release evidence.
How to test an AI agent that has memory
In an agent, memory is the product. You cannot delete it from the tests. You have to contain it.
A suite I own on a production system once ran every case as the same simulated user. The agent remembered, as designed, so one case started with leftovers from the case before it. Some cases passed because of those leftovers and some failed because of them. The pass rate was measuring the order of execution.
The fix was a synthetic user per case, each with its own seeded state. Starting state is declared, not accumulated: a case that needs a returning user with history declares that history in its setup file and does not run an earlier conversation to produce it. The judge sees the same declared state.
There is a cheap test for this problem. Run the suite in reverse order, then shuffled. If the results change, the suite is measuring execution order and not the agent.
Isolation also made the suite faster. Once each case carried its own world, cases could run in parallel, first at the set level and then per case as an option. The full regression stopped being the slowest step of the pipeline. Isolate first: parallelizing a suite that still shares state produces races.
Smoke tests or full regression: which gate runs where
One evaluation depth for every environment is wrong in both directions: too slow for every integration merge and too shallow for a production promotion. In the higher-education system the depth follows the environment. A smoke set runs on integration. The full golden regression runs before QA promotes. Each environment answers the question that fits it, and the expensive run is paid for where it matters.
A worked example: one case from fixture to verdict
Here is an illustrative case built from those rules. It is not a transcript from the client system.
A prospective student asks whether there is still time to enroll and wants an appointment. The fixture sets the date, the student's situation and the catalog. Code checks the tool trace: the agent called the scheduling tool and stated no price that is missing from the catalog. The judge receives the transcript, the expectations and the fixture date. It decides whether the response addressed the request correctly and in the right tone. It runs several times and the majority decides.
Now remove the fixture date from the judge's input. The agent says the deadline is still open, which is true inside the case. The judge reads the real calendar, sees a past deadline and fails a correct answer. Only the verdict was wrong.
Evaluate the evaluator
Deliberately introduce a forbidden tool call, an incorrect price or missing evidence and check that the suite fails. Then restore valid behavior and verify it passes. Watch for flaky verdicts, coverage gaps and cases that pass because the relevant action never ran.
When selecting an engineer, ask to see failed cases, calibration disagreements and how a rejected candidate was prevented from shipping. The work and research below provide starting points for that inspection.
Where to go next
- An AI governance framework for engineering teams: NIST AI RMF and ISO/IEC 42001 as controls you can test
- LLM evaluation service
- Case study: evaluation gates for a production multi-agent system
- AI agent development
- Enterprise AI