← manishpande.in Contents
Reference architecture · 2026 The Agentic Platform by Manish Pande
© 2026 Manish Pande Mumbai, India Set in Space Grotesk · Source Serif 4 · JetBrains Mono
OPS · Evaluation Chapter 19

Evaluation

Observability shows what an agent did; evaluation tells you whether it was any good — and, crucially, whether your last change made it better or worse. Because agents are non-deterministic and there is rarely a single correct answer, you cannot rely on the pass/fail unit tests of ordinary software. Evaluation is the empirical discipline that replaces "it seems to work" with evidence, and it is what lets you improve a system you cannot fully predict.

19.1 Offline and online evaluation

Two complementary regimes. Offline evaluation runs the agent against a curated dataset of inputs with known-good expectations, before deployment — your regression suite and the gate on every change to a prompt, model, or tool. Online evaluation measures quality on real production traffic — sampling live runs (from the traces of Ch. 18), scoring them, and watching for drift the offline set never anticipated. Offline catches regressions; online catches reality.

19.2 What to measure, and how to score

Agents need evaluation at multiple levels: the final output (was the answer correct, grounded, safe?), each step (did it pick the right tool with the right arguments?), and the trajectory (was the path efficient, or did it loop and waste budget?). Scoring methods range from cheap and exact to rich and expensive: deterministic checks (does the JSON validate? does the code pass tests? does the answer match a reference?); statistical similarity to references; human review (the gold standard, the bottleneck); and LLM-as-judge, where a model scores outputs against a rubric — scalable and surprisingly effective, but itself fallible and in need of calibration against human labels.

Production tracesCh.17 Curated eval set+ failures added Scorejudge·checks·human Improveprompt·model·tools mine failures run + score diagnose deploy change eval-driven development
Fig 19.1 · The evaluation flywheel. Production failures (surfaced by observability) are mined into the curated eval set; every proposed change is scored against it before shipping; results diagnose the next improvement. The loop is what makes a non-deterministic system steadily, measurably better.

19.3 Eval-driven development

The mature practice inverts the usual order: you build and grow an evaluation set first, and treat it the way software teams treat their test suite. No prompt edit, model swap, or tool change ships without running the evals and confirming it didn't regress. Every production failure becomes a new eval case so the same mistake can never silently return. This is the empirical backbone that makes prompt optimization (Ch. 7's DSPy), model routing (Ch. 6's gateway experiments), and any other change safe to make — because you can prove its effect.

First principle · You cannot improve what you do not measure

For a non-deterministic system, evaluation is not QA you do at the end — it is the instrument that makes iteration possible at all. Invest in a representative, growing eval set and automated scoring early; it pays back on every subsequent decision about prompts, models, and architecture.

Hazard · The judge is not ground truth

LLM-as-judge is scalable but biased — it can favor verbose answers, its own model family, or surface fluency over correctness. Calibrate judges against human labels, audit their scores periodically, and never let an unvalidated judge be the sole gate on a high-stakes release. Measure the evaluator, too.

19.4 Adversarial evaluation and red-teaming

The evaluation so far measures whether the agent does its job well. Security demands the mirror image: whether an adversary can make it do something else. Chapter 16 names the threats — indirect prompt injection, the lethal trifecta, tool misuse, data exfiltration; red-teaming is how you keep those defenses closed over time. Maintain an adversarial suite alongside the quality evals: injection payloads hidden in retrieved and tool-returned content (Ch. 11, 16), jailbreak and policy-bypass attempts, and exfiltration probes — run on every change, exactly as §19.3 runs the regression set. The discipline mirrors eval-driven development: every discovered exploit becomes a permanent test case, so the same attack can never silently reopen, and the attack-success rate becomes a security indicator you drive toward zero (Ch. 29).

Mature programs make this continuous: an attacker model generates fresh adversarial inputs against the agent automatically, surfacing new weaknesses faster than a manual red team can. The defenses (Ch. 16) and the offense (here) are two halves of one control — guardrails state the policy; adversarial evals prove it holds.

Hazard · Evals that only test the happy path

An evaluation suite that measures only quality gives false confidence: it will pass while the agent remains trivially injectable. Test the adversary's path as a first-class part of the suite, gate releases on it, and add every real-world exploit as a permanent case — security regressions are as unacceptable as quality regressions, and far more dangerous.

· · ·