Context window
The maximum number of tokens a model can consider at once — prompt and response together.
A context window is the working memory of a language model: everything it can see while producing the next token. It covers the system prompt, the conversation so far, any documents pasted in, tool definitions, tool results, and the response being generated. When the total exceeds the window, something must be dropped or summarised — the model does not silently make room.
Key facts
- The context window counts input and output together, so a 200,000-token window does not mean 200,000 tokens of input plus a response.
- Tool definitions and tool results consume context on every request, which is why an agent with many tools has less room for conversation than one with few.
- Exceeding the window is an error, not a truncation: the request is rejected rather than the oldest text being dropped for you.
- A larger window does not mean better recall — retrieval accuracy tends to fall for material buried in the middle of a long context.
Frequently asked questions
Does a longer context window make a model more accurate?
Not by itself. A larger window lets you supply more material, but models generally attend most reliably to the beginning and end of a long context. Putting the important instruction at the very end is usually more effective than relying on the model to find it in the middle.
How do I stay inside the context window in a long-running agent?
Compact rather than truncate. Replace old turns with a summary that preserves decisions and open questions, and keep the raw history somewhere retrievable. Dropping the oldest messages blindly loses exactly the constraints that were agreed early and never repeated.
Machine-readable copy of this page:
/glossary/context-window.md