AI agent
In shortAn AI agent is a system where a model plans, uses tools and checks results in a loop to reach a goal with little step-by-step guidance.
In plain words
A chatbot answers a message and stops. An agent works toward a goal over many steps. Anthropic's guide on building agents draws a line: workflows follow paths laid out in code, while agents let the model direct its own process and its use of tools. A 2022 research paper, ReAct, showed the pattern: the model alternates between reasoning about the next step and acting, for example by calling a search tool.
The loop in plain steps: understand the goal, pick a step, use a tool, read the result, decide what next, and stop when the goal is met, when it is stuck, or when a limit is hit. Standards like MCP connect agents to tools. A coding agent is an agent specialised for software work.
Why it matters
- More done, less typing: An agent can chain steps that you would do by hand, such as look up, compare, draft and file.
- Cost: Each loop turn is a new model call with a growing context. Many steps mean many tokens. Set step and spending limits.
- Errors compound: A wrong turn early can carry through later steps. Ask for checkpoints on important work.
- Security: An agent that reads outside content can be steered by hidden instructions (prompt injection). OWASP advises least privilege, so give the agent only the access it needs, and human approval for high-risk actions.
- Simple first: Anthropic advises to start with the simplest solution and add agent behaviour only when the task needs it.
Example
A support agent gets: "Customer 4711 says the parcel never arrived." It looks up the order with a tool, reads the carrier status, checks the refund policy, and drafts a refund offer. It stops and asks a human to approve the refund before anything is sent or paid. Each step used a tool; the final money step stayed under human control.
Common misconceptions
- "An agent is a chatbot with a new name." The difference is the loop and the tools, not the chat window.
- "Agents run safely on their own." They need limits, logs and approval for risky steps.
- "More autonomy is always better." For many tasks a fixed workflow is cheaper, faster and easier to test.
Questions and answers
What is the difference between an AI agent and a chatbot?
A chatbot replies to a message. An agent plans several steps, uses tools and checks results in a loop until the goal is met or a limit stops it.
What can go wrong with AI agents?
Wrong steps that compound, high token costs from long loops, and hidden instructions in outside content. Use step limits, spending limits, least privilege and human approval.
Do I need an agent for my task?
Often not. A single prompt or a fixed workflow is simpler. Use an agent when the steps cannot be known in advance.
Read next
- Tool use (function calling)
Tool use, also called function calling, lets a model request an outside action, such as a search or a calculation, which an app runs and feeds back.
- Coding agent
A coding agent is an AI tool that reads a codebase, edits files and runs commands and tests in a loop to finish a programming task.
- MCP (Model Context Protocol)
MCP (Model Context Protocol) is an open standard for connecting AI applications to external data, tools and workflows through one shared interface.
- Prompt injection
Prompt injection is an attack where text a model reads, such as a web page or file, contains instructions that make it act against its user.
- Reasoning model
A reasoning model spends extra tokens on hidden step-by-step thinking before it writes its answer, which helps on hard problems but costs more.