liveBook · Manning

Benchmark

As explained in AI Agents in Action, Second Edition

A benchmark test measures how well a system solves a defined problem or achieves a known goal using a repeatable evaluation set.

A benchmark is a repeatable set of tests for a defined goal. For an agent that answers questions, each test supplies a question and a way to judge the answer. The results show how often the agent meets that goal, rather than whether one impressive response happened to work. section 7.2.1

Benchmark testing asks, “Can the agent do its intended job?” Red team testing instead probes for inputs that break the system. A benchmark can also examine more than the final answer: tool choices, grounding in retrieved context, number of steps, latency, cost, and failure behavior may all matter. section 7.1 section 7.2

Use benchmarks to guide development:

  • Define goals and input cases before expanding the agent. Pair cases with expected responses and known-bad responses so an evaluator has both positive and negative examples. section 7.2
  • Run the initial tests and expect failures. Make the smallest useful change to the prompt or tools, then retest and refactor. section 7.2 section 7.6
  • Repeat each test. Agent outputs vary, so one pass does not establish consistency; three passing runs are a practical starting check, with more runs when outputs vary. section 7.2.2

Testing a question-answering agent

Suppose an agent searches a knowledge base to answer “Nebula Forge engine spins what?” A benchmark pairs that question with “antimatter” as an expected answer and “fusion” as a wrong answer. An initial evaluator can check for an expected string; an evaluator LLM can instead judge the response against the paired answers. The percentage of benchmark questions answered correctly gives an accuracy measure, while repeated runs reveal whether that accuracy is stable. section 7.2.2 section 7.2.1 section 7.6

Figure 7.3 Architecture of a simple RAG knowledge agent. The goal of the agent is to answer questions from a benchmark by searching its knowledge base and returning answers. A simple evaluator LLM evaluates the answer based on the expected and incorrect answers from the benchmark test. The accuracy of the RAG agent can be determined by the percentage of benchmark questions it answers correctly.

Follow the question from the benchmark through knowledge-base search and answer generation to the evaluator, which uses expected and incorrect answers to judge the result. section 7.2.1

How AI Agents in Action, Second Edition covers it

How deep it goes
Works through benchmark setup, initial failures, evaluation, minimal changes, and repeated runs, without prescribing a single implementation for the agent.
Examples
Uses a knowledge-base question set with expected and wrong answers, initially checked by string matching and later judged by an evaluator LLM.
What it assumes
Starts with a simple question-answering agent and its goals; does not require a finished prompt or full toolset before testing.
What you can do after
Practice/perform it by defining question benchmarks, rerunning them for consistency, and making minimal changes when the agent fails.
How it connects
Connects test-driven agent development, retrieval-augmented generation, automated evaluators, grounding checks, and red team testing.

Also explained in

Compare how 23 books explain benchmark →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.