A chatbot answers a question and stops. An AI agent can search the web, run code, check the result, and try again — all on its own. Here's how that loop actually works, and where human oversight still matters.
The prompt engineering article in this series covered how to write instructions that get a good single response out of an AI model. An AI agent takes that same underlying language model and puts it in a loop: instead of producing one answer and stopping, it can decide on an action, carry that action out using external tools, look at what happened, and decide on the next step — repeating until the task is actually done. This guide looks at how that loop works, what "tools" actually means in practice, and why more autonomy also means more risk.
A standard chatbot interaction is a single round trip: a prompt goes in, a block of predicted text comes out, and the conversation waits for the next human message. Nothing outside that text generation happens automatically.
An agent changes the loop rather than the underlying model. The same language model is still just predicting text, but that predicted text can now include a structured instruction to use a tool — like "search the web for X" or "run this code" — which a surrounding system actually executes, feeds the result back in as new context, and lets the model predict its next step from there.
The model itself doesn't gain new abilities to "act in the world." What changes is the software wrapped around it, which watches for tool-use instructions in the model's output, actually runs them, and hands the results back — turning one prediction into a repeating cycle.
Most AI agents follow a repeating pattern often called ReAct — short for reason and act:
This continues until the model determines the task is complete, produces a final answer, or hits a limit set by the system, such as a maximum number of steps.
A tool is simply a defined function the surrounding system makes available, described to the model in terms it can request by name. Common tools include a web search function, a code execution environment, a calculator, a file reader, or a connector to an external service like a calendar or database.
| Tool Type | What It Lets the Agent Do |
|---|---|
| Web search | Retrieve current information beyond its training data |
| Code execution | Run calculations, process data, or test a solution |
| File access | Read or edit documents relevant to the task |
| External APIs | Interact with services like email, calendars, or databases |
The model never runs these tools directly — it only predicts a structured request to use one, which the system executes and reports back on.
For simple tasks, an agent can improvise one step at a time. For longer, multi-part tasks, many agent systems first ask the model to produce an explicit plan — a rough sequence of steps — before executing any of them, then revisit and adjust that plan as new information comes in from each tool result.
This planning step matters because a language model's reasoning is still built from the chain-of-thought principle covered in the prompt engineering article: writing the plan out explicitly gives the model a clearer, more specific context to reason from at each later step, rather than trying to hold an entire multi-step task in mind implicitly.
A coding agent asked to fix a failing test might plan to first read the relevant file, then run the test to see the exact error, then edit the code, then re-run the test to confirm the fix — observing and adjusting at each step rather than guessing the entire fix in one attempt.
Some tasks are handled by one agent working through a full loop on its own. Others split the work across multiple agents, each with a narrower role, coordinating with one another:
| Approach | How It Works | Trade-Off |
|---|---|---|
| Single agent | One model loop handles reasoning, tool use, and the full task | Simpler to build and debug, but can struggle on very complex tasks |
| Multi-agent | Separate agents specialise — one plans, one researches, one writes — and pass work between each other | Can handle more complex tasks, but adds coordination overhead and more places for errors to compound |
An agent that can take real actions — sending a message, deleting a file, spending money, editing production code — can also do real damage if it misunderstands the task or a tool result. The hallucination risk covered in the LLM and AI ethics articles doesn't disappear in an agent; it can compound, since a wrong assumption made at one step becomes part of the context for every step after it.
For that reason, most responsible agent systems limit autonomy deliberately: requiring human approval before sensitive actions, restricting which tools are available for a given task, capping the number of steps an agent can take unsupervised, and logging every action so it can be reviewed afterward.
Agent-style systems already show up in coding assistants that can read a codebase, make edits, and run tests; research assistants that search multiple sources and compile findings; customer support systems that look up an order and issue a resolution; and personal productivity tools that can check a calendar and schedule a meeting. In each case, the pattern is the same underlying loop — reason, act using a tool, observe the result, and continue — applied to a specific, bounded set of tools for that task.
An AI agent isn't a fundamentally different kind of intelligence from the chatbot covered earlier in this series — it's the same next-word prediction, placed inside a loop that can call real tools and react to real results. That combination is what turns a system that can only talk about a task into one that can actually carry part of it out, which is exactly why the oversight and verification habits covered throughout this series matter even more once a model's output can trigger a real action rather than just words on a screen.
10 questions. Select an answer for each, then submit to see your score instantly.