Skip to content
AI Dev Toolkit.
Esc
  • AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.Tool
  • LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.Tool
  • AI Model ComparisonCompare prices, context windows and features across models.Tool
  • AI Model Pricing PagesSpecs, real costs and cheaper alternatives for popular models.Tool
  • Context Window CheckerSee whether your text fits each model’s context window.Tool
  • Subscription vs API CalculatorFind out whether a chat plan or the API is cheaper for you.Tool
  • GPU / VRAM CalculatorCheck how much VRAM a local model needs and which GPUs fit.Tool
  • Prompt Caching CalculatorEstimate savings from prompt caching.Tool

AI glossary · Agents and tools

What is an AI agent?

Also called: LLM agent, agentic loop, agent loop

Definition

An AI agent is a program in which a language model works towards a goal by repeatedly choosing a tool to call, reading the result and deciding the next step, until the task is done or a stop condition is reached.

Explained

How it works

Anthropic draws a useful line between workflows, where your code fixes the sequence of model and tool calls in advance, and agents, where the model decides its own steps and which tools to use. Underneath, an agent is a loop: send the goal and the available tools, let the model ask for a tool call, run it, send back the result, and repeat.

The model never runs anything itself. Your code, often called the harness, executes each call and returns real results from the environment, such as test output or a file’s contents. That feedback is what lets an agent notice a mistake and fix it. The loop ends when the model replies without asking for a tool, or when a limit you set, such as a maximum number of turns, stops it.

Coding agents such as Claude Code are this loop with file, search, shell and web tools, plus context management: project instructions in CLAUDE.md, subagents for side tasks, and compaction when the context window fills up.

Example

Token growth in a 7-request coding loop

Claude Code’s docs walk through “fix the failing tests” as six tool calls: run the tests, read the error, search for the source, read it, edit it, and run the tests again. Each call is a new request, and each request sends the original messages, every earlier reply and every tool result again.

Assume a 15,000-token start (system prompt, tool definitions, project instructions and your message) and about 2,000 tokens added per tool round trip. These sizes are illustrative; the shape is not. The last request carries 27,000 tokens, but the seven together send 147,000, which is 5.4 times as much. At Claude Sonnet 5.5’s input price of $2 per million tokens that is $0.29 of input for one small fix, before output and before any prompt caching discount.

Input tokens sent per request (illustrative sizes)
RequestWhat the agent doesInput tokens sent
1Run the test suite15,000
2Read the failure output17,000
3Search for the relevant source files19,000
4Read those files21,000
5Edit the code23,000
6Run the tests again25,000
7Reply with the fix (no tool call)27,000
Total147,000

Price from our daily data, 2026-10-11. Output tokens are not included.

Cost and quality

Why it matters

Because every turn re-sends the conversation, an agent’s input bill grows roughly with the square of its number of turns when each turn adds a similar amount. Long tasks, large tool results and many tool definitions all multiply it. Prompt caching, shorter tool outputs and fewer turns are the main levers.

Quality depends on the feedback the agent can get. Anthropic stresses that agents need ground truth from the environment at each step, such as tests that pass or fail, and recommends starting with the simplest solution and adding an agent only when a fixed workflow falls short.

Don’t mix up

Common confusions

AI agent vs chatbot
A chatbot answers from what it was given in one reply. An agent takes actions through tools and loops on the results, so it can run code, edit files or query systems before it answers.
Agent vs workflow
In a workflow, your code decides the order of steps and the model fills in each one. In an agent, the model decides the steps. Workflows are more predictable and cheaper; agents handle tasks whose steps you can’t list in advance.

Go deeper

Try it and read more

Related

All 40 terms in the AI glossary