What is a context window?

The context window is everything an AI model can see at once when it writes a response: your instructions, the conversation so far, any documents or tool results, and its own answer. It is measured in tokens and it is the model's working memory.

A model has no memory between requests beyond what is placed in its context window. If a fact isn't in the window (and wasn't in the training data), the model doesn't know it.

What fills it up

  • The system prompt
  • The conversation history
  • Retrieved documents (RAG)
  • Tool definitions and tool results (tool use)
  • The response being written

Why bigger isn't automatically better

Modern windows are large, but stuffing them has costs: you pay for every token on every request, responses get slower, and models can lose track of details buried in a very long context. Deciding what goes into the window, in what order, is now a core skill, sometimes called context engineering.

Product implications

Long chats and long-running agents eventually fill the window. Decide what happens then: summarise older turns, start a fresh session, or save notes to a memory the agent can re-read.

All 27 terms in the AI glossary →