An AI agent is a language model that calls tools in a loop until a job is done. That's the whole definition LangChain's docs use, and OpenAI and Anthropic describe the same thing in longer words.
The confusing part is everything else that gets called an agent. A chatbot isn't one. Most "AI automations" aren't either. An AI browser agent that clicks through a website to finish a task for you is.
And both OpenAI and Anthropic tell builders to try something simpler first.
This guide covers how the agent loop works, the parts every agent needs, how agents differ from chatbots and workflows, the classic and modern types, documented real examples, and when you shouldn't use one at all. Every definition below comes from official docs and guides.

What is an AI agent, in plain English?
An AI agent is software that takes a goal, decides its own next step, uses tools to act on the world, checks the result, and repeats until the goal is met or it hits a limit.
OpenAI's guide to building agents puts it in one line: "Agents are systems that independently accomplish tasks on your behalf." Google Cloud's explainer says nearly the same: software systems that use AI to pursue goals and complete tasks for users.
The word that matters is decides. OpenAI is explicit that apps which use an LLM but don't let it control the workflow, such as simple chatbots, single-turn LLM calls or sentiment classifiers, are not agents.
Anthropic draws the line in a useful place. In its essay Building effective agents, it splits "agentic systems" into two kinds:
- Workflows: the LLM and tools follow predefined code paths that a developer wrote.
- Agents: the LLM directs its own process and tool use, and keeps control over how it finishes the task.
The idea itself is older than LLMs. Russell and Norvig's classic AI textbook defines an agent as anything that perceives its environment through sensors and acts on it through actuators. A thermostat fits that definition. What's new is that a language model is now the part doing the deciding.
My take: if you can draw every step of the process in advance, you're building a workflow. If the model has to work out the steps as it goes, you're building an agent.
How does an AI agent work? The agent loop
Every agent runs the same cycle. It perceives the situation, reasons about what to do, acts, then observes what happened.
- Perceive: read the goal, the conversation so far and the latest tool result.
- Reason: decide the next step, which might be calling a tool or answering.
- Act: call a tool, such as a web search, a database query, an API call or running code.
- Observe: take the tool's output back in as new information.
Then it goes around again. The 2022 ReAct paper from Yao and colleagues gave this pattern its name: the model writes reasoning and actions interleaved, so each thought can trigger an action and each result can change the next thought.

