What is Context Window?
A context window is the maximum number of tokens an LLM can process in a single interaction, encompassing system prompt, conversation history, retrieved documents, and generated output.
WHY IT MATTERS
The context window is the LLM's working memory. Everything the model considers must fit within this window. Modern models range from 8K tokens to 200K+ tokens (Claude, Gemini).
For agents, context window management is critical. A long-running agent accumulates history that gradually fills the window. When it overflows, the oldest context is dropped — potentially losing critical instructions.
Larger windows help but don't fully solve the problem. Research shows LLMs struggle with information in the middle of long contexts ('lost in the middle'), making placement of critical instructions matter.