What an AI agent is

The difference between a chatbot, a workflow and an agent, how the agent loop works, a real example from a coding tool, and why permissions and checking matter more once AI can take actions.

Beginner8 min readUpdated November 29, 2026

Chatbot vs agent

A chatbot answers. You ask a question, it writes a reply, and anything that happens next is up to you. If it suggests a fix for a spreadsheet, you are the one who makes the change.

An agent acts. You give it a goal, and it works out the steps, uses tools to carry them out, looks at the results and keeps going until the goal is met or it gets stuck. It might search the web, open files, run code, fill in a form or send a message, depending on what tools it has been given.

The model underneath can be the same. What makes something an agent is the setup around it: access to tools, permission to use them and a loop that lets it take several steps on its own.

Chatbots, workflows and agents

It helps to separate three ideas that often get mixed together.

  • Chatbot. One question, one answer. The person decides every step.
  • Workflow. A fixed sequence of steps set up in advance, some of which use AI. For example: every time a form is submitted, have AI summarize it, then put the summary in a spreadsheet. The AI does not choose the steps. They are always the same.
  • Agent. The AI chooses the steps. Given "find out why the website build failed and fix it", it decides what to look at first, what to try and when it is done.

Workflows are predictable and easy to check. Agents are flexible but less predictable. Many useful systems are mostly workflow with a little agent where flexibility is really needed.

The agent loop

Most agents run some version of the same loop:

  1. Look at the goal and what is known so far.
  2. Decide on the next step: which tool to use and how.
  3. Act by calling the tool: run a search, read a file, run a command.
  4. Observe the result: the search results, the file contents, the error message.
  5. Repeat until the goal is reached, the agent decides it cannot proceed, or it needs to ask a person.

Each pass through the loop adds the result to the agent's context, so it can build on what it learned. This is also why agents use up context quickly on big tasks, as the context windows lesson explains.

A real example: a coding agent

Coding tools are among the most developed agents today, so they make a clear example. Anthropic's documentation describes Claude Code as an agentic coding tool that reads your codebase, edits files, runs commands and works with your development tools.

Say you ask it: "The tests are failing after my last change. Find out why and fix it." A typical run might go like this:

  1. It runs the tests to see the failures.
  2. It reads the error messages and opens the files involved.
  3. It forms a guess about the cause and edits a file.
  4. It runs the tests again.
  5. If they still fail, it looks at the new error and tries again. If they pass, it tells you what it changed.

You did not tell it which files to open or which commands to run. It chose them, based on what it saw at each step. That is the agent loop in practice. The Claude Code track on this site walks through installing it and running a first session.

Tools and connections

An agent can only do what its tools allow. A research agent might have web search and a notes file. A coding agent has file editing and a terminal. A personal assistant agent might connect to email and a calendar.

A common way to plug tools into AI apps is the Model Context Protocol, or MCP. Anthropic's Claude Code docs describe it as an open standard for connecting AI tools to external data sources, such as design documents, ticket systems or chat. Many AI apps now support it, and LocalUseCases has a guide to MCP setups that work with local models.

Why permissions matter

When AI only writes text, a mistake costs you a bad draft. When it takes actions, a mistake can delete a file, send an email to the wrong person or change something you cannot easily undo. That changes how careful you need to be.

  • Give the least access that works. An agent that only needs to read your files should not be able to delete them.
  • Ask for approval on risky steps. Good agent tools let you approve actions before they happen. Claude Code's quickstart, for example, describes permission modes that set which actions it can take without asking first, and says it asks before making a change unless you allow otherwise.
  • Keep an undo. Use version control for code, backups for files, drafts instead of sent emails.
  • Watch for instructions hidden in content. An agent that reads web pages or emails may come across text designed to trick it into doing something else. Be very cautious about agents that both read untrusted content and can take important actions.
  • Instructions are not locks. Anthropic's docs note that instruction files like CLAUDE.md are treated as context, not enforced configuration, and point to separate settings and hooks for blocking actions. In general, if something must never happen, use a real permission setting, not a polite request in the prompt.

How agents go wrong

Agents fail in different ways from chatbots, and knowing the patterns helps you spot trouble early.

  • Going in circles. The agent tries the same fix again and again, or alternates between two approaches. A sign to stop it and give clearer direction.
  • Declaring victory too soon. It reports the task as done when it only did part of it, or made a check pass by weakening the check. Always verify the result yourself.
  • Wandering off scope. Asked to fix one thing, it "improves" several others you did not ask about. Say what is out of bounds.
  • Building on a wrong guess. An early misunderstanding gets baked into every later step. Asking it to explain its plan before acting catches many of these.
  • Running out of context. On long tasks, early details can drop out of view, and the agent forgets a constraint you gave at the start. Shorter tasks and standing instruction files help.
  • Small errors with real effects. A wrong file path or a wrong recipient is a typo in a chatbot and a real problem in an agent. That is why approval steps exist.

Agents you may already be using

The word "agent" is used loosely in marketing, but agent-like features are becoming common. AI assistants that search the web several times and combine the results, research modes that work for minutes before returning a report, coding tools that edit and test code, and office assistants that can carry out multi-step tasks in documents all use some version of the loop above. Microsoft's support page for its Copilot app, for example, describes a mode for delegating multi-step tasks. When you meet one, the same questions apply: what can it access, what will it do without asking, and how will you check the result?

When an agent is worth it

Agents shine when a task has many steps, the steps depend on what you find along the way, and the result is easy to check. Examples: fixing a failing test, gathering information from several sources into one document, tidying up a folder of files with clear rules.

They are a poor fit when the task is a single step, when mistakes are costly and hard to undo, or when you cannot easily check the result. For those, a chatbot or a fixed workflow is usually safer and cheaper.

Working with an agent well

  • Give a clear goal and a clear finish line. "Fix the failing login test and make sure all tests pass" is better than "improve the login code".
  • Let it explore before it acts. Ask it to look around and explain what it found before changing anything.
  • Break big jobs into smaller ones. Shorter tasks are easier to check and less likely to drift.
  • Review the result, not just the summary. Read the changes, open the document, check the email before it goes.
Agent task prompt
Look through the project and explain how user sign-up works, listing the files involved. Don't change anything yet. Then propose a plan to add email verification, and wait for my OK before editing.

Try it

If you have access to an assistant with tools such as web search, give it a small multi-step goal: "Find the opening hours of three libraries near [your area], put them in a table with links to the pages you used." Watch the steps it takes, then open the links and check the table. You are seeing a simple agent loop, and practising the checking habit that matters most.

Questions people ask

Is every AI with web search an agent?

Not quite. A chatbot that runs one search before answering is using a tool. It becomes more agent-like when it decides on several steps in a row and acts on what it finds.

Can agents run without me watching?

Some can, and some tools are designed for long unattended tasks. Start with tasks where you review the result before it has any real-world effect.

Are agents safe to connect to my email or bank?

Treat that as a high-risk setup. Use the tool's approval settings, give the narrowest access possible, and avoid letting an agent both read untrusted content and take actions you cannot undo.

Sources: Microsoft Support: Get started with the Microsoft Copilot app · Claude Code docs: Overview · Claude Code docs: Quickstart · Claude Code docs: How Claude remembers your project

On LocalUseCases: What Claude Code is · MCP use cases: tools you can wire to a local model