Anthropic stresses one detail here. The agent needs "ground truth" from the environment at every step, such as a tool result or the output of code it ran, to judge whether it's making progress. Without that, it's guessing in a circle.
So what stops it? A stop condition. OpenAI's guide lists the common ones: the model returns a final answer with no tool call, it produces a required structured output, it hits an error, or it reaches a maximum number of turns.
In n8n, that last limit is a setting on the AI Agent node called Max Iterations, and n8n's docs give its default as 10. Designing these limits well is its own discipline, and I break it down in my guide to loop engineering in AI.
What are the parts of an AI agent?
OpenAI names three core components: a model, tools and instructions. Anthropic adds memory and retrieval to the picture with what it calls the augmented LLM. Put together, you get four parts.
The model
The LLM is the reasoning engine. It reads the context, picks the next action and writes the final answer.
OpenAI's advice is practical: prototype with the most capable model to set a baseline, then try smaller, cheaper models for the steps that don't need the best one. A simple classification step rarely needs your top model. A refund decision might. I walk through context, tool calling and cost in how to choose an LLM for your AI agent.
Tools
Tools are what turn a model that talks into an agent that does things. OpenAI groups them into three kinds:
- Data tools: read information, such as querying a database or CRM, reading a PDF or searching the web.
- Action tools: change something, such as sending an email, updating a record or handing a ticket to a human.
- Orchestration tools: other agents, called as tools by a manager agent.
Each tool is described to the model with a name, a description and its inputs. The model reads those descriptions to decide what to call, which is why Anthropic says tool documentation deserves as much care as the prompt itself.
A growing share of tools now connect through the Model Context Protocol, an open standard for plugging AI apps into outside systems. My plain-English guide to MCP explains how those servers work.
Memory
Agents have two kinds of memory, and LangChain's docs keep them separate:
- Short-term memory: the conversation and the steps taken so far in the current run or thread.
- Long-term memory: facts kept across sessions, such as user preferences or past decisions.
Short-term memory fills up as the agent works, because every tool result is added to the context. Long tasks need a plan for that, such as summarising older steps.
Retrieval is a close cousin. Instead of remembering everything, the agent searches a knowledge base when it needs a fact. That's the idea behind retrieval-augmented generation (RAG), and an agent can use RAG as one of its tools.
Instructions and planning
Instructions are the system prompt: the agent's job, its rules, the steps to follow and what to do when something goes wrong. OpenAI recommends basing them on documents you already have, like support scripts or policies. I show how to write those instructions, with a template you can copy, in my guide to writing prompts for AI agents.
Planning is the model's ability to break a goal into steps. Some agents plan everything up front. Most modern ones plan a step, act, and re-plan after each result, which is the ReAct loop again.
Chatbot vs workflow vs AI agent: what's the difference?
The short answer: who decides the next step. In a chatbot, nobody decides anything beyond the reply. In a workflow, the developer decided every step in advance. In an agent, the model decides at run time.
That freedom comes in degrees, which is what people mean by agentic AI; I break down the five levels of autonomy in agentic AI and how it differs from chatbots in a separate guide.
| Chatbot | AI workflow | AI agent | |
|---|---|---|---|
| Who picks the next step | Nobody, it replies once | The developer, in advance | The model, at run time |
| Uses tools | Usually not | Yes, in a fixed order | Yes, chosen per step |
| Number of steps | One reply per message | Fixed | Varies with the task |
| Predictability | High | High | Lower |
| Cost and latency | Lowest | Low to medium | Highest, varies per run |
| Best for | Answering questions | Repeatable processes | Open-ended, changing tasks |
| Example | FAQ bot on a website | Summarise every new lead and post it to Slack | Research a question across many sources and write a report |

Google's version of this split uses three words: bots follow pre-defined rules, assistants respond to requests and let the user decide, and agents act on their own toward a goal.
Here's the catch. Many products called agents are workflows with an LLM step in the middle. That's not a criticism. For most business processes, a workflow is the better choice, and I come back to why below.
What are the types of AI agents?
There are two ways to answer this. The classic answer comes from AI textbooks and still shows up in most explainers. The practical answer comes from how people build LLM agents today.
The five classic agent types
Russell and Norvig's textbook sorts agents by how they decide. IBM's guide to agent types summarises the same five:
| Type | How it decides | Everyday example |
|---|---|---|
| Simple reflex | Fixed if-then rules on the current input only | A thermostat |
| Model-based reflex | Rules plus an internal picture of the world it keeps updated | A robot vacuum tracking which rooms it has cleaned |
| Goal-based | Plans actions that move it toward a goal | A route planner finding a path to a destination |
| Utility-based | Picks the action with the best expected outcome, not just any that works | A pricing system weighing margin against demand |
| Learning | Improves its behaviour from feedback over time | A recommendation system that adapts to clicks |

