Planning in Agent Systems
An agent works by processing information, planning a sequence of actions, and deciding when the task is complete. Remove the last part and the agent has no reason to stop, and remove the judgment after each tool call and the agent cannot adjust its plan.
Asking What an Agent Can Actually Do
Suppose you are handed an AI agent and asked what it is able to do. Two questions come up almost immediately. First, where does it operate: what world does it perceive and affect? Second, what can it actually do inside that world? These questions are linked. The world an agent works in shapes the things it could possibly do, and the things it is equipped to do shape how much of that world it can reach.
This article follows that link. It then looks at how an agent works through a task one step at a time, and why long chains of steps are risky. Along the way you will trace a concrete run, see how each step feeds the next, and see why a small error rate per step can add up to a large chance of failure.
How the Use Case Defines the Environment
An agent's environment is defined by its use case, such as a game, the internet, a kitchen, or a road system.
The easiest way to find an agent's environment is to ask what it is supposed to act upon. An agent built to play a game has that game as its environment. An agent that scrapes documents from the internet has the internet as its environment. A cooking robot works in a kitchen. A self-driving car works in the road system and the areas beside it.
Once the environment is fixed, it determines which tools an agent could potentially use. A chess game is a useful case. The only possible actions for an agent inside it are the legal chess moves. Nothing outside the rules of the game is available to it.
Tools Expand and Limit the Reachable World
The relationship between environment and tools runs in both directions. Start with the environment, which determines the tools that could be used. Now read the relationship the other way. The tool inventory an agent carries restricts which environments it can actually work in. If a robot's only action is swimming, it is confined to a water environment, because on land it has nothing it can do. The tools fix the reachable world just as the world fixes the usable tools.
A model that only produces text has a small set of possible actions. Giving it tools adds to that set. ChatGPT is one example: it can search the web, run Python code, and generate images. Each of these capabilities is an action that is unavailable to a model with no tools at all. Many of these tools are simple, but each one still widens what the agent can do.
Retrieval-augmented generation (RAG) systems follow the same pattern. A RAG system can be viewed as an agent whose tools are a text retriever, an image retriever, and a SQL executor. Each tool is a specific capability the agent can call on.
A coding agent called SWE-agent, built on top of GPT-4, shows both ideas together. Its environment is a computer with a terminal and a file system. Its set of actions includes navigating a repository, searching files, viewing files, and editing lines. The environment supplies the places where those actions apply, and the actions are what let the agent change that environment.
Tracing a Multi-Step Sales Task
An agent is typically given a task by a user. It does not simply return one answer. It processes the task together with feedback from its environment, plans a sequence of actions, and decides when the task is finished. To see this in action, take a RAG system with tabular sales data. It has three actions: generating a response, generating a SQL query, and executing a SQL query.
Given the request to project sales revenue for a product over the next three months, the agent carries out a sequence of reasoning-and-action moments. The diagram below follows that run. Each step is a point where the agent settles on its next move, and each arrow is a choice it made based on what it had just learned. The agent returns to reasoning after every tool call, and the second round of queries exists only because the first round's output was judged insufficient.
Read the diagram from top to bottom. The user supplies the task. The planner decides on an action, the SQL executor carries it out, and the result returns to the planner. The planner then makes a decision that the source treats as part of the loop: whether the information is enough to finish. Because it was not enough in this run, the planner sent a second round of work to the tool before answering. The loop only ends when the planner judges the task complete.
Judging Progress and Knowing When to Stop
Two details in this run are worth noticing. The agent judges its own progress: it decides when the information is enough and when the task is complete. The judgment is part of the loop, not an afterthought. The source describes this as the AI component deciding whether the task has been accomplished, which is what allows the agent to stop.
An agent works by processing information, planning a sequence of actions, and deciding when the task is complete. Remove the last part and the agent has no reason to stop, and remove the judgment after each tool call and the agent cannot adjust its plan.
Compound Mistakes Across Many Steps
The sales run had seven reasoning-and-action moments. Each one is a place where the agent can go wrong: a query can be malformed, a result can be misread, or a plan can be poor. Because the agent needs many steps, its overall accuracy depends on how the individual steps combine, not only on how good any single step is. The source calls this the problem of compound mistakes.
The source gives a concrete case. If a model is 95% accurate per step, then over 10 steps the overall accuracy drops to about 60%, and over 100 steps it falls to about 0.6%. The pattern matches multiplying the 95% figure by itself once for each step. A small per-step error rate, repeated over many steps, adds up to a large chance that something has gone wrong somewhere along the way.
What do you think happens?
If each step is 95% accurate, roughly what is the overall accuracy after 10 steps?
Reveal answer
About 60%
Multiplying 0.95 by itself 10 times gives roughly 0.60. The source's figure for 10 steps is about 60%, and for 100 steps it drops to about 0.6%.
- 1The base 0.95 is the per-step accuracy.
- 2The exponent is the number of steps the task requires.
- 3Each extra step multiplies the total by another 0.95, so the total shrinks at every step rather than staying fixed.
- 4After 100 steps the chance of finishing correctly is well under one percent, even though each individual step is quite reliable.
Mistakes Learners Make About Agent Accuracy
Common mistake Assuming a 95% accurate step means a 95% accurate task
What it looks likeA 10-step task with 95% per step does not finish correctly 95% of the time.
Why it failsEach step must also be correct, so the per-step accuracies multiply together.
Do this insteadCompute the overall chance by repeating the per-step figure once for each step, which gives about 60% for 10 steps.
Common mistake Thinking an agent is finished whenever it produces an answer
What it looks likeThe sales run returned a second round of queries because the first round's output was judged insufficient.
Why it failsThe agent judges its own progress and only stops when it decides the task is complete.
Do this insteadTrace the loop: after each tool result, check whether the agent has decided to stop or to act again.
Common mistake Believing tools only add capability and never limit anything
Why it failsThe tool inventory restricts which environments the agent can operate in, as with a swimming-only robot on land.
Do this insteadRead the environment and the tools as constraining each other in both directions.
Why Agents Need Stronger Models
Compared with non-agent uses of a model, agents typically require more powerful models, and the source gives two reasons. The first is the compound-mistake effect just described: more steps means more chances for error. The second is that agents with access to tools can perform more impactful tasks, but any failure could carry more severe consequences. A text answer that is wrong can be ignored; an action that is wrong may have already changed something in the environment.
| Aspect | Single-turn text response | Agent running a multi-step task |
|---|---|---|
| Number of decisions | One response | Many planned actions, each judged before the next |
| Tools | Often none | Tool inventory widens the action set |
| Effect of a mistake | A wrong answer can be ignored | A wrong action may have already changed the environment |
| Chance of success | Depends on one output | Shrinks as each successive step must also be correct |
| Typical model demand | Less capable model may suffice | More powerful model typically needed |
Why the same model faces different demands as an agent
Cost works in the other direction too. A task that requires many steps takes time and money to run. The source argues that this cost can still be worthwhile, because autonomous agents can save a great deal of human time. Whether an agent is worth deploying depends on weighing that saving against the expense of running many steps and the damage a failure could cause.
Checking Your Understanding of a Trace
An agent is given a task with 20 steps, and each step is 95% accurate. Using the compound-mistake pattern, estimate the overall chance of finishing correctly and explain whether a stronger per-step accuracy would matter more than reducing the number of steps.
Hints
- Multiply 0.95 by itself once for each of the 20 steps.
- Compare the effect of raising the per-step figure with the effect of removing steps, using the 10-step and 100-step values in the source.
Name the three parts of the planner's job described in the source, then point to where in the sales-run diagram each one happens.
Hints
- The source names processing information, planning a sequence of actions, and deciding when the task is complete.
- Look for the moment the planner returns a result to the user, and the moment it chooses another query instead.
Key Takeaways
- An agent's environment is set by its use case, such as a game, the internet, a kitchen, or a road system, and that environment determines which tools could be used.
- Tools augment the set of actions an agent can perform, and the tool inventory in turn restricts which environments the agent can operate in.
- An agent completes a task by processing information, planning a sequence of actions, observing results, and deciding when the task is complete.
- Each extra step adds a chance of error, so a 95% per-step accuracy falls to about 60% over 10 steps and about 0.6% over 100 steps, which is why agents tend to need more powerful models.