Skip to main content

Preface

Who this book is for

Agent evaluation connects people with different responsibilities: the evidence used to improve a system also informs release decisions and how the system is operated afterward. This book is for product managers responsible for user outcomes and release decisions; AI and machine-learning engineers building models and runtimes; applied scientists designing experiments and graders; and engineering, quality, operations, and risk leaders who depend on that evidence.

You do not need to be a statistician or know every agent framework before you begin. Each chapter introduces the terms and technical details needed to understand its evaluation decisions, so readers can build on what they already know.

How to read the book

The book is organized around four connected workflows: building an offline evaluation, comparing candidates offline, evaluating production behavior, and operating safe rollouts and online experiments. The capability and governance parts then extend that foundation to specific agent types and organizational practice. Throughout, shared labs use synthetic fixtures to demonstrate methods rather than implement production services or rollouts.

  • Applied scientists: follow measurement, calibration, uncertainty, causal design, and the assumptions connecting each result to its intended claim.
  • AI Engineers and evaluators: follow the cases from test design and harnesses through comparison, trace evaluation, and operational safeguards.
  • Product managers and leaders: focus on decisions, user outcomes, safety gates, evidence gaps, and ownership across the four workflows.
  • SRE, QA, and operations teams: focus on isolation, traces, monitoring, deployment integrity, incident response, and the system-design checklist.

These paths are suggestions rather than prerequisites: start with the decision in front of you, then return to other chapters as questions arise. Although a support agent, a RAG application, a coding agent, and a long-horizon workflow share some evaluation needs, each also brings distinct risks that call for additional evidence.

The workflows form a feedback loop, not a mandatory one-way release pipeline. Production monitoring and online experiments may surface findings that need investigation and adjudication; after privacy review, appropriate cases and evaluator updates can strengthen versioned offline evaluations and candidate comparisons. Those results can then inform a safe rollout, which in turn continues to be monitored. Throughout the cycle, protect independent holdouts and distinguish targeted failure review from population estimates. Urgent incidents require immediate mitigation, not a wait for the next evaluation cycle.

How the chapters connect

The map below groups related chapters to show how their ideas support one another. Solid arrows indicate useful connections, not mandatory prerequisites; the dashed arrow shows how reviewed production findings can strengthen offline tests. The capability and governance chapters apply across the workflows, and the capstone brings them together. Chapter numbers let you find the full titles in the landing page or sidebar. Scroll horizontally if needed to read the map.

flowchart TB
    F["1–2 · Agent systems<br/>and measurement"]
    D["3–4 · Cases<br/>and harnesses"]
    G["5–7 · Metrics, human review<br/>and model judges"]
    I["8–9 · Offline implementation<br/>and benchmarks"]
    C["10–11 · Comparisons<br/>and release decisions"]
    P["12 · Preference methods"]
    T["14 · Production traces"]
    M["15–17 · Monitoring,<br/>evaluation service and flywheel"]
    L["13 · Logged-data<br/>causal analysis"]
    R["18–19 · Release readiness,<br/>shadow and canary"]
    A["20–21 · Online experiments<br/>and longitudinal evaluation"]
    S["22–30 · Agent capabilities"]
    O["31–34 · Economics<br/>and governance"]
    K["35 · End-to-end capstone"]

    F --> D
    F --> G
    F --> C
    D --> I
    G --> I
    G --> P
    P --> C
    I --> C
    C --> R
    R --> A
    A --> T
    T --> M
    T --> L
    M -. "reviewed findings" .-> D
    S --> D
    S --> G
    O --> C
    O --> M
    M --> K
    A --> K

    classDef foundation fill:#edf4fa,stroke:#28668e,color:#17364b;
    classDef workflow fill:#f1f7f3,stroke:#427451,color:#173b25;
    classDef crosscutting fill:#fbf3eb,stroke:#a25a16,color:#4d2d10;
    classDef capstone fill:#f5f1f8,stroke:#70538d,color:#39264e;
    class F foundation;
    class D,G,I,C,P,T,M,L,R,A workflow;
    class S,O crosscutting;
    class K capstone;

For example, Chapters 3–7 build the cases and judgments used by the offline implementation in Chapter 8. Chapters 10–11 use that evidence to compare candidates, while Chapters 18–21 address controlled exposure and online questions. Production traces in Chapter 14 can inform both monitoring (Chapters 15–17) and logged-data analysis (Chapter 13), but those uses require different sampling and causal assumptions. Findings return to the test set only after investigation, adjudication, and privacy review; protected holdouts remain separate.

The running examples

To show how evaluation choices vary by application, the book follows several fictional organizations and agents: Harbor & Pine’s Juniper handles support, Tallow Labs’ Quill writes code, Fernhill Analytics’ Compass conducts research with RAG, and Kestrel Logistics’ Relay coordinates dispatch. Their data and results are illustrative, not production findings.

About the code

Runnable chapter labs accompany the examples as Python scripts in code/chNN/lab_*.py; many also have generated Jupyter notebooks in code/notebooks/chNN/*.ipynb. The scripts are the source for those notebooks, which scripts/make_notebooks.py regenerates. Since longer examples may be shortened or reformatted for print, use the lab files when you want to run an example.

The project metadata requires Python 3.10 or later. Core metric helpers use the standard library, while framework integrations have their own dependencies.

  • Core evaluation math. The bookkit package implements pass@k, Cohen’s κ, ECE, Brier score, isotonic calibration, and CUSUM / Page–Hinkley with the Python standard library (math, statistics, collections). Install the package once from the repository root:

    pip install -e code
  • Offline examples. The core labs use synthetic fixtures and therefore do not require a provider API key. When a lab uses the mock LLM in bookkit.llm, it simulates a configured success probability with a fixed seed; its results demonstrate a method, not real-model quality. Framework workflows may have separate setup requirements.

  • Listings and notebook cells. Longer examples in the prose may be reformatted for print, with comments omitted when the surrounding text explains them. Chapter labs use notebook-style cells that can be run in order from a script, VS Code, or Jupyter; displayed outputs come from the stated fixtures and seeds.

  • Production bridges. Some chapters include a Production bridge sidebar (::: bridge) that shows a computation in Inspect AI or DeepEval. These examples are optional; because frameworks change, check the current documentation before relying on version-specific details.

  • Tests. Unit tests for bookkit are in code/tests/. From the repository root, run them with python -m unittest discover -s code/tests. On Windows, set PYTHONUTF8=1 first when exercising DeepEval examples, which emit rich-formatted output.

  • Exercises. (Conceptual) exercises ask for a written answer; (Hands-on) exercises extend a chapter lab; (Discussion) exercises invite reasoned alternatives. Worked solutions and extensions are in the appendices.

If a result differs from the example, first check the seed, whether calibration data were reused for validation, and which judge version ran. Then rerun the lab with its stated fixtures to help isolate the difference.

Evidence and citations

Citations use IEEE numeric references, allowing you to trace the evidence behind the discussion. When applying a benchmark, framework, or standard, check its stated scope first. Appendix E records dated references, but for a current decision you should also verify the primary documentation, license, and applicable policy.

Because deterministic checks, model-based judgments, and human review support different claims, conclusions should identify the population and conditions evaluated, along with uncertainty and any important evidence gaps.