An LLM agent doesn't fit neatly into one box. It plans toward a goal, keeps a working model of the task in its context, and can weigh options. In textbook terms, it's mostly a goal-based agent with a language model doing the reasoning.
Modern LLM agent patterns
This is the list that matters if you're building something. Anthropic's essay describes five workflow patterns and one agent pattern:
- Prompt chaining: one LLM call's output feeds the next, with checks in between. Example: write an outline, check it, then write the draft.
- Routing: classify the input and send it to the right specialised prompt or model. Example: refunds, technical issues and general questions each go to a different path.
- Parallelisation: run sub-tasks side by side, or run the same task several times and vote.
- Orchestrator-workers: a lead model splits a task it can't predict in advance and hands the parts to worker calls.
- Evaluator-optimizer: one model writes, another critiques, and they loop until the result passes.
- Autonomous agent: the model uses tools in a loop based on feedback from its environment until it's done.
OpenAI adds a split for bigger systems. A single agent with good tools covers most needs. When one agent keeps picking the wrong tools or can't follow its instructions, you split the work across several agents, either with a manager agent that calls others as tools or with agents that hand off the conversation to each other.
My take: start with a single agent and a short list of clearly described tools. OpenAI's guide says the same, and multi-agent systems add a lot of moving parts to debug.
What are some real examples of AI agents?
These are documented by the companies that build or describe them. I'm not quoting any performance claims, only what each agent does.
Coding agents
Anthropic describes Claude Code as "an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools." That's the full loop: read, act, run the tests, read the result, fix.
Anthropic calls coding one of the best fits for agents, because automated tests give the agent clear feedback. It also says human review is still crucial before changes ship.
Browser and computer-use agents
These agents operate a browser or a whole desktop the way a person would. Anthropic's computer use tool, for example, gives the model screenshots plus mouse and keyboard control inside an environment the developer runs.
Consumer versions now ship inside browsers. I compared the main options, how they run and what they cost in my roundup of the best AI browser agents.
Customer support agents
Support is the other use case Anthropic highlights. A support agent chats with the customer, pulls order history and help articles through tools, and can take actions like issuing a refund or updating a ticket.
OpenAI's guide uses the same domain for its warning: actions like large refunds or cancelling orders should go to a human for approval until the agent has earned trust.
Agents in n8n
In n8n, an agent is a node. You connect a chat model and at least one tool to the AI Agent node, and n8n's docs say the agent then decides which tools to call to complete the task.
That makes n8n a good place to see the difference between workflows and agents side by side. Most of my n8n workflow examples are fixed workflows, and that's on purpose. An agent node only earns its place when a step needs judgement.
What can go wrong with AI agents?
More autonomy means more ways to fail. These are the risks the vendors themselves warn about.
- Compounding errors: Anthropic warns that an agent's autonomy brings "the potential for compounding errors". One wrong step early on feeds every step after it. A workflow fails in one known place. An agent can wander.
- Cost and latency: every loop is another model call. Anthropic says agentic systems trade latency and cost for better task performance, so a runaway loop shows up on your bill.
- Prompt injection: text the agent reads, such as a web page, email or document, can carry instructions that hijack it. I explain how this works in my guide to prompt injection.
- Excessive agency: OWASP lists this as a top LLM risk for 2025. OWASP traces it to three root causes: tools with more functions than the job needs, permissions that are too broad, and too much autonomy to act without a check.
OpenAI suggests two triggers for handing control to a human: when the agent keeps failing past a set number of retries, and before any high-risk action that's sensitive, irreversible or involves money. For the practical controls — tool permissions, approvals, sandboxes and hard limits — see my guide to AI agent guardrails.
When should you use an AI agent?
Use an agent when the steps can't be known in advance and a person would need judgement to do the task. Use a workflow when the steps are the same every time.
OpenAI lists three signs a task suits an agent:
- Complex decisions with exceptions, such as approving refunds.
- Rules that have become too tangled to maintain, such as vendor security reviews.
- Heavy reliance on unstructured data, such as reading claims documents or talking to customers.
If your task has none of those, OpenAI's guide says a deterministic solution may be enough. Anthropic goes further and recommends the simplest solution that works, which sometimes means no agentic system at all, just one good prompt with retrieval.
What I would actually do: write down the steps first. If you can, build the workflow and add a single LLM step where judgement is needed. Reach for a full agent only when the list of steps keeps changing.
For the full trade-off, including cost per run, risk and hybrid designs that put one agent step inside a workflow, read my guide to AI workflows vs AI agents.
Frequently asked questions
An AI agent is a model, a set of tools and a loop with a stop condition. If you remember only one thing, make it the question that decides everything: does the model need to choose the next step, or do you already know it?
If you already know it, build a workflow. If you don't, build one small agent with read-only tools and watch what it does.


