T2 · Beginner · 8 minMoving · Last reviewed: 2026-08-19Early draft

What Is an Agent?

In one line · An agent is a model + tools + a loop, working together toward a goal — not just one reply to one question.

Glossary:AgentLLMTool Calling
TL;DR

An agent isn't a different model — it's the same LLM, given tools (search, code, APIs) and left to loop: decide a step, execute it, observe the result, and continue until the goal is met. The core difference from a chatbot: an agent acts, it doesn't just talk.

Why it matters

Agents are the jump from 'AI that answers' to 'AI that gets work done': it researches, compares, writes and runs code, books and sends. Most of the exciting new products in the field are built on this pattern — and understanding it also tells you when it's overkill you don't need.

Imagine that instead of asking a colleague one question and getting one answer, you tell them 'handle this for me' and walk away: they open files, search, try things, retry, until they come back with the final result. That's an agent — except the colleague is a model, and its hands are the tools.

An analogy

A chatbot is like a hotline: you ask, it answers, done. An agent is like a field rep you dispatch with a mission: they have a phone, a car, and authority, and they keep moving and acting until the mission is done — then report back.

You tell the agent: 'compare the 3 cheapest flights to Cairo next week.' It calls a flight-search tool, reads the results, notices an airline is missing, searches again, sorts the prices, and returns a final table. Four steps it decided on its own — you only stated the goal.

How it works

The recipe has three parts: (1) the model — the brain deciding the next step, (2) tools — defined functions it can call (search, file reading, APIs), (3) the loop — simple code that takes the model's decision, executes the tool, feeds back the result, and asks 'what next?' until it says 'done.'

For developers

Technically it's built on tool calling: you send the model tool definitions (name + description + JSON schema), and it replies with either final text or a request to call a tool with arguments. The loop lives in your code — the model executes nothing itself; it requests and you execute. That's why permissions and limits are your responsibility.

Practice

🧪 Try it: take a real task like 'find which PDF library fits my project' and write down the steps you personally would take: search, open docs, compare, decide. Each step is a 'tool' plus a 'decision.' If the steps change based on what you find — that's an agent task. If they're fixed upfront — that's a workflow.

Common mistakes

The most common mistake: building an agent for a task whose steps are known and fixed. If you already know the steps, that's a plain workflow — write it as direct code, cheaper and more reliable. An agent is justified only when the steps themselves need in-the-moment decisions.

When to use it

Use an agent when the task is open-ended and the steps aren't known upfront: multi-source research, debugging, try-observe-adjust tasks. In short, when the value is in the model choosing the path itself.

When NOT to use it

Don't build an agent if one prompt solves it (summarize, classify), if the steps are fixed (a workflow), or if a single mistake is very expensive and there's no human oversight. Every loop iteration costs tokens and time — simplicity wins when it suffices.

LET'S BUILD ITDone reading — now build it yourself.Build a research agent