Skip to content
Optimal Lab

AI Engineering · interactive

Why agents fail

An agent that gets each step right 95% of the time sounds reliable. Over 20 steps it finishes the task about a third of the time. Watch 20 runs of the same task, see how each one broke, and add the safeguards that catch each kind of slip.

20 runs · 20 steps each

7/20 finished

  1. 1✓
  2. 2✗
  3. 3✗
  4. 4✓
  5. 5✓
  6. 6✗
  7. 7✗
  8. 8✗
  9. 9✓
  10. 10✗
  11. 11✓
  12. 12✓
  13. 13✗
  14. 14✗
  15. 15✗
  16. 16✗
  17. 17✗
  18. 18✓
  19. 19✗
  20. 20✗
  • step ok
  • slip caught, redone
  • wrong tool
  • bad arguments
  • lost the goal
  • stuck in a loop
0%50%100%1102030steps in the task
no safeguards 36%

7 of 20 runs succeed (36% expected). Turn on the safeguards in step 4.

Steps in the task

1

Break the task into steps

Booking a trip is search, compare, pick, fill a form, pay, confirm. Each step is a model call and a tool call, and the run only succeeds if every step does.

20 steps · all must succeed

2

Every step can slip

Most steps work. The ones that don't fail in a few typical ways.

  • Wrong tool 30% of slips · 4 runs hereCalls search when it should call the booking API.
  • Bad arguments 30% of slips · 4 runs herePasses a date as “next Friday” or a made-up booking id.
  • Lost the goal 20% of slips · 2 runs hereAfter many steps it optimizes for a side detail and forgets the task.
  • Stuck in a loop 20% of slips · 3 runs hereRepeats the same call, gets the same result, tries again.
3

Small slips compound

The chance of getting every step right is the per-step chance multiplied by itself once per step. Long tasks need very reliable steps.

steps1510203090%90%59%35%12%4%95%95%77%60%36%21%99%99%95%90%82%74%
4

Catch slips where they happen

Each safeguard catches one kind of slip some of the time. A caught slip costs a retry instead of the run.

  • Check arguments against the schema and return tool errors to the model as observations, so it can retry.

  • The agent keeps a short to-do list in its context and checks each step against it.

  • Spot the same call with the same arguments twice, tell the model, and stop the run at a hard step limit.

each step ends well: 95% → 95%

5

Cap the run, and count

A loop with no cap runs until someone kills it: here, 40 steps of paid model calls. Cap steps and spend, and measure success over many runs, not one demo.

Runs that finished
7 / 20
Expected over many runs
36%
Steps burned by loops
98

Shorter tasks help as much as better steps: split a 30-step job into checked stages, or hand the risky step to a person.