Learn Hub
AI AgentsFoundations

What is an AI agent?

An AI agent is a language model that uses tools in a loop until a task is done. Here is what that means and how it differs from a chatbot.

basics 6 min read Verified 20 Oct 2026

In 3 lines

  • What it is: An AI agent is a language model that can use tools, look at the results, and decide its next step by itself, again and again, until the job is done.
  • Why it matters: A chatbot only answers. An agent can actually do work, like searching, editing files, or booking a meeting.
  • Example: You ask, "Fix the broken link on my site." The agent finds the page, edits it, checks the result, and tells you when it is fixed.

Think of it like…

Real-world example

A small online shoe store gets 200 support emails a day. Many ask, "Where is my order?"

With a chatbot, a staff member pastes the email in, reads the suggested reply, opens the shipping system, finds the order, and writes back. The model only helped with the wording.

With an agent, the model gets the email plus two tools: "look up order" and "send reply." It reads the email and calls the order tool with the order number. Then it reads the tracking status and writes the reply. If the order number is missing, it asks the customer for it instead of guessing. Staff only check the tricky cases.

How it works

Every agent is built from three parts:

  1. A model — a large language model (LLM), the AI that reads text and writes text. It does the thinking.
  2. Tools — actions the model is allowed to ask for, like "search the web" or "run this code." Your program runs the tool, not the model.
  3. A loop — the program keeps going round until the task is finished.

One trip around the loop looks like this:

  1. The model reads the goal and everything that has happened so far.
  2. It decides on one next action and asks for a tool.
  3. The program runs the tool and gives the result back to the model.
  4. The model checks the result. Is the job done? If not, go back to step 1.
The agent loop
 Goal ──► Model decides next step ──► Tool runs
              ▲                            │
              └──── not done ◄── Result ◄──┘
                                   │
                                  done ──► Answer

The diagram shows the loop: decide, act, see the result, repeat until done.

This "think, then act, then look" pattern was described in a 2022 research paper called ReAct. It showed that mixing reasoning steps with actions works better than doing only one of them.

Agent or workflow? Anthropic draws a useful line. In a workflow, a programmer fixes the steps in advance in code. In an agent, the model chooses its own steps. Workflows are more predictable. Agents are more flexible, but cost more and are harder to control.

Common mistakes

  • Using an agent when one model call would do. Agents are slower and cost more. Try a single, well-written request first and add a loop only if you need it.
  • No stopping rule. An agent can loop forever or keep making the same mistake. Set a limit, such as a maximum number of steps.
  • Vague tools. The model only knows what a tool does from its name and description. Write tool descriptions as clearly as you would for a new coworker.
  • No human checkpoint for risky actions. Sending money or deleting data should pause for a person to approve.
  • Small errors pile up. One wrong step early can send the whole run in the wrong direction. Test in a safe sandbox before giving real access.

Remember this

Quiz

Question 1

Q1.What makes an AI agent different from a plain chatbot?

Question 2

Q2.In an agent, who actually runs the tool (for example, the web search)?

Question 3

Q3.Your task always follows the same 3 fixed steps. What is usually the better choice?

Question 4

Q4.Why should an agent have a stopping rule, like a maximum number of steps?

Go deeper

Done reading?

Mark it learned and the site will remind you to review it before you forget. Review page

Sources

Facts last checked against these on 20 Oct 2026.

On this page