Why multi-step AI agents fail, and how to fix it
- By
- Luv, Context Labs
- Published
- Updated
The short answer
Small error rates multiply. If an AI agent gets each step right 95% of the time, a 20-step workflow with no checks finishes correctly only about 36% of the time. Long workflows become reliable when the steps with a known right answer run as fixed code, outputs are checked between steps, and a person approves the consequential ones.
Key facts
- At 95% accuracy per step, a 20-step workflow with no checks finishes correctly about 36% of the time (0.95 to the power of 20).
- At 99% per step, a 40-step workflow still finishes correctly only about 67% of the time.
- Steps with one right answer (lookups, calculations, date checks, threshold checks) belong in code so they drop out of the error multiplication.
- Model output can differ between runs even at temperature zero (Thinking Machines Lab, 2025).
- In the fictional 24-step claim below, moving 12 steps to code and adding checks lifts end-to-end success from about 38% to about 72%, before any human approval.
Why do small error rates break long workflows?
If each step succeeds independently with probability p, a workflow of n steps succeeds with probability p to the power of n.
| Per-step accuracy | 5 steps | 10 steps | 20 steps | 40 steps |
|---|---|---|---|---|
| 99% | 95% | 90% | 82% | 67% |
| 97% | 86% | 74% | 54% | 30% |
| 95% | 77% | 60% | 36% | 13% |
| 90% | 59% | 35% | 12% | 1.5% |
Real steps are not fully independent, and some errors are harmless. But the direction holds: a five-step demo looks reliable, and the same agent on a 40-step claim or credit file finishes few cases correctly.
Where do errors come from in a real workflow?
- Reading. A date is pulled from the wrong field, or a scanned table is misread.
- Lookup. The agent matches the wrong policy or customer record.
- Arithmetic. Models are unreliable calculators when they do the math themselves.
- Rules. The agent applies last year's guideline, or skips a check under pressure from the prompt.
- Drift. The model gives a different answer on a re-run. Inference servers are not perfectly deterministic, even at temperature zero, as Thinking Machines Lab showed in 2025.
- Injection. A document contains text that steers the agent. See prompt injection defence.
How do you make long workflows reliable?
1. Move every step with a known right answer into code
Lookups, calculations, date checks, threshold checks and field mapping have one right answer. Run them as code. A coded step is right every time it gets the right inputs, so it drops out of the multiplication. Anthropic's agent guidance makes the same point: prefer simple, predefined workflows where the task allows it.
2. Check outputs between steps
Make every AI step return typed fields (dates, amounts, IDs) and validate them before the next step runs. An invalid date or an amount outside a sane range stops the run instead of spreading.
3. Stop early on missing evidence
If a required document is missing, stop and ask for it. Guessing turns one missing item into many wrong steps.
4. Put people where the risk is
Approvals on payments, denials, filings and account openings catch what the checks miss. Over time, most cases need approval only at those points.
5. Test every change against past cases
When an expert corrects a result, do not just patch the prompt. Replay the fix against past cases and see what else it changes before it goes live. See how Context learns from corrections.
Worked example: a 24-step auto claim (fictional)
This example is fictional. The accuracy numbers are illustrative.
An auto claim workflow has 24 steps: 8 reading steps, 10 lookup, calculation and rule steps, 4 drafting steps and 2 system writes.
All steps by an agent at 96% each: 0.96 to the power of 24 is about 38%. More than six in ten claims need rework somewhere.
The 12 rule-based steps (lookups, calculations, rules and system writes) moved to code: 12 AI steps remain. At 96% each, that is about 61%. Add schema checks that catch half of the reading errors and each reading step rises to about 98%, which brings the workflow to roughly 72% (0.98 to the power of 8, times 0.96 to the power of 4).
Add an adjuster approval before payment: the adjuster reviews a short summary with the evidence, catches most of the remaining errors, and approves. Errors that reach the claims system become rare, and the adjuster reviews a summary instead of rebuilding the file.
The model did not get smarter. The workflow did.
Where do teams go wrong?
- Testing on five-step demos. Test on your real, longest workflows and your closed files.
- Using one big prompt. A single prompt that does everything has no checkpoints.
- Letting the agent do arithmetic. Use code.
- Measuring per-step accuracy only. Measure end-to-end: the share of cases finished correctly with no rework.
- Letting memory change behaviour silently. Every change to how cases are handled should be tested and approved.
How does Context Labs fit in?
Context Labs (thecontextlabs.com) is an AI workforce platform for insurance, banking and private equity. Context Labs learns how your experts run multi-hour workflows, pairs AI judgment with deterministic execution, and pauses for human approval on critical steps. Validated steps become fixed, tested code over time. In Context Labs' internal benchmark, steps per task fell 61% by week 12, and task success reached 93% against 64% for Claude Cowork with skills and memories and 57% for OpenAI Codex with skills.
Read more: deterministic AI agents and the Context agent harness.
FAQ
Why do AI agents work in demos but fail in production?
Demos use short, clean workflows. Production workflows are long and messy, and small error rates at each step multiply. A step that is 95% accurate looks good alone, but twenty of them in a row finish correctly only about a third of the time.
Does a better model fix compounding errors?
It helps, but it does not remove the problem. A model that is 99% accurate per step still finishes a 40-step workflow correctly only about two-thirds of the time. Moving known-answer steps into code helps more than a model upgrade.
Is temperature zero enough to make an agent deterministic?
No. Temperature zero reduces randomness, but inference servers can still return different outputs for the same input because of batching and floating-point effects. Fixed code is the reliable way to get the same result every time, so use it for every step that has one right answer.
How do I measure agent reliability?
Measure the share of cases completed correctly end to end with no rework, on your own historical cases. Track it by workflow and by step so you can see which steps fail. Per-step accuracy alone hides the problem, because a workflow of accurate steps can still fail often once the steps are chained.
What should a human still review?
Payments, denials, filings, account openings and anything that writes to a system of record. Also any case where evidence is missing or a rule conflicts with the facts. Give the reviewer a short summary with the evidence attached, so the approval is a real check and not a rebuild of the file.
Related guides
- AI judgment vs fixed rules: when to use each
- How to pilot insurance AI on your own closed claims
- Straight-through claims processing: what to automate
