How do you test an agent that takes different paths?
Agent evaluation has to inspect more than the final answer. A practical starting point is one behavior, real traces, a baseline, and a growing set of failures.
Why the final answer is not the whole test
A tool-using agent can produce a convincing answer after choosing the wrong source, retrying an action unnecessarily, crossing a permission boundary, or leaving an external system in the wrong state. A response-quality check will not necessarily catch those failures. Agent evaluation needs to inspect both what the system returned and how it got there.
In an October 15, 2026 guide, LangChain recommends treating a trace as the record of one run: input, output, and the model and tool calls in between. For a research assistant, useful questions might include whether it retrieved authoritative material, represented uncertainty, and cited the retrieved evidence. For an agent that changes records, the evaluator may need to check the final state in the target system, not just the agent’s claim that the update succeeded. LangChain’s agent-evaluation guide discusses these evaluation patterns.
Research benchmarks make the comparison more concrete. TRAJECT-Bench evaluates not only final answers but also tool choice, arguments, and call ordering. ReliabilityBench examines a different failure surface: whether results hold across repeated runs, input perturbations, and injected infrastructure failures such as timeouts or rate limits. These are complementary lenses—trajectory correctness asks whether the agent took an appropriate path; reliability asks whether it keeps working when conditions vary. Both papers use benchmark tasks rather than proving production reliability, so their metrics should guide test design, not stand in for evidence from a deployed workflow. TRAJECT-Bench and ReliabilityBench.
The trajectory matters because the same final text can hide different risks. An agent may reach the right answer by luck after using an unauthorized tool. Conversely, it may choose the right path but fail because a dependency timed out. Those cases need different fixes, so the test record should preserve tool selection, arguments, results, retries, and the final state.
A small evaluation set can be useful—but not conclusive
Start with one behavior that users care about. Collect representative traces or create carefully reviewed cases, run the current version, and save its results as a baseline. LangChain suggests that 10–20 examples can be enough to begin measuring one behavior. That is a practical starting point, not a statistically complete benchmark and not evidence that rare edge cases are covered.
For a scheduling agent, a first set might test whether it respects the requested date and time zone, asks when key details are missing, and does not book without confirmation. Keep cases that the system fails, then add examples as new failure modes appear. If the dataset changes, record that too; otherwise a score may improve simply because the test became easier.
Match the evaluator to the question
Use deterministic checks where possible: did the correct record change, was a required field preserved, did the agent avoid calling a forbidden tool? Use an LLM judge only for criteria that are difficult to express as code, such as whether a response accurately conveys uncertainty. Judge models can also be wrong, so validate them against human-reviewed examples and monitor disagreement.
For multi-step tasks, do not reduce evaluation to one aggregate score. Separate final answer quality, tool correctness, safety boundaries, completion state, latency, and cost. A single average can hide a critical regression—for example, a small improvement in helpfulness masking more unauthorized actions.
Evaluation is a loop, not a launch gate
Offline evaluation runs a candidate version against a fixed set before release. Online evaluation observes real runs after release and can surface new inputs, cost changes, latency, or quality drift. Production data should be handled under appropriate privacy controls; not every trace belongs in a permanent dataset.
A practical cycle is: identify a real failure, turn it into a reproducible case, change the agent, compare with the baseline, and review regressions before rollout. An evaluation result tells us about the cases and metrics we chose. It does not prove general competence, eliminate the need for human review, or guarantee safety in untested situations.
Sources
Follow on Google Search
Add Bersaglio as a preferred source to prioritize our notes, research, and practical work in Search and AI Overviews.