An agent is a system where the model decides the next step at runtime, in a loop. Instead of your code saying "do step 1, then step 2, then step 3", you give the model a goal and a set of tools. After each result comes in, the model works out what to do next. The loop runs until the model decides it has enough for a final answer.
Who decides the next step#
That is the one structural difference from a workflow.
| Workflow | Agent | |
|---|---|---|
| Who picks the next step | Your code | The model |
| When the steps are known | Before the request arrives | Only at runtime, one at a time |
| What you hand over | A fixed pipeline | A goal and a set of tools |
An agent is tool calling in a loop#
Mechanically, an agent is tool calling run in a loop.
- The model returns a tool call.
- Your code runs it and sends the result back.
- The model decides again: call another tool, or stop and answer.
A single tool call is one round trip. What makes a system an agent is that the model drives the loop:
- it controls how many iterations run, and
- it decides when to stop.
Your code still runs every tool and remains the safety boundary. The model only decides what to ask for next.
Short line#
An agent is a tool calling loop where the model, not your code, decides the next step after each result, how many iterations to run, and when to stop. That is the one structural difference from a workflow.
Key takeaways#
- An agent gets a goal and tools, and decides the next step after each result.
- The only structural difference from a workflow is who decides the next step.
- Mechanically, an agent is tool calling in a loop.
- The model controls how many iterations run and when to stop.
- Your code still runs every tool and is still the safety boundary.