Skip to content

context window

A context window is the maximum span of tokens an LLM can jointly attend to in one pass. Everything in the request counts toward it—the system prompt, the conversation history, tool definitions and tool results, any attached files or images, and your prompt—along with the output the model generates, including its internal reasoning tokens.

Because this window is finite, overly long inputs or requested responses may be truncated or refused, so systems often summarize, chunk, or retrieve relevant subsets to fit the limit. Vendors specify their maximum window size, and the major providers all count prompt plus response tokens—reasoning tokens included—toward that limit.

Some modern models support very large context windows—hundreds of thousands or even up to millions of tokens—though in practice recall and accuracy degrade as the window fills, a phenomenon now called context rot. Mitigating this degradation is mainly a context engineering problem: agent harnesses compact or summarize older turns, clear stale tool results, offload state to external notes or memory, cache reusable prefixes, and retrieve only the slices they need, while model-side work on positional encoding and attention keeps pushing the ceiling higher.


By Leodanis Pozo Ramos • Updated Aug. 2, 2026