Skip to main content
← Guides

Evaluating agents

Evaluation

No evaluation, no iteration — offline regression testing, live monitoring, and the pitfalls of evaluators themselves.

What this guide covers

Agent evaluation means quantifying "did the change make it better or worse" with datasets and graders. Without it, "optimizing the prompt" is just feel; with it, every change has an auditable ledger. Evaluation has two battlefields: regression testing before shipping, watching real traffic after.

Two battlefields

LangSmith's official docs split evaluation by when it runs.

Offline evaluation: run against curated datasets during development, to compare versions, benchmark, and catch regressions. Official one-liner: "Test before you ship".

Online evaluation: score real production interactions in real time, for safety screening, format validation, quality heuristics. Official one-liner: "Monitor in production".

The two share data: failures seen in production should become a test case in the dataset. LangSmith official text: "Add failing production traces to your dataset, create targeted evaluators, validate fixes with offline experiments, and redeploy." This loop is what keeps an evaluation system alive long-term.

Four kinds of evaluators

The official docs list four kinds of graders:

GraderHow it worksFits
Human reviewPeople look directlyHigh-quality gold standard, expensive
Code rulesRegex, assertions, deterministic checksFormat, required fields
LLM-as-judgeA model scores the outputSubjective quality, at scale
Pairwise comparisonCompare two versions on the same questionEither-or iteration

Code rules are the cheapest and most trustworthy — if it can be computed, don't ask the model. LLM-as-judge goes on subjective dimensions, but the judge itself errs; its rubric must be written as reusable instructions, not improvised each time.

One full workflow

The official four steps:

  1. Build the dataset: handcrafted cases, historical traces, or synthetic generation.
  2. Define graders: pick from the four kinds above.
  3. Run experiments: run the whole application over the dataset, configurable repeats and concurrency.
  4. Analyze results: compare experiments — benchmarks, unit tests, regressions, backtests.

Evaluating an agent adds one layer over single-turn QA: the process must be checked too. The final answer may be right, but if it called the wrong tools or looped ten times, the cost is completely different. This is why traces are indispensable in agent evaluation.

Pitfalls of evaluation

  1. Dataset drift: cases frozen in three-month-old scenarios while production long ago stopped asking those.
  2. Judge bias: LLMs prefer long answers and formats they know; LLM-grading-LLM needs periodic alignment against human spot checks.
  3. Overfitting the dataset: optimizing for the score, generalization drops — keep a slice never used for tuning.
  4. Watching only pass rate: 80% to 85% may all sit on easy cases; look at per-category, per-difficulty breakdowns.

The Reflexion paper points another direction: use the feedback signal itself as evaluation. Its verbal reinforcement turns environment feedback into verbal reflections that are stored — essentially a passive-feedback-driven, self-executing evaluation loop. The idea is borrowable, but the reported number (91% pass@1) is a result on a specific benchmark; transfer to other tasks is not guaranteed.

Anthropic official text: "optimizing single LLM calls with retrieval and in-context examples is usually enough" — first confirm the simple approach has truly hit its ceiling, then build complex evaluation infrastructure.

Sources

SourceURL
LangSmith official docs · Evaluation (direct fetch 200 on 2026-10-30)https://docs.langchain.com/langsmith/evaluation
Anthropic engineering blog · Building effective agents (official page verified via WebFetch on 2026-10-30)https://www.anthropic.com/engineering/building-effective-agents
Reflexion paper (arXiv 2303.11366, abstract page direct-fetched 2026-10-30)https://arxiv.org/abs/2303.11366

Source snapshot: 2026-10-30; item-specific rechecks and their scope are recorded in the text or source notes. Features and terms may change; check the original sources before use.

This page appears in: Write code with AI · Use AI well