Glossary · economics

Context window

The maximum number of tokens a model can take in one call, covering instructions, retrieved material, conversation history and output.

The context window is the total amount of text a model can handle in one call. It has to hold the instructions, every input the model is shown, any conversation history and the output the model writes. A large window does not make the model read everything equally well, and a full window is more expensive and slower than a small one.

Context is the material an agent works from. Deciding what goes into it is one of the most important decisions in the harness.

In practice

I budget the window for each step. The instructions take a fixed share, the retrieved material a variable share, and the output a reserved share. If a step needs more than its share, the answer is usually to select better material, not to enlarge the window. Retrieval that returns fewer, more relevant passages often beats a longer prompt.

I also watch for context that accumulates across turns. In a long loop, old tool results can crowd out the instructions. The harness should summarise or drop them on a stated rule.

Example

[Composite] An agent answering questions from policy documents passed the whole policy library in each call. Answers were slow and sometimes cited the wrong section. Retrieving the five most relevant sections, with their headings, made the answers faster and the citations accurate, and the window use fell well below its limit.

Common mistakes

  • Filling the window because it is available, not because the task needs it.
  • Letting tool output from earlier turns accumulate without a limit.
  • Assuming the model uses every part of a long context equally.

Related terms

Cite this definition

Context window. Mayur Patil, mayurpatil.ai, updated 2026-11-01. https://mayurpatil.ai/glossary/context-window/

Enquiry

Tell me about the work

The use case, where it is blocked and who is involved. I reply with a suggested starting point. Or email hello@mayurpatil.ai.

Goes to my CRM and my inbox. No newsletter, no sharing. See Privacy (opens in a new tab).

Close