AI Agentic Handbook
Volume IV

Evals & LLMOps

Knowing whether it works, and shipping changes without breaking it.

Sections

Interview questions answered at staff level

01

Evaluation

Golden sets, rubrics, LLM-as-judge, human review and the statistics behind a real improvement.

10 questions
02

LLMOps

Gateways, versioning, cost, rollouts, red teaming and model upgrades.

10 questions

Read first

Blog posts for this volume, easiest first

How do you know if an AI is any good?

Why a great demo proves very little, how teams check an AI system with a fixed set of test questions called a golden set, and how much a score from 40 questions is really worth.

Your first eval set in an afternoon

Thirty to fifty real examples, five check types, a Wilson interval on the score, and a comparison that respects noise — in plain Python with no frameworks.

LLM-as-judge without fooling yourself

A model can grade open-ended answers at scale, but only after you have measured its true-positive and true-negative rates against people and corrected the pass rate it reports.

Shipping LLM features safely

Eval gates on repeated runs with confidence intervals, versioned configs, canaries sized by arithmetic rather than habit, and a rollback you have rehearsed.

Error analysis, step by step: from 100 traces to a failure taxonomy

Read real traces, write free-form notes, group them into categories, rank by frequency × impact, and turn the top categories into evals that gate releases.

Reading public AI incidents as postmortems

Two well-documented failures, the Air Canada chatbot ruling and the Replit agent that deleted a production database, rewritten as postmortems: timeline, detection, root cause, and the control that would have caught each one.

Decision memo: one LLM platform for twelve teams

A worked staff-level decision record for a shared LLM gateway: context, decision, alternatives, tenancy, budgets and chargeback, model policy, eval gates, build versus buy, rollout and risks.

Key terms

53 pages with diagrams and quizzes

Golden setBudding

A fixed, version-controlled set of realistic questions with known-good answers, so every change gets scored the same way.

Eval harnessMid

The test runner for AI behaviour: run the golden set through the real pipeline, score it, and report what changed since last time.

Recall@kBudding

Of all the documents that should have been found, how many made it into the top k. This is the ceiling on what your system can answer.

PrecisionBudding

Of the results you returned, how many were actually relevant. Precision@5 of 0.4 means two of your five were useful.

nDCGSenior

A ranking score for when some results are more relevant than others, and being near the top counts more. 1.0 is the perfect order.

MRR (mean reciprocal rank)Mid

How far down the list the first good result appears, averaged over all your questions. First place scores 1, second 1/2, third 1/3.

FaithfulnessMid

How much of an answer is actually supported by the sources it was given. Measures grounding, not truth.

Context precisionSenior

Of the chunks you gave the model, are the useful ones at the top? Noise sitting above the evidence costs more than noise below it.

p50 / p95 / p99 latencyBudding

Speed at a percentile: p50 is the typical request, p95 and p99 are the slow tail. Targets use the tail, because averages hide the people waiting.

QPS (queries per second)Budding

Queries per second. For LLM apps it is only the starting number: you also need concurrency and tokens per second.

SLO & SLAMid

A written target for how well a service should behave: '99.5% of answers under 5 seconds, over 30 days'. The gap you are allowed to miss is the error budget.

Oracle experimentStaff

Cheat on purpose: hand one stage perfect input and see how good the answer gets. The jump tells you which stage to fix.

Error analysisSenior

Read your actual failures, label why each happened, count the groups, fix the biggest. Unglamorous, and hard to beat.

DriftSenior

The slow slide where a system that scored well at launch gets worse, because users, documents, models or the right answers all moved.

Eval-driven developmentMid

Decide what number a change should move, build the cases that measure it, then change one thing and read the difference.

Offline vs online evaluationMid

Offline eval scores a fixed test set before release. Online eval watches real users afterwards. Offline is the gate; online is the verdict.

RubricBudding

A written scoring guide: one observable criterion per line, a small scale, and an example anchoring each score.

Pairwise comparisonMid

Grade by asking which of two answers is better, rather than scoring each alone. More reliable for subjective quality — if you swap the order.

Human annotationMid

People labelling model outputs against a rubric. The ground truth every AI judge is measured against — and the most expensive data you own.

Inter-annotator agreementSenior

How often two graders agree beyond luck, usually Cohen's kappa. Below about 0.6, your labels — and any judge checked against them — cannot be trusted.

