Tacnode™
Glossary
Machine Learning

What Is a Token Budget in LLMs?

A token budget is a limit on how many tokens a language model call, or a whole multi-step agent task, may use. The term covers three related limits: how a fixed context window is divided among the parts of a prompt and the reserved output, a cap on generated tokens including hidden reasoning, and a ceiling on total tokens across an agent's run for cost or latency control. A token budget governs how much goes into and comes out of a model, not whether that content is accurate.

Updated

What is a token budget?

Every model has a fixed context window, and the prompt and the response share it. Anthropic's docs define the window as "all the text a language model can reference when generating a response, including the response itself." Every prompt is therefore an allocation problem.

Context allocation. How much of the window each component gets, from system prompt to reserved output. The hard maximum is not the only limit. Anthropic's context engineering guide describes an "attention budget" and says "Every new token introduced depletes this budget by some amount." Its context window docs say some Claude models have "context awareness" and track "their remaining context window (their 'token budget')" during a conversation.

Output and reasoning. Reasoning models generate tokens the caller never sees. OpenAI's reasoning guide says these tokens "still occupy space in the model's context window and are billed as output tokens," that max_output_tokens caps everything generated, reasoning included, and that OpenAI "recommends reserving at least 25,000 tokens for reasoning and outputs" when starting out. Anthropic's manual extended-thinking mode, which newer Claude models replace with adaptive thinking, takes a budget_tokens value that its docs call "a target rather than a strict cap." Han et al. found that chain-of-thought reasoning "can be compressed by including a reasonable token budget in the prompt," though the choice of budget "plays a crucial role" in how well that works.

Task budgets. An agent makes many calls, so teams also budget a whole run. Anthropic's task budgets (in beta) are advisory: they "let you tell Claude how many tokens it has for a full agentic loop, including thinking, tool calls, tool results, and output."

How a token budget works

An illustrative allocation for one agent step on a model with a 200,000-token window:

Part of the promptTokensWhen it runs over
System prompt and policies5,000Shorten offline; fixed at run time
Tool definitions10,000Load only the tools this step needs
Conversation and tool history70,000Offload large tool results, then compact older turns
Retrieved documents45,000Rerank and keep fewer passages
Current task and inputs10,000Rarely trimmed
Reserved for reasoning and output60,000Never borrowed by the input

The harness counts tokens before each call and trims in order of least harm: unneeded tools, then bulky tool results, then old history, then retrieval. The output reserve comes first, because running out of it fails badly. When generation hits the limit, OpenAI's API returns a response with status incomplete, and this "might occur before any visible output tokens are produced," so the caller can pay for input and reasoning tokens and get no visible answer (OpenAI).

Why token budgets matter in real-time systems

Budget pressure pushes teams to prepare context ahead of time: a nightly account digest, a cached customer profile, a compacted history. Each saves tokens, and each is a derived copy with an age. That is safe for a static document. For mutable state it trades prompt size for staleness: the digest fits the budget and describes yesterday.

A token budget and a freshness requirement are separate constraints; meeting one says nothing about the other. The facts a decision gates on, such as a balance, a limit or an order status, are usually small. Read those fresh at call time and spend the budget on bulky, slow-changing material. The wider discipline is laid out in what context engineering actually means.

FAQ

Related terms

Further reading