Context Window Lab

Beginner8 min

Visualize how an LLM context window fills up and compare summarization, RAG, memory, and truncation strategies.

In one sentence

A context window is the model's finite working input budget; system instructions, conversation history, documents, and tool results all compete for that space.

Context usage191,250 / 200,000 tokens
System 12% · Conversation 42% · Documents 28% · Tools 12% · Memory 6%
Choose a strategy
Before191,250 / 200,000

Risk: little space remains for new turns.

After strategy112,430 / 200,000

78,820 tokens condensed or removed; 87,570 tokens of headroom remain.

Context engineering is trade-off management: keep the most useful information available while controlling cost, latency, and information loss.
Key takeaways
Context is finiteInputs compete for a limited working budget.
Summaries compress historyThey preserve less detail but free capacity.
RAG retrieves on demandExternal knowledge need not stay in context.
Memory is a separate layerPersistent facts are not the same as active context.
Build challenge

Design a context strategy for a support agent

Decide what stays in the prompt, what becomes a summary, what goes to retrieval, and what belongs in persistent memory.

Advanced labs →
Concept guide

What is an LLM context window?

A context window is the finite amount of input information a model can process for a generation step. System instructions, user and assistant messages, retrieved passages, tool outputs, and other supplied content all consume that working budget.

What happens when context becomes too large?

An application must decide what to remove, compress, retrieve later, or persist elsewhere. The correct choice depends on which information is important for the next model decision.

How is RAG different from memory?

RAG retrieves relevant external information when needed. Memory usually refers to information persisted across turns or sessions. Both can supply context, but neither is identical to the context window itself.

Why is context engineering important?

Good context design improves relevance and reliability while helping control token cost and latency. More context is not automatically better context.

Common questions

Is context the same as memory?

No. Context is the current working input; memory is a persistence strategy that may later supply context.

Does RAG increase the context window size?

No. RAG selects information to place inside the available context.

Should I always summarize old messages?

No. Summarization trades detail for compactness and can remove information that later becomes important.

Are the token limits shown here model-specific?

The 200,000-token value is an educational example, not a claim about every model.

AhaFrame learning note · Reviewed 2026-08-13. The lab uses a stable simulated token budget to make trade-offs observable.
You can now reason about context trade-offs.
Next: see how agents use tools and observations in a loop.
Continue →