Agents without code: long-horizon failure and permission scope

A chatbot answers once. An agent gets a goal and a set of tools, then loops: the model writes which tool to use, the software runs it and pastes the result back, until the model decides it is finished. A made-up fact in a chat is a wrong sentence; in an agent it is a wrong action.

In Daveth Pro (AI Engineering)

What this page answers

What is an AI agent, in plain words?

A model given a goal and tools such as search, click and send. It loops, choosing a tool, reading the result and choosing again, until it decides the job is done. Read it in “What an agent is”

Why do AI agents fail on long tasks?

Small chances of error multiply: a step that works 95% of the time gets a 20-step task through without a mistake only about 36% of the time. Strong agents notice mistakes and recover. Read it in “Why long tasks fail”

What an agent is

A chatbot answers once. An agent gets a goal (“find three flights under €200 and put them in a table”) and a set of tools: search the web, click, type, read a file, send an email. Then it loops. Each turn, the model writes which tool to use next; the software runs it and pastes the result back; the model reads the result and decides the next step, until it decides it's finished.

Nothing new happens inside the model. It's still predicting likely text; the text just happens to be an instruction the software carries out. That's why everything from lessons E2 and E4 still applies, with higher stakes: a made-up fact in a chat is a wrong sentence, but a made-up step in an agent is a wrong action.

Why long tasks fail

Every step has some chance of going wrong, and one wrong step can derail the whole task. Small chances multiply. A reliable-sounding step quickly becomes an unreliable task.

Predict first. Each step works 95% of the time. What share of 20-step tasks get through without a single mistake?

  • about 95%
  • about 75%
  • about a third

Answer. About 36%: 0.95 multiplied by itself 20 times. Agents that do well on long tasks don't have perfect steps; they notice mistakes and recover, and that ability is what separates strong agents from weak ones.

95.0%

20

How to read the chart: the curve is the chance that a task gets through every step without a mistake, for tasks from 1 to 50 steps long, at the per-step success you chose. The dot is the task length you chose.

At 95.0% per step, a 20-step task gets through without a mistake 35.8% of the time.

A real agent, measured

In Track A of this course I built a small coding agent on a free model and gave it 30 little bug-fixing jobs, each checked by tests it couldn't see. I also gave the same model the same 30 jobs as a single question: “here's the code and the problem; write the fix.”

How to read the chart: jobs fixed out of 30, for each approach.

Drawing: Jobs solved by agent loop and single question.

The single question won, 25 to 7. The agent averaged 8.7 steps per job and stumbled on the loop itself: 20 runs included replies that weren't a usable action, 27 included edits that didn't match the file, and 20 ran out of steps. It also read about 64 times as much text per job, which on a paid service is what you pay for.

This was a small, free model; commercial agents are far better at the loop. The lesson that carries over is the chain chart above: the more steps a job takes, the more ways it can go wrong, so give agents jobs that are short or easy to check, and use a single good question when that's enough.