Ask a language model a question and it hands back text. Useful — but it can't check whether its answer is right, look something up, or change anything. It guesses once and stops. An agent is what you get when you let that same model keep going.
One-shot call vs. an agent
A one-shot call is a vending machine: prompt in, text out, done. An agent is more like an assistant you've handed a goal. It can pick up a tool, use it, look at what came back, and decide what to do next. The difference isn't a smarter model — it's giving the model the ability to act and to react to what it sees.
The agent loop
Every agent runs the same cycle. Given a goal, the model decides on an action, takes it (usually by calling a tool), then observes the result. That observation goes back into the model, which decides the next action. The loop repeats until the goal is met — then it stops. The diagram below traces one trip around that loop.
- GoalWhat you want done — the task you hand the agent to start the loop.
- Model decidesThe brain. Each turn it looks at progress so far and picks the next action.
- Tool actsThe chosen action runs in the world — read a file, search, run a command.
- Observe resultWhat the tool returned feeds back into the model for the next decision.
In our stack — Claude Code is the harness that runs this loop. Anthropic's Claude model is the brain that decides each action; the loop keeps going — read a file, run a test, edit code — until your task is finished.
When you want an agent
Reach for an agent when the work is multi-step and the next step depends on the last result — fixing a failing test, researching across many sources, refactoring a codebase. If you can't script the steps in advance because you don't yet know what you'll find, that's exactly the gap an agent fills.