Back to blog

Building Production-Grade AI Agents · Part 12 of 15

Evals: The Test Harness Around a Stochastic Application

A production agent needs more than unit tests. It needs a repeatable way to measure outcomes, trajectories, safety, cost, and regressions.

Chris Eberl

Chris Eberl

Founder • Engineering Leader, GenAI, Data, ML

Production AI AgentsSep 14, 20266 min read
Evals: The Test Harness Around a Stochastic Application

The cleanest way to understand agent evals is to stop thinking of them as something inside the agent. The agent is the application under test. The eval system is the test harness around it. The grader is the assertion logic. The trace is the evidence of what happened.

That separation matters because expected answers and rubrics should not normally be visible to the production agent. Otherwise you contaminate the test.

System flow
1eval dataset2    ↓3test runner4    ↓5agent version under test6    ↓7sandboxed / replayed tools8    ↓9trace + output10    ↓11deterministic graders + model graders12    ↓13metrics / release gate

Three layers of evaluation

  • Outcome. Did the task actually succeed?
  • Trajectory. Did the agent choose the right tools, arguments, order, and confirmation sequence?
  • Behavior and safety. Did constraints hold even when the task was difficult or adversarial?

Deterministic graders first

If success can be asserted in code, assert it in code. Correct tool selected, exact order amount, no write before confirmation, correct customer scope, no forbidden destination—these do not need an LLM judge. Model graders are useful for fuzzy properties such as clarity, completeness, or whether a free-form answer is grounded.

A model judge also needs evaluation

An LLM-as-judge is not ground truth. Calibrate it against a human-labeled expert set. Measure agreement and look for biases toward verbosity, style, order, or related model families. Critical release gates should rely on deterministic checks or human-calibrated criteria where possible.

Mock destructive tools; replay external uncertainty

Offline agent evals should not issue real refunds, send real emails, or modify production CRM records. Use sandbox or fixtures for destructive actions. Replay external API responses when you want candidate versions to experience the exact same environment. Inject known failures such as 503s, timeouts, malformed responses, rate limits, and permission denials.

Version the whole agent

A useful eval record versions the model, prompt, tool schemas, retrieval configuration, orchestration logic, and agent configuration. Otherwise a “model comparison” can accidentally compare several changing variables at once.

Production failures become regression cases

The best eval set is alive. When production reveals a new misroute, prompt-injection attempt, bad retrieval result, or premature action, sanitize it and add it to the suite. Over time, the eval system becomes the product’s memory of what has gone wrong before.

PFPLabs takeaways

  • Agent = app under test; eval = harness.
  • Grade outcome, trajectory, and safety separately.
  • Prefer deterministic graders where possible.
  • Sandbox destructive tools. Do not turn evals into production incidents.
  • Version everything and promote production failures into regression cases. The eval suite should evolve with reality.

Read next

Newsletter

New posts, straight from Chris

A short note from me whenever a new article goes live — product engineering, AI workflows, IoT, indie apps, and engineering leadership. No spam, unsubscribe anytime.

By subscribing, you agree to our Privacy Policy. We do not share your email.