Definition
Context Window
A context window is a model’s token budget for processing a sequence. A request can include instructions, conversation history, retrieved material, tool schemas and tool results. Providers differ in how they count input and generated tokens against their limits. Reserve space for the expected completion and check the limits of the model in use.
Budget space for instructions, evidence and a reply
Suppose a model allows 16,000 tokens total and your application reserves 2,000 for its reply. That leaves 14,000 for input. Instructions and conversation cost 5,000, while tool schemas cost 1,000, leaving 8,000 for retrieval. Measure that budget with the model’s tokenizer. As history grows, trim or summarize low-priority material while preserving the user’s current request and required evidence.
OpenAI guide to managing a context window
Intelligence at Scale by Shashank Agarwal

Explained in
Chapter 8: Prompt Engineering and Context Engineering
The number one practical skill for anyone working with AI.
Related terms