AI glossary

What is Context Window?

Definition

The context window is the maximum amount of text, measured in tokens, that a language model can take into account in a single request, including instructions, history, documents and its own reply.

Everything the model “sees” at once must fit in its context window: the system prompt, tool definitions, conversation history, retrieved documents and the output it generates.

Why size matters

Modern models offer large context windows, some up to a million tokens, enough for entire codebases or long contracts. Larger windows allow:

  • Analysing long documents in one go
  • Longer agent sessions without forgetting earlier steps
  • Including many examples in a prompt

The trade-offs

  • Cost: you pay for every input token, on every request.
  • Focus: burying key facts in huge contexts can reduce answer quality.
  • Latency: more input takes longer to process.

That’s why RAG, summarisation and prompt caching remain important even with large windows.

Free newsletter

The Agent Brief

One practical email a week on AI agents, RAG and generative AI, for builders and business owners. No hype, no spam.