Engineering Around a Stochastic Component

Agent Reliability: Why 95% Per Step Is a Broken System

Reliability compounds multiplicatively. No prompt changes the exponent — you change the base or you change the number of steps.

The arithmetic that governs every agent, and that demos are built to hide: step reliability multiplies. A step that succeeds 95% of the time, run twenty times, completes end to end 36% of the time. At 99% per step, twenty steps gets you to 82%. Nothing about prompting changes the exponent. You either raise the per-step base or you cut the number of steps, and most teams try a third thing that does not work, which is writing a better prompt.

0.95^20 = 36%

a 95%-reliable step, twenty times — the real reason impressive demos do not become products

The three fixes, in order of effect

  • Fewer steps. Every step you replace with ordinary deterministic code is a step that succeeds every time. The best agents in production are mostly normal software with a model placed at the two or three points that genuinely require judgment. An agent that decides what to do and then calls one reliable function beats an agent that improvises eight calls.
  • Checkpoints. Validate state between steps and halt on failure rather than letting a wrong intermediate result propagate into five dependent ones. A cheap verifier that catches most bad steps raises the base more than any model upgrade available to you.
  • Idempotency. Retries are your main reliability tool and also your main source of duplicate side effects. An agent that resends an email on retry is worse than one that fails loudly. Put an idempotency key on every write so replaying a step is free.

Tool design is the underrated half

Models fail at tools for mundane, fixable reasons. Thirty thin overlapping tools produce selection errors; a handful of coarse, clearly-named tools with tight schemas and no ambiguity between them do not. Error messages are prompts: a bare unprocessable-entity response teaches the model nothing, while a message saying the start date must be ISO-8601 and earlier than the end date, and that it sent a slash-formatted date instead, gets corrected on the next turn without a human. And return the minimum useful payload, because tool output is the fastest way to flood a context window with material that then degrades every subsequent decision.

Loops are the characteristic agent incident. Faced with a failure it cannot resolve, an agent will often retry the same call with cosmetic variations until something external stops it. Cap steps, cap wall-clock time, cap spend per task, and detect repetition explicitly — an identical tool call with identical arguments twice means escalate, not try harder. An unbounded loop is simultaneously an availability incident and a billing incident, and it tends to happen overnight.

What production actually requires

  • Full traces: every prompt, tool call, argument, result and cost, replayable. An agent you cannot replay is an agent you cannot debug.
  • Budgets enforced in code — steps, time and money per task — not guidance in the system prompt.
  • Approval gates on irreversible and outbound actions, showing resolved arguments.
  • A kill switch that works mid-task, and a way to see what is currently running.
  • Graceful failure that reports what was completed and what was not, instead of a summary that claims success. Agents are notably willing to describe a failed task as done.
  1. Deterministic shellordinary code holds the structure
  2. Model at judgment pointstwo or three places, not thirty
  3. Verify each stepcheap checks beat a better model
  4. Budget and kill switchenforced in code, not requested in a prompt

Where agents work today, and where they do not

They work on bounded, verifiable, reversible tasks with a tight feedback loop: code with a test suite to run, data transformations with checkable output, research with citations a human can spot-check in a minute. They still largely do not work on long-horizon work with no verifier, on tasks whose correctness only the requester can judge, or anywhere a single wrong irreversible action is unacceptable. That frontier moves genuinely fast — and claims that it has already moved almost always come from someone selling the agent, so check whether their demo had a verifier in it.

Key takeaways

1Reliability compounds: cut steps and add verifiers, because prompting cannot change the exponent
2Put the model at two or three judgment points inside deterministic code, not in charge of thirty calls
3Idempotency keys make retries safe; without them your reliability tool creates duplicate side effects
4Cap steps, time and spend in code, detect repeated identical calls, and never trust a self-reported success

This is one lesson of 541.

The whole Foundation is free — 16 subjects, beginner to advanced. Sign in to track what you have read, take the end-of-module quizzes, and use the terminal.