Last verified

Agents & tools AI glossary

What is an AI agent?

An AI agent is a system in which a language model directs its own process — choosing tools, reading results and deciding the next step — until a task is done, instead of following a fixed script.

At a glance

  • How it works: The model runs in a loop: plan, call a tool, read the result, decide again; each turn is a fresh model call carrying the whole history so far.
  • Why it matters: Agents can finish open-ended work — fix a bug, research a question, operate a browser — that a single prompt cannot.
  • What it costs: Many model calls per task, each resending a growing context: a 40-step job on Claude Sonnet 5.5 pays $2 per million on every uncached input token, every step.
  • Related to: Tool use, MCP, prompt caching, context window.

What makes something an agent

Anthropic's widely cited definition, from its December 2024 guide Building effective agents, draws the line by who is in control. Workflows are systems where LLMs and tools are orchestrated through predefined code paths. Agents are systems where LLMs dynamically direct their own processes and tool usage, keeping control over how they accomplish a task. A pipeline that always retrieves, summarizes, then formats is a workflow; a model that decides for itself whether to search, read a file or run a test is an agent.

Mechanically, an agent is tool use in a loop. The model is given a goal and a set of tools — often through MCP — and on each turn either calls a tool or declares the task done. Software around the model executes the calls and feeds back the results.

Why agents cost more

Anthropic is direct about the trade: agentic systems often trade latency and cost for better task performance, and their autonomy means higher costs and the potential for compounding errors. The reason is structural. A model keeps no memory between calls, so every step of the loop resends the instructions, the tool definitions and the full history — every earlier tool call and result — plus the new result. Input grows with each step, and a task of forty steps pays for its early context forty times.

That makes agent cost mostly input, and mostly repeated input — which is why prompt caching matters more for agents than for anything else. With the history cached, each step pays the cached rate for what it has already seen and the full rate only for what is new. Hidden reasoning between steps adds output on top.

Worked exampleOne 40-step agent task, cached and uncached

40 requests a month on Claude Sonnet 5.5, priced at its current list rates, checked on 2026-10-09.

No caching
Input · 2.4M tokens @ $2.00/M$4.80
Output · 24K tokens @ $10.00/M$0.240
Blended · per 1M tokens billed$2.08
Per request$0.126
Per month$5.04
History cached · 90% of input −79%
Input · 90% served from cache · 2.4M tokens @ $0.34/M$0.816
Output · 24K tokens @ $10.00/M$0.240
Blended · per 1M tokens billed$0.436
Per request$0.026
Per month$1.06

One task of 40 model calls, averaging a 60,000-token context per call as the history grows, with a short step of output each time. The per-month line here is the cost of the whole task. Caching the repeated history is the difference between the two columns.

Change the workload or the model in the LLM API cost calculator.

Kinds of agents, and where their tokens go

  • Coding agents read and edit a codebase, run commands and tests, and loop until the change works. File contents and command output are their bulk input. Our agents section prices the major ones route by route.
  • Research agents search, read and synthesize. Server-side search adds fees on top of tokens — Anthropic charges for web search per 1,000 searches, and every page the agent reads becomes input on later steps.
  • Computer- and browser-use agents operate a screen or a browser through screenshots and actions. The tool definitions alone are heavy: Anthropic documents that declaring its computer-use toolset adds about 4,500 input tokens to every request and its browser toolset about 6,600, before any screenshot — and each screenshot is billed as image tokens.

Measuring cost per task

Per-token prices do not describe an agent; cost per completed task does. It is roughly the number of steps times the cost of one step, where a step's cost depends on its context size, how much of that context is a cache hit, and how much the model writes. Log three numbers per task — steps, input tokens per step and cache-read share — and the bill becomes predictable. The worked example on this page prices one task this way.

The same numbers explain subscription agents. Every step draws on a plan's allowance, so a task that takes forty steps empties a usage limit forty times faster than a single question. To compare a plan with paying per token, price a typical task at API rates in the cost calculator, then ask how many such tasks the plan covers before its limit resets.

Controlling what an agent spends

  • Cache the stable prefix — instructions and tool definitions first, unchanged between steps.
  • Trim the history — clear stale tool results, or compact old turns into a summary; Anthropic offers both as API features.
  • Load fewer tools — every connected tool is input on every step; defer definitions until needed.
  • Cap the loop — a maximum number of steps and an output cap stop a stuck agent from running up a bill.
  • Route by step — use a smaller model for routine steps and a larger one for planning; see model routing.

Agents sold as subscriptions

Coding agents such as Claude Code, Codex and Cursor are often bought as flat monthly plans rather than per token. The cost model then changes shape: instead of a growing bill, heavy agent use runs into usage limits that reset on a timer. Our AI agents section prices every access route for the major tools — plan, API key, or bring-your-own model — on the same dated sources as the rest of the site.

When an agent is the right tool

Use an agent when the steps cannot be known in advance: debugging, open research, navigating an unfamiliar codebase. Use a workflow when they can — a fixed sequence of calls is cheaper, faster and easier to test. Anthropic's own advice is to find the simplest solution possible and increase complexity only when needed.

Frequently asked.

Short answers to the questions that come up next.

Q · 01 What is the difference between an AI agent and a workflow? +
In Anthropic's definition, a workflow orchestrates LLMs and tools through predefined code paths, while an agent lets the LLM dynamically direct its own process and tool use.
Q · 02 Why are AI agents so expensive to run? +
Each task takes many model calls, and each call resends the instructions, tool definitions and full history. Input grows with every step, so cost scales faster than the number of steps — unless the repeated history is cached.
Q · 03 How can I reduce agent costs? +
Cache the stable prefix, clear stale tool results or compact history, load only the tools a task needs, cap the number of steps, and route routine steps to a smaller model.
Q · 04 How many tokens does an agent task use? +
There is no typical figure: it is the number of steps times the context sent per step, and both depend on the task, the codebase or sources involved, and how much history the agent keeps. Log steps and input tokens per step for a sample of real tasks; with those and your cache-hit rate, the worked example's method gives the cost.
Q · 05 Is agentic AI the same as an AI agent? +
Not exactly. Agentic AI is the wider category — any system in which models plan and act over several steps, including fixed pipelines where code chooses every step. An AI agent is the kind where the model chooses its own next step. See agentic AI.
Q · 06 Are coding agents billed per token? +
Through an API key, yes. Many are also sold as monthly plans with usage limits instead — see our agents section for each tool's routes and prices.