Agent Turn
An agent turn is the complete, billable interaction cycle with an AI agent. It is not just the message you send and the reply you get. Every single turn involves resending the entire working context to the model. This context includes the system prompt, all tool definitions, any files the agent has already read, and the complete prior transcript of your conversation. This constant resend is the primary driver of your AI agent costs, not the words you see on screen. Everyone optimizes how much the model writes. Writing is about an eighth of the bill. Our instrumentation of 157,670 deduplicated Claude Code API responses between April and July 2026 revealed that visible output accounts for only 12.1% of the Opus 4.8 spend. The vast majority of the bill, 87%, comes from context management: 48% from cache reads and 39% from cache writes. Anthropic's prompt caching documentation, verified July 26, 2026, prices these context operations. A cache read, where the agent reuses previously stored context, costs 0.1 times the base input rate. A cache write, which happens when context is stored for the first time or after its time-to-live (TTL) expires, costs 1.25 times the base input rate for a 5-minute TTL or 2 times for a 1-hour TTL. The crucial takeaway is that the cheapest per-token line item, the cache read, becomes the biggest line on your invoice because of its sheer volume. Every turn reads the entire, growing context.
An agent turn is not a simple chat message. In a traditional chat, each message might be a discrete event, or the context passed is minimal. With an AI agent, the "turn" is a heavy operation. It is also not primarily about the visible output you receive. Most people assume their bill reflects the length of the AI's response. This is incorrect. Anthropic's extended thinking documentation explicitly states that you are billed for the full thinking tokens, while the API returns only a condensed summary. This means a significant portion of what you pay for as "output" never reaches your screen. Our data on prose-only turns showed 2.7 visible characters per billed output token on Opus 5, compared to roughly 4.0 characters per token for plain English. About a third of your paid output is invisible reasoning. Crucially, turning off the reasoning panel in your interface does not reduce your bill; it only makes your terminal quieter. Optimizing for shorter answers targets only 12% of your total bill, while often degrading the quality of the agent's work. Hiding the thinking does not lower the bill. Lowering the effort does.
Imagine you are a designer using Claude Code to iterate on a complex user interface component in React. You are trying to refactor some legacy code.
**Turn 1: Initial Request.** You start a new session and paste your component code, prompting, "Refactor this React component to improve its accessibility and add a dark mode toggle." * **Cost Event:** The agent needs to ingest your code, the system prompt, and any pre-defined tool schemas. Since this is a new session, this is a **cache write**. If using Claude Opus 5, which has a base input rate of $5 per million tokens, this write costs 1.25 times that rate for the 5-minute TTL, so $6.25 per million tokens for your input context. The agent then processes this, generating internal reasoning tokens and finally the refactored code. The visible and invisible output tokens are billed at $25 per million tokens.
**Turn 2: Follow-up.** Five minutes later, you review the code and ask, "Can you also add a unit test for the dark mode toggle?" * **Cost Event:** Because you are within the 5-minute cache TTL, the agent resends the *entire* context: the original component, your first prompt, the refactored component, its previous response, your new prompt, and all system/tool definitions. This massive context is now a **cache read**, billed at a mere 0.1 times the input rate, or $0.50 per million tokens for Opus 5. The agent then generates the unit test, incurring more output token costs.
**Turn 3: Post-Coffee Break.** You take a 15-minute coffee break. When you return, you ask, "Can you explain the accessibility improvements you made?" * **Cost Event:** The 5-minute cache TTL has expired. The agent cannot simply read the cheap cached context. It must perform another **cache write** for the entire accumulated context, again at 1.25 times the input rate ($6.25 per million tokens). Then it generates the explanation.
This example shows how the context grows with each turn, and how idle time, even short breaks, can force expensive cache rewrites instead of cheap reads, dramatically increasing your bill without any new creative output from the agent. The variable is turn count multiplied by context size, not verbosity.
When to manage agent turns effectively: * **Aggressively prune context:** Before starting a new agent session, ensure your system prompt is concise, tool definitions are minimal, and any files you load are strictly necessary. Every token in that initial context will be resent on every subsequent turn. Fewer files in context, narrower reads, compact before the transcript bloats. * **End sessions decisively:** If you finish a task or anticipate a long break, explicitly end the agent session. Starting a fresh session later with only the necessary context can be cheaper than incurring a full cache rewrite after the default 5-minute TTL expires. A coffee break is a billable event in an agent workflow if you leave a session open. End a session instead of letting it idle past the TTL. * **Route turns intelligently:** For routine or less critical tasks, route agent turns to models with lower input rates. For example, Anthropic's Sonnet 5, with its introductory $2 per million input tokens, is significantly cheaper for context resends than Opus 5 at $5 per million. Reserve the higher-cost Opus models for turns demanding maximum reasoning or accuracy where the value justifies the increased input cost. Match the model to the input rate. * **Compact transcripts:** Implement strategies to summarize or prune the conversation history within a session. A shorter transcript means less context to resend on each turn, reducing cache read and write costs. This is context discipline, not prompt discipline.
When not to (avoid these common pitfalls): * **Do not chase shorter answers:** Asking an agent for a more concise response is a fool's errand for cost savings. Our data shows output tokens are only 12.1% of the bill. Halving the output might save you 6% at best, while likely degrading the quality of the agent's work. This is the AI token diet trap. The lever that does not work is asking for shorter answers. * **Do not ignore idle time:** Letting an agent session sit idle for more than Anthropic's default 5-minute cache TTL means your next turn will incur a full cache write at 1.25 times the input rate, instead of a cheap 0.1x cache read. This is a common culprit for unexpected bill spikes. * **Do not use expensive models for mundane tasks:** Deploying Claude Fable 5, with its $10 per million input tokens, for simple code refactoring or documentation tasks is financially irresponsible. The high input rate disproportionately impacts the 87% of your bill tied to context. Compare models on the input rate first. Output rate is a tiebreaker.
An agent turn is the full, billable cycle of context resend and processing, not just the visible output.
Read the full guide
Related terms
Keep exploring
AI Agent
An AI agent is a long-running model that reads your full repo, makes its own decisions about which files to edit, runs tests, opens PRs, and talks back when it gets confused instead of waiting for line-by-line instructions.
Context Window
The total amount of text, code, and conversation history an AI model can hold in active memory during a single session. Measured in tokens, not words.
Cache Read
A billing event where an AI agent retrieves previously stored context from its cache, typically at a significantly reduced token rate.
Cache Write
A cache write is a billing event where an AI agent stores new or refreshed context into its temporary memory, incurring a higher cost than merely reading existing cached information. It's the premium you pay for giving your agent a persistent working memory.
Input Rate
The base cost per token for an AI model to process incoming information, including system prompts, tool definitions, prior conversation history, and user input. It is the foundational price point that dictates the cost of context management in agentic workflows.
AI Session
A single continuous conversation thread with an AI model, from the first message to the last. Each session has its own context window that resets when a new session starts.