Context window
A context window is the maximum number of tokens a language model can take in and produce in a single request, covering instructions, data, history and output.
Also called: context length, context limit, context size
A context window is the maximum amount of text, measured in tokens, that a language model can handle in one request: your instructions, the data you pass in, any conversation history and the model's reply combined. It sets a hard ceiling on what a single AI step can "see", which shapes how you design research, summarization and agent workflows.
How it works
Think of the context window as the model's desk. Everything it needs for this task has to fit on the desk at once:
- The system prompt and examples
- Retrieved documents, records and tool results
- Prior messages in a conversation or agent loop
- Room for the output
Context sizes vary widely by model and have grown fast, from a few thousand tokens in early models to hundreds of thousands, and over a million in some current models. Bigger windows are useful, but three limits remain. Cost scales with tokens sent. Latency grows with input size. And recall is uneven: models can miss details placed in the middle of very long inputs, so position and structure matter.
This is why context engineering has become a core skill. The job is not stuffing the window; it is choosing, ordering and compressing what goes in.
Example
Say a team wants a deal summary from all calls on an opportunity. A typical 45-minute call transcript runs around 7,000 to 9,000 tokens; call it 8,000 (assumption). A deal with 12 calls is about 96,000 tokens, plus 20,000 tokens of emails and notes: 116,000 tokens.
Option A sends it all to a long-context model in one call. At an assumed $3 per million input tokens, that is about $0.35 per summary, and the model may underweight call 6 where the champion flagged a budget freeze.
Option B summarizes each call into a 400-token structured note (12 calls × 8,000 tokens in, about $0.29 of input plus a few cents of output), then sends the 12 notes plus a 2,000-token email digest, about 6,800 tokens, to a final call costing about $0.02. Total cost is similar, but the final step works from dense, comparable notes, and the per-call notes are reusable for conversation intelligence reporting. That is the pattern we default to: compress early, reason late.
How to work within it
- Measure inputs. Log token counts per record so you know your longest cases.
- Trim noise. Strip boilerplate, navigation, signatures and duplicate threads.
- Retrieve, don't dump. Use retrieval-augmented generation to pull only the relevant passages.
- Summarize in stages. Map long material into structured notes, then reduce.
- Put key instructions at the start and repeat critical rules near the end for long inputs.
- Reserve output room. A full input with no space for the answer produces truncated results.
Common mistakes
- Treating a huge window as permission to skip retrieval and cleaning.
- Letting agent loops append every tool result until the context overflows mid-task.
- Forgetting that output tokens count toward the limit.
- Testing on average records and missing the 2% with enormous inputs that error in production.
- Assuming the model "remembers" a past conversation that isn't in the current context.
FAQ
Is a bigger context window always better?
No. A larger window lets you include more material, but cost rises with every token, responses slow down, and models can pay less attention to details buried in the middle of very long inputs. Sending the right 5,000 tokens usually beats sending 200,000.
What happens when you exceed the context window?
The API rejects the request or, in chat products, older content gets dropped or summarized. In automated workflows, an overflow often shows up as an error on the few records with unusually long inputs, so add a length check before the call.
Does the model remember things outside the context window?
No. Each call only knows what is in its context window plus what it learned in training. Memory features in AI tools work by storing information and inserting it back into the context on later calls.
Related
Used in these articles
- ArticleChatGPT Prompts for Marketing: 40 Templates That Don't Produce Slop
- ArticleClaude Code for Marketers: A Hands-On Guide to the Terminal Agent
- ArticleClaude for Marketing: 12 Workflows, Prompts and the Setup Behind Them
- ArticleClaude Skills for Marketers: How to Build a Skill Library Your Team Will Use
- ArticleLLM Costs for GTM Workflows: Token Math per Account and per Workflow
- ArticleLLM Prompt Patterns for Sales and Marketing Ops