concept

Context Window

The maximum number of tokens a model can attend to in one request, holding the system prompt, history, retrieved context, tools and the answer.

llmretrievalcostlatency

It behaves as a budget shared by everything, which is the framing that matters architecturally: system prompt, conversation history, retrieved documents, tool definitions, tool results, and the generated response all draw on the same pool. A large tool catalogue can consume a surprising share before any user content arrives.

Three consequences to design for. Cost and latency scale with what you put in it, so filling a large window because it is available is a direct and recurring bill. Long contexts degrade — models attend unevenly across a very long input, and information in the middle is used less reliably, so more context is not monotonically better. And overflow behaviour must be explicit: silently truncating history or dropping retrieved chunks produces mysterious quality loss.

The design responses are a deliberate budget per component, summarisation or windowing of history, retrieval that returns few high-precision chunks rather than many mediocre ones, and monitoring token usage per request as a first-class metric.