Agent reliability
Making agents finish tasks predictably with guardrails, retries and approvals.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkOn this page
Overview
An agent that works in a demo often fails in production for boring reasons: a provider times out, a tool returns something unexpected, the model loops, the process restarts halfway through a forty-step task. Reliability engineering for agents borrows from distributed systems. Make tool calls idempotent, retry with backoff, record progress so a run can resume, and set limits on steps, time and spend.
On top of that come checks specific to models: validate tool arguments and outputs against schemas, run guardrails on inputs and outputs, require human approval before irreversible actions, and evaluate whole trajectories rather than only final answers. Durable execution engines such as Temporal and graph frameworks with checkpoints make much of this easier, but the habits matter more than the tool.
What you will practise
- Add retries with backoff and timeouts around every model and tool call
- Make tool calls idempotent so a retried step does no harm
- Checkpoint agent state so a crashed run resumes instead of restarting
- Enforce step, time and cost limits per run
- Require human approval before irreversible or external actions
- Evaluate agent trajectories, not only final answers
Learning paths
- Production AI agents: approval, multi-agent and evals
For engineers moving past single-agent demos: add code-level approval gates, context isolation, multi-agent patterns and automated evals you can trust in CI.
Tutorials
- Make an agent survive crashes and restarts with durable execution
Build a durable AI agent with Temporal in Python: tool calls as activities, a worker you kill mid-run that resumes, retries and human approval as a signal.
- Add human approval to agent actions
Pause risky tool calls, show the exact arguments, resume on approve or reject, then log and test it.
Workflow recipes
- Test-driven development with a coding agent
Agree the seams, write one failing test, lock the tests with a hook while the agent makes it pass, then prove the test can fail.
- Triage production errors with an agent
AI error triage with a coding agent: read errors over a read-only Sentry MCP connection, write a triage note, reproduce in a failing test, then fix behind it.
Articles
- Multi-agent systems: when one agent is not enough
Orchestrator-workers, subagents and handoffs compared on context, cost and failure modes.
Tools for this skill
Claude Agent SDK
Build agents on the same harness that powers Claude Code.
Guardrails AI
Python framework of validators that check and correct LLM inputs and outputs.
Inspect
The UK AI Security Institute's open-source framework for LLM and agent evals.
LangGraph
Graph-based orchestration for stateful, long-running agents.
NeMo Guardrails
NVIDIA's toolkit for programmable input, output and dialogue rails in LLM apps.
Portkey AI Gateway
Open-source gateway for routing model requests with retries, fallbacks and guardrails.
Sentry MCP
Sentry's MCP server for reading and triaging errors from an agent.
Temporal
Durable execution platform that lets long-running workflows survive crashes and restarts.
Key terms
Words you will meet while learning this, defined in the glossary.
- Durable execution
Running code so that its progress is recorded step by step, letting it resume after a crash or restart instead of starting again.
- Excessive agency
The risk that an AI system has more permissions, tools or autonomy than is safe, so a mistake or manipulation causes real harm.
- Rate limit
A provider's cap on requests or tokens per minute or per day; requests over the cap are rejected with an error until the window resets.
- Trajectory evaluation
Evaluating the sequence of steps an agent took, its tool calls, arguments and order, rather than only its final answer.