100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Agent Evaluation & Observability
30 minadvanced

Deterministic Checks: Assertions, Schemas and Exact Match

An agent that books flights, drafts SQL queries, or answers customer questions produces an output on every single run, and someone — or something — has to decide whether that output was correct. The most powerful tool for that decision is an LLM-as-judge: another model reading the output and rendering a verdict. It's also the most expensive tool available, in three ways that compound at scale. It costs real money per call, on the order of cents to tens of cents depending on the judge model and context length. It adds seconds of latency to every evaluation run, which matters when a regression suite has to gate a deploy. And it is itself a non-deterministic system judging a non-deterministic system — ask the same judge to score the same output twice and you will not always get the same score back, a genuinely strange property to depend on when the entire point of the check is to notice when something changed.

Most of what an agent gets wrong doesn't need a judge to catch. A response that returns malformed JSON, a tool call with a misspelled argument name, a fare quoted with the wrong currency symbol, a raw SQL string leaking into a customer-facing answer — all of these are structural or categorical failures that a few lines of assertion code catch with total certainty, in microseconds, for free. The discipline this lesson is about is ordering: run every deterministic check that applies before a single output is sent to a judge, because a deterministic check that fails has already told you the output is wrong, with no ambiguity and no retry needed to confirm it. Only the outputs that pass every deterministic gate — and might still be wrong in some way only a semantic reader would notice — earn the cost of the next tier.

This lesson stays entirely in that first tier: checks that are exact, instant, and produce the identical verdict every time you run them on the identical input. The next lesson moves to fuzzy checks — similarity scores and rubrics that tolerate legitimate variation. The one after that is LLM-as-judge. The order of these three lessons is the order you should reach for them in a real pipeline, and skipping straight to the third because it feels the most 'AI-native' is the single most common way teams overspend on evaluation.

Analogy🏏Cricket
🏏 Think of it like cricket: When the third umpire reviews a run-out at the Wankhede, they don't reach for ball-tracking projections first. They start with the cheapest, most certain evidence available — the stump-cam replay showing whether the bails were dislodged before the batter's bat crossed the crease. If Ravindra Jadeja's dive is a clean two feet short, the replay settles it in one frame, at zero cost beyond hitting play. Only when the frame-by-frame footage is genuinely inconclusive — the bat and the bails moving within the same fraction of a second — does the process escalate to a slower, more expensive, more interpretive tool. The same discipline applies to a no-ball check: the front-foot camera either shows daylight between Jasprit Bumrah's heel and the crease line or it doesn't; nobody calls a panel of experts to debate it. Escalation is the exception, not the default, reserved for cases the cheap check genuinely cannot resolve. An evaluation pipeline that sends every agent output straight to an LLM-as-judge is skipping the stump-cam replay and going straight to a panel discussion for a decision the replay would have settled in a single frame. Deterministic checks are the stump-cam: instant, free after the one-time setup, and completely repeatable — run the same clip twice and the umpire reaches the same verdict every time. Only what survives that first pass, the genuinely ambiguous cases, deserves the cost of a judge.
Lesson 5 of 35
0% complete