An AI agent is software that uses a language model to decide its own next steps, calls tools to act, checks the results and keeps going until a goal is met. This guide explains how agents differ from chatbots, the loop they run, the parts they are built from, real examples, and when you should not use one.
- An AI agent is a language model in a loop: it gathers context, takes an action with a tool, checks the result and repeats until the task is done.
- A chatbot answers one message at a time; an agent plans and executes several steps toward a goal with little supervision.
- Every agent has four parts: a model, tools, instructions and some form of memory or context management.
- Use an agent for open-ended tasks where the steps can't be scripted; use a fixed workflow when the steps are known in advance.
- Give agents narrow permissions, a sandbox and a way to verify their own work, and review what they produce.
What are AI agents?
AI agents are programs where a large language model decides what to do next, uses tools to do it, looks at the result and repeats until a goal is reached. You give an agent an outcome ("fix the failing test", "find three suppliers and compare their prices"), and the agent works out the steps.
Anthropic's engineering team puts the distinction precisely in Building effective agents: workflows are "systems where LLMs and tools are orchestrated through predefined code paths," while agents "are systems where LLMs dynamically direct their own processes and tool usage." The key word is direct. In an agent, the model chooses which tool to call, in what order and when to stop.
That definition rules out a lot of products marketed as agents. A chatbot that answers a question is not an agent. A script that sends every new email to a model and files the summary is a workflow. An agent is the version that can read the email, decide it needs to look up an order, call the order system, notice the order is missing, ask a colleague and then reply.
If you want the underlying technology first, read up on how large language models work. The rest of this guide assumes you know an LLM predicts text and can follow instructions.
How is an AI agent different from a chatbot?
A chatbot responds to one message and waits for you; an agent takes a goal and executes several steps toward it on its own. The model inside can be identical. The difference is the loop and the tools around it.
| Chatbot | Workflow | Agent | |
|---|---|---|---|
| Who decides the steps | You, one message at a time | The developer, in code | The model, at run time |
| Can act on systems | No, it only writes text | Yes, fixed actions | Yes, chooses among tools |
| Number of steps | One reply per message | Fixed | Varies with the task |
| Predictability | High | High | Lower |
| Good for | Questions, drafts, explanations | Repeatable processes | Open-ended tasks |
| Example | Asking for a regex | Summarize every support ticket | Fix a bug across five files and run the tests |
A useful test: if you have to paste the output of step one back into the chat to get step two, you are using a chatbot. If the system runs step two itself after checking step one, you are using an agent.
How do AI agents work? The agent loop
AI agents work by running a loop: gather context, take an action, verify the result, repeat. Anthropic describes exactly this cycle in its post on building agents with the Claude Agent SDK: "gather context, take action, verify work, repeat."
Here is what each step looks like for a coding agent asked to fix a failing test:
- Gather context. The agent searches the repository, opens the test file, reads the function under test and checks recent changes. Good agents search for what they need instead of loading everything.
- Take action. The agent edits the function, or runs a command to reproduce the failure. Each action is a tool call: "edit this file", "run this shell command", "fetch this URL".
- Verify. The agent runs the test suite and reads the output. If a linter or test fails, the error message becomes new context.
- Repeat or stop. If the tests pass, the agent reports back. If not, it goes around the loop again with what it learned.
Under the hood, each pass is an ordinary model call. The program sends the conversation so far plus a list of available tools; the model replies with either text or a request to call a tool; the program runs the tool and appends the result; then it calls the model again. Stripped down, it looks like this:
messages = [{"role": "user", "content": goal}]while True: reply = model.respond(messages, tools=TOOLS) messages.append(reply) if not reply.tool_calls: # the model thinks it is done break for call in reply.tool_calls: result = run_tool(call.name, call.arguments) messages.append(tool_result(call.id, result))Everything else in an agent product (planning, memory, permissions, subagents) is built around this loop. For a full working version with a real SDK, see how to build an AI agent in Python.
What are the parts of an AI agent?
Every AI agent is built from four parts: a model that reasons, tools that act, instructions that set the goal and rules, and memory or context management that keeps the relevant information in view.
The model
The model reads the situation and decides the next step. Stronger models make better decisions over long tasks, recover from errors more often and know when to stop. Anthropic calls the basic building block an "augmented LLM": a model given retrieval, tools and memory.
Tools
Tools are functions the agent can call: read a file, run a shell command, search the web, query a database, send a message. Each tool has a name, a description and an input schema, and the model picks tools based on those descriptions. Anthropic's advice is to design this agent-computer interface as carefully as a user interface, with clear names, good documentation and formats that are hard to get wrong (absolute file paths instead of relative ones, for example).
The Model Context Protocol (MCP) is an open standard for plugging tools and data sources into agents without writing a custom integration for each one. A coding agent with an MCP server for your issue tracker can read tickets and update them. Our guide to what MCP is covers how it works.
Instructions
Instructions tell the agent what the job is and how to behave: the goal, constraints, conventions and what "done" means. In coding agents, these often live in a file in the repository, such as CLAUDE.md for Claude Code or AGENTS.md for other tools, which the agent reads at the start of every session.
Memory and context
A model can only see what is in its context window. Agents need ways to keep the right information in view: searching files instead of reading all of them, summarizing old history when the conversation gets long (often called compaction), delegating side tasks to subagents with their own context, and writing notes that persist between sessions.
What are real examples of AI agents?
The most mature AI agents today are coding agents, followed by research agents, browser and computer-use agents, and support agents. They share the same loop and differ in their tools.
| Agent type | Example tools it uses | Typical task |
|---|---|---|
| Coding agent | File read and edit, shell, git, test runner | Implement a feature, fix a bug, open a pull request |
| Research agent | Web search, page fetch, note-taking | Compile a sourced report on a market or topic |
| Browser or computer-use agent | Clicks, typing, screenshots | Fill a form, collect data from sites without an API |
| Support agent | Knowledge base search, order lookup, ticket system | Resolve a customer question or escalate it |
| Data agent | SQL, Python sandbox, charting | Answer a business question from a database |
Coding agents
Coding agents are the clearest example because code gives them a fast, objective way to verify their work: the tests pass or they don't. Claude Code is described in its docs as "an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools." You can hand it a task such as "write tests for the auth module, run them, and fix any failures" and it will loop until the suite is green. OpenAI's Codex, GitHub Copilot's agent mode, Cursor and Gemini CLI work in a similar way. Our Claude Code tutorial walks through a first task.
Research and browser agents
Research agents run many searches, read the pages, and write a report with citations. Browser agents operate a real browser by looking at screenshots or page structure and clicking. They are useful for sites without an API and slower and less reliable than an API call when one exists. We cover the current state in AI browser automation.
Support and operations agents
A support agent can search your help center, look up an account and draft or send a reply, escalating to a person when confidence is low or the request is sensitive. Operations agents read logs and alerts and propose fixes. In both cases, the design question is which actions the agent may take alone and which need approval.
When should you use an AI agent, and when not?
Use an AI agent when the task is open-ended, the steps can't be scripted in advance, and there is a way to check the result. Use a fixed workflow, or a single model call, when the steps are known.
Anthropic's guidance is to "start with the simplest solution" and add complexity only when it measurably improves results. Agents trade cost, speed and predictability for flexibility, and errors can compound over many steps. A simple decision guide:
- Can one well-written prompt with the right context do the job? Use a single model call.
- Are the steps always the same? Write a workflow: a chain of model calls and code with checks between them.
- Do inputs fall into a few known categories? Route each category to its own prompt or model.
- Are the steps unknown until you start, and can success be checked? Now an agent is a good fit.
- Is a mistake expensive or irreversible? Keep a person in the loop for that step, whatever you choose.
Good first agent tasks share three traits: a clear finish line ("all tests pass", "the report answers these five questions"), a safe place to work, and an output a person can review before it matters, such as a pull request or a draft.
Poor agent tasks have fuzzy goals, no feedback signal, or actions that can't be undone, like wiring money or deleting customer data.
How do you use AI agents safely?
You use AI agents safely by limiting what they can touch, running them in isolation, giving them a way to verify their work and reviewing their output before it reaches anything important.
- Least privilege. Give the agent only the tools and credentials the task needs. A coding agent needs your repository, not your production database password.
- Isolation. Run agents in a container, virtual machine or separate server so a bad command can't harm your main machine. This matters more as agents run longer without supervision.
- Approval gates. Most agent tools let you require confirmation for risky actions such as shell commands, network access or pushing code. Loosen these gradually as you learn how the agent behaves.
- Verification built in. Tests, linters, type checks and screenshots let the agent catch its own mistakes before you see them.
- Watch for prompt injection. An agent that reads web pages, issues or emails can be fed instructions hidden in that content. Treat any text the agent reads from outside as untrusted. Limit what an agent can do right after it reads outside content.
- Review the result. Read the diff, the report or the draft. Agents are fast and often right, and still make confident mistakes.
One practical snag with long-running agents is where they run. An agent working on your laptop stops when the lid closes or the machine sleeps. That is why people move agents to a remote server or use background coding agents that keep going while they are away. Orkio is one option for coding agents: it rents an always-on, isolated cloud box where agents such as Claude Code keep working after you close your laptop, and you review their pull requests later.
How do you get started with AI agents today?
The fastest way to understand agents is to use one on a real, low-risk task this week, then decide whether to adopt a product or build your own.
- Pick a task with a finish line. Examples: "add tests for this module until coverage passes", "summarize these 20 PDFs into a table with citations".
- Try an existing agent before building one. A coding agent like Claude Code or Codex, or the research mode in your chat assistant, shows you the loop in action.
- Write the instructions down. State the goal, the constraints and what done looks like, in a few short lines.
- Start with approvals on. Watch which actions the agent takes, then relax permissions for the safe ones.
- Check the output like a colleague's work. Read it, run it, question it.
- Build only when products don't fit. Start from a plain loop with an official SDK, and compare AI agent frameworks once you know what you need.
Frequently asked questions
Is ChatGPT an AI agent?
A plain chat conversation is not an agent, because the model answers and then waits for you. ChatGPT and Claude both include agent features, such as research modes and tools that browse, run code or operate a computer, and those features do behave like agents because they take several steps on their own.
What is the difference between an AI agent and automation like Zapier?
Classic automation follows a path you define in advance: when X happens, do Y. An agent decides the path at run time based on what it observes. Many real systems mix both, with fixed automation steps and an agent handling the part that needs judgment.
Do AI agents learn over time?
Most agents do not change their underlying model as they work. They improve within a task by reading feedback, and across tasks only if you give them memory, such as notes files, a database or project instruction files that persist between sessions.
Are AI agents safe to use?
They are as safe as the permissions you give them. An agent with access to production systems, email or payment tools can do real damage if it misreads a task or reads malicious instructions. Run agents in isolated environments, limit their tools and require human review for anything irreversible.
Can I build my own AI agent without a framework?
Yes. An agent is a loop that sends the conversation to a model, runs any tool the model asks for, appends the result and repeats. You can write that in under a hundred lines with an official model SDK and add a framework later if you need one.


