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






















