How AI Agents Work: A Loop, Not a Brain
Most explanations of AI agents describe what they can do for you. Almost none explain what’s actually happening while they do it, which is a shame, because the mechanism is simple, and once you’ve seen it every strange thing an agent does stops being strange.
There’s no extra intelligence in an agent. It’s the same model you already chat with, called repeatedly in a loop, with the ability to do things between calls.
The loop, in four steps
Anthropic’s engineering team defines agents as “systems where LLMs dynamically direct their own processes and tool usage.” Stripped down, that means the same four steps, over and over:
- Read. The model gets your request, plus everything that’s happened so far.
- Decide. It picks one action (search this, open that, send this) and writes out the request in a structured format.
- Act. Ordinary software, not the model, carries out that action and collects the result.
- Observe. The result gets handed back to the model as new information. Then back to step one.
That’s it. The loop runs until the model decides the job is done, or until something stops it. The idea of interleaving reasoning with action this way comes from a 2022 paper called ReAct, and essentially every agent you can buy today is a descendant of it.
The part worth sitting with is step three. The model doesn’t open your calendar. It produces text saying it would like to open your calendar, and a piece of conventional software does the opening. Every “action” an agent takes is a A structured request the model writes out: the name of a tool and the details to run it with, which surrounding software then executes for real. The model can only ask; it can’t reach into anything itself. That’s why what an agent is allowed to do is a permissions question, not an AI question. , and the tools it has are the entire boundary of what it can do.
It can’t see what it didn’t just look at
Between steps, the model has no memory of your systems and no ongoing view of anything. Each turn of the loop, it sees only what’s been fed back into it: your original request and the results of the actions so far.
This is why agents ask for things you feel they should already know, and why they’ll confidently act on a stale version of something that changed five minutes ago. Nothing is watching on their behalf. They looked, once, and that snapshot is now just text in a list.
It’s also why giving an agent a clear, complete brief matters more than it does in a normal chat. In a chat, you correct as you go. In a loop, your brief is the only steering it gets for the next twenty steps.
Why short jobs work and long jobs fall apart
Here’s the bit that explains the A fixed set of tasks everyone runs their AI system against, so the scores can be compared. The catch is that a benchmark only measures the tasks it contains, which is why two of them can rate the same system as brilliant and hopeless without either being wrong. numbers everyone finds confusing: agents scoring above 85% on one test and 20.6% on another, both true, both current.
Every turn of the loop is a chance to be slightly wrong. And those chances multiply rather than average out.
Take an agent that gets each individual step right 95% of the time. That’s a good step. Now run the loop:
| Steps | Chance the whole job is right |
|---|---|
| 5 | 77% |
| 10 | 60% |
| 20 | 36% |
Nothing degrades. The model is exactly as capable at step twenty as at step one. It’s just that “right nineteen times out of twenty” and “right twenty times in a row” are wildly different things, and only the second one gets you a finished task.
That table is a simplification: real errors aren’t independent, and agents do recover from some of their own mistakes. The shape is what matters here. AI Agents Completing Tasks: Give Them Minutes, Not Hours runs the same arithmetic against the actual benchmark step counts, which is a bleaker and more specific picture than this one.
Anthropic names this directly as the tradeoff of the agent approach: more autonomy in exchange for cost and “compounding errors.” One benchmark of computer-use agents logged an average of 318 tool calls per task. At 318 chances, a per-step accuracy that sounds excellent produces a coin-flip at best.
Worse, an error at step three doesn’t announce itself. It becomes part of what the model reads at step four, and every step after that reasons confidently from it. Researchers cataloguing why these systems fail (a 2025 taxonomy built from more than 1,600 annotated runs across seven frameworks) put a whole category on exactly this: nobody verifies the intermediate work, so a wrong turn early just propagates.
What this changes about using one
Four things follow directly from the loop, and none of them require knowing anything technical:
- Give it fewer steps. The single biggest lever on whether an agent succeeds is how many turns the job takes. Cutting a task in half does more than any prompt wording.
- Front-load the brief. It steers on what you gave it at the start. Anything you’d have said in a follow-up message, say now.
- Check the middle, not just the end. The output will look finished either way. A confident summary built on a wrong number at step three is the normal failure, not the exotic one.
- Treat the tool list as the risk. What an agent could do wrong is exactly the set of tools it was handed. That’s a decision someone makes, and it’s reviewable.
The takeaway
An agent is a loop: read, decide, act, observe, repeat. The model only ever writes requests; ordinary software does the doing. It sees nothing between turns except what’s been handed back to it.
That single picture explains the whole category: why permissions matter more than capability, why a great brief beats a clever prompt, and why the same system can be superhuman on a five-minute job and useless on an afternoon’s work. Ask how many steps this will take. That question predicts success better than anything else you can ask about an AI agent.
Sources: the definition of an agent, the loop, and the “compounding errors” tradeoff are from Anthropic’s Building Effective Agents (opens in a new tab). Interleaving reasoning with action comes from ReAct: Synergizing Reasoning and Acting in Language Models (opens in a new tab) (Yao et al., 2022). The failure taxonomy built from 1,600+ annotated runs is Why Do Multi-Agent LLM Systems Fail? (opens in a new tab). Note it studies multi-agent systems specifically, so I’ve used it only for the point about unverified intermediate steps, which is not unique to them. The 85% and 20.6% benchmark scores and the 318-tool-call average are sourced in the post below. The compounding table is my own arithmetic (0.95 raised to the number of steps), offered as an illustration of the shape, not as a measurement of any real system.
Related: What AI ‘Agents’ Actually Do, and What They Can Do for Your Day is the companion to this one. That post covers what agents can do, this one covers how. AI Agents Completing Tasks: Give Them Minutes, Not Hours has the benchmark numbers behind the compounding problem and where the practical line falls.