BenchmarkBudding

A public, fixed test and scoring rule — MMLU, GPQA, SWE-bench — for comparing models. A coarse filter, never a stand-in for your own test set.

Benchmark contaminationSenior

When test questions, or close paraphrases, were in a model's training data — so the score measures memory rather than skill.

Eval gate (CI)Mid

A CI check that runs your evals on every prompt, model or config change and blocks the rollout if quality drops beyond the noise.

A/B testMid

Randomly split live users between the current version and the new one, then compare an outcome you chose in advance.

Statistical significanceSenior

Whether the difference you're looking at is bigger than the random wobble. Report confidence intervals, and pick your sample size before you run.

Synthetic dataMid

Inputs, labels or conversations written by a model to fill gaps. Quick to produce, trustworthy only after filtering, de-duping and human spot checks.

Data flywheelSenior

The weekly loop that turns production traces into labelled failures, new test cases and fixes — so each week of traffic makes the system better.

Red teamingMid

Attacking your own AI on purpose — jailbreaks, injections, data extraction, unsafe tool calls — to find the failures before anyone else does.

JailbreakBudding

An input crafted to talk a model out of its own rules: role-play, encoded text, long fake conversations, odd suffixes.

PII redactionMid

Finding and masking personal data — names, emails, IDs, health details — before it reaches a model, a log or a vendor.

LLM gatewayMid

One service every app calls instead of calling model providers directly: keys, routing, fallback, limits, budgets, caching, redaction and logs in one place.

Rate limitingMid

Capping requests and tokens per key, customer or user per time window, so one caller cannot drink the shared quota.

Model fallback & routingMid

Routing to a backup model or provider when the primary errors out, times out or is overloaded. Only safe if the backup passed the same evals.

Prompt versioningMid

Treating prompts as numbered, unchangeable bundles pinned to a model snapshot and logged on every call, so any output traces back to what produced it.

Cost per queryMid

What it really costs to answer one request: input, cache writes and reads, output, hidden reasoning, retrieval, reranking, tool calls and retries.

Model deprecation & upgradesSenior

A provider retiring a model on a set date. Every prompt, eval and fallback that depends on it needs migrating and re-checking before requests start failing.

CalibrationSenior

Whether stated confidence means anything: of the answers given 80% confidence, about 80% should be right.

IdempotencyMid

Doing something twice leaves things exactly as doing it once. This is the property that makes retries safe.

BackpressureMid

How a busy system tells its callers to slow down — bounded queues and honest 429s, instead of buffering until everything falls over at once.

Dead-letter queue (DLQ)Mid

A parking spot for messages your workers keep failing on, so one bad item stops blocking everything behind it.

Exponential backoffBudding

Wait longer after each failed retry — 1s, 2s, 4s — plus a little randomness, so a struggling service isn't hammered by everyone at once.

Blue-green deploymentSenior

Run the new version beside the old one, check it on real infrastructure, switch all traffic at once, and keep the old one warm for an instant rollback.

Dual-writeSenior

Writing the same change into two stores. Done the obvious way it drifts apart; the outbox pattern plus change data capture makes it stick.

Shadow trafficSenior

Send a copy of real requests to the new version, show nobody the results, and compare outputs, latency and cost before risking live traffic.

Canary & ramped rolloutMid

Release to a small slice of real traffic first — 1%, then 5%, then 25% — compare against the old version, and roll back if anything gets worse.

Feature flagBudding

A switch outside the code that turns a path, model or prompt on or off — per user, per customer, per percentage — with no redeploy.

Index aliasSenior

A nickname that points at a real index, so you can build a new one and repoint every reader in a single step.

Compaction & soft deleteSenior

The background tidy-up that rewrites an index without its deleted entries, winning back space and speed.

Observability & tracesMid

Being able to work out why production did something, without shipping new code to find out.

TTL & cache invalidationBudding

Time to live: how long a stored or cached item stays valid. Too long serves stale answers; too short throws the savings away.

Reconciliation jobSenior

A scheduled audit comparing the source of truth with everything derived from it — index, cache, permissions — and repairing the gaps.

Graceful degradation & load sheddingMid

When a dependency dies, serve something smaller but still useful — a lighter model, a cached answer, the sources alone — instead of an error page.

PostmortemMid

The blameless write-up after an incident: timeline, impact, causes, what went well, and owned actions with dates.