# Why the cap you set doesn't cap what an agent spends > Anthropic states max_tokens doesn't bound a turn's spend in a tool loop. A ten-step turn under a 4,096 cap costs $1.02 on Opus 5, not $0.10. URL: https://getculpa.com/agent-loop-cost Last reviewed: 2026-08-05 Rates effective: 2026-07-02 ## Answer In a tool-use loop every request carries its own output cap, so the limit bounds a single step rather than the whole turn. Ten steps under one cap cost ten times it. Culpa, a local-first LLM cost, margin, and forecast ledger, prices every call and groups them by run, so a turn reports its own total rather than its steps. ## Why this happens Almost everyone treats the output cap as the cost ceiling on a request, and for a single call that holds. An agent isn't a single call. It's a loop: the model asks for a tool, your code runs it, the result goes back, and the model decides again. Anthropic says this plainly, that in a tool-use loop each request in the turn has its own cap so it doesn't bound the whole turn's spend. The ceiling anyone set applies per step and nothing applies to the loop. Two things then compound it. Reasoning interleaves with tool use automatically, so the model can think between every tool call, and that reasoning bills as output at each step. And the conversation grows: each step re-sends everything before it, so input tokens climb with step number while output stays flat. The result is a run whose cost is superlinear in its step count, governed by a cap that was never measuring it. ## What this usually looks like - One agent run costs far more than your per-call cap suggests it can. - Cost per run varies wildly and nobody knows how many steps a run takes. - Your ceiling is set per request and there's no ceiling on a run. - Input tokens per call climb through a run while output stays level. - A runaway agent was caught by a bill rather than by a limit. ## Common mistakes - Treating the per-request output cap as a spend ceiling. Why it hurts: It bounds one step, and a loop takes as many steps as the model decides it needs. Do instead: Cap the number of steps as well, which is the only limit that bounds a run. - Measuring cost per call in an agent. Why it hurts: The unit a user experiences is the run, and a run is an unknown number of calls. Do instead: Group calls by run and report cost per run, including its step count. - Forgetting that reasoning happens between tool calls. Why it hurts: Interleaved thinking bills as output at every step, so it multiplies with loop length. Do instead: Watch the reasoning share per step, and lower effort if it's not earning its place. - Ignoring that each step re-sends the history. Why it hurts: Input tokens grow with step number, so late steps cost more than early ones. Do instead: Cache the stable prefix and trim what the model no longer needs. ## Self-check - Find your longest agent run last week and count its steps. - Multiply your per-request output cap by that step count. - Check whether anything at all limits the number of steps a run may take. - Plot input tokens against step number for one run and look at the slope. ## A cap of 4,096, and a turn that spends ten times it (illustrative) Anthropic states that in a tool-use loop each request has its own output cap, so the cap doesn't bound the whole turn's spend. Take an output cap of 4,096 tokens and an agent that takes ten steps to finish a task, priced on the price book's real Claude Opus 5 output rate of $25.00 per million. Output only, to isolate the effect the cap is supposed to control. The cap and the step count are modelled, the rate and the behaviour are published. one step at the cap: 4,096 x $25.00/M = $0.1024 which is the figure anyone reading the cap would expect a request to cost at most ten steps, each with its own cap: 10 x 4,096 = 40,960 output tokens 40,960 x $25.00/M = $1.0240 for the turn exactly ten times the ceiling, and the ceiling was never wrong about anything The cap did its job perfectly at every step and bounded nothing that mattered. Input isn't even in these numbers, and input is the part that grows, because every step re-sends the whole conversation before it. The only limit that bounds a run is a limit on steps. ## Cost figures Every figure carries its confidence and its source. No figure on this page is provider-reported. - $1.0240 against $0.1024, modelled cost of a ten-step agent turn against the single-step cap that was supposed to bound it [calculated] Source: Anthropic's thinking-steering-and-cost page, read 2026-08-05, states that in a tool-use loop each request in the turn has its own max_tokens so it doesn't bound the whole turn's spend. At the price book's real Claude Opus 5 output rate of $25.00 per million, one 4,096-token step costs $0.1024 and ten such steps cost $1.0240, exactly ten times. Output only, input excluded. The cap and step count are modelled, the rate and the behaviour are published. ## FAQ Q: Does max_tokens limit what an agent spends? A: No. Anthropic states that in a tool-use loop each request in the turn has its own max_tokens, so it doesn't bound the whole turn's spend. It caps a single step, and a loop takes as many steps as the model decides. Only a limit on step count bounds a run. Q: Why does one agent run cost so much more than another? A: Step count, mostly. Cost scales with how many times the loop goes round, and that's decided at runtime by the task rather than by your settings. Input also grows through a run because each step re-sends the conversation before it, so late steps cost more than early ones. Q: How do I actually cap agent spend? A: Limit the number of steps a run may take, and record cost per run so you know what a normal one looks like. A per-request output cap is still worth setting, and it's controlling a different thing from the one most people assume. Q: Does reasoning make agent loops more expensive? A: It can, because thinking interleaves with tool use automatically and bills as output at every step. In a long loop that multiplies. Whether it's worth it depends on whether the reasoning between tool calls improves the decisions, which is measurable on your own runs. ## Sources - Anthropic, steering thinking and its cost: https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost - Anthropic pricing: https://platform.claude.com/docs/en/docs/about-claude/pricing Run the free Cost Leak Scan: https://app.getculpa.com/scan?source=pseo&slug=agent-loop-cost&cluster=problem Machine-readable index of every guide: https://getculpa.com/api/pages Human-readable index of every guide: https://getculpa.com/guides Site overview: https://app.getculpa.com/llms.txt Privacy: Culpa runs on your infrastructure. Your prompts and responses never leave it. Culpa counts calls to run your plan, and it fails open, so if it ever breaks your app keeps running.