Agent Reliability & Evals
Read a little, play a little. No scary maths, and no rush.
Demos don't fail; agents do (in production)
An agent that aces 5 hand-picked tasks will still get lost on task 6: wrong tool, infinite planning loop, confidently deleting the wrong rows. Reliability engineering is what turns "cool demo" into "runs at 3 AM without me." It has three pillars: survive failures, measure everything, ship changes safely.
Survive: retries, timeouts, checkpoints
Every tool call gets a timeout (no hanging forever), limited retries with backoff (polite, idempotent-only), and the whole run gets checkpoints — the full state (plan, tool results so far) saved after each action. Crash mid-refund-flow? Resume from the checkpoint instead of starting over or, worse, double-refunding.
Measure: evals with teeth
"Looks good to me" doesn't scale. Build golden tasks with assertions at the trace level:
- Outcome: did the final state match? (ticket created, refund for the right amount)
- Process: right tools, in a sane order, within max steps? (an agent that succeeds in 40 steps is a cost incident)
- Cost: tokens + tool calls per task under budget?
Run this suite on every prompt, model, or tool change. A red eval blocks the deploy — same as a failing test in normal software.
Diagnosing the 40-step run
A task that should take three tool calls took forty. The trace shows the agent searching a knowledge base with slight variations of the same query, getting nothing useful each time, and trying again. Four fixes, each from the trace:
- A step budget ends the run at a sensible maximum and escalates.
- Repeat detection notices the same tool called with near-identical arguments and stops the loop.
- Clearer tool results. The search tool returned an empty list; returning "no documents matched this query" gives the model something it can reason about.
- An instruction to ask. "If two searches find nothing, ask the user for more detail" turns a loop into a question.
Circuit breakers and fallbacks
Retries help with brief glitches but make outages worse, because every client hammers a dependency that is already down. A circuit breaker counts recent failures. Past a threshold it stops calling that dependency for a cooling-off period and fails fast instead. Pair it with a fallback: "I can't check order status right now, but I've noted your request and someone will follow up" is far better than a long hang followed by an error.
Ship: canary the brain changes
New prompts and new tools roll out like code: 5% traffic first, compare eval metrics and user corrections against baseline, then widen. Log every thought/action/observation — when something weird happens at scale, the trace is the only witness.
Escalation is a reliability feature
Handing a task to a person is not an admission of failure. Escalate when confidence is low, when the stakes are high, or when the agent has stopped making progress. Track the escalation rate over time: rising suddenly means something changed, while slowly falling usually means the agent is genuinely improving.
Remember this
- Checkpoint everything, retry politely, eval at the trace level, canary every brain change.
- An unevaluated agent is a demo wearing a production costume.
Check your understanding
5 questions · first-try answers earn the most XP
My notes
Saved in this browser. Highlight a line above and save it, or write it in your own words.
Nothing saved yet. Your highlights will live here.
References
Finished reading?
Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.
Practice this in an incident
Related chapters
Spotted a mistake or want a topic covered? Report an issue