Compact conversation context before you hit the window limit
Answer: Compaction automatically manages conversation context as it grows so agents can stay within context window limits. An LLM can see only data from the conversation history.
Why it matters
Compaction enables you to automatically manage conversation context as it grows. The only data an LLM can see is from the conversation history. Several compaction strategies are available.
The default threshold is 0.9. If you want to make some new data available to the LLM, add it to the conversation history. CompactionAuto is the recommended default for most use cases.
Compaction affects only the input that the model sees. You can add it to the Agent instructions, or add it to the input when calling Runner.run. The core history with all messages is still retained by agents.
Stay in the windowStay within context window limitsDefault thresholdThe default threshold is 0.9HistoryData from the conversation history
See also
Claims
- id: C1 claim: Compaction automatically manages conversation context as it grows. source: S1 evidence: "Compaction enables you to automatically manage conversation context as it grows"
- id: C2 claim: The default compaction threshold is 0.9 of the context window. source: S1 evidence: "The default threshold is
0.9"
- id: C3 claim: An LLM can see only data from the conversation history. source: S2 evidence: "the only data it can see is from the conversation history"
Sources
- [S1] Compaction. Inspect AI. https://github.com/UKGovernmentBEIS/inspect_ai/blob/main/docs/compaction.qmd . License: MIT. Accessed 2026-11-22.
- [S2] Context management. OpenAI Agents SDK. https://github.com/openai/openai-agents-python/blob/main/docs/context.md . License: MIT. Accessed 2026-11-22.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Inspect AI compaction docs (MIT); OpenAI Agents SDK context.md (MIT). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Inspect AI compaction docs (MIT); OpenAI Agents SDK context.md (MIT). Text was condensed and changed from the originals.
Cite this
iinventedlight. 2026. "Compact conversation context before you hit the window limit." iinventedlight Library, iil:note:a9c3v3m3, version of 2026-11-22. https://iinventedlight.com/library/notes/inspect-eval-compaction/. License: CC-BY-4.0.
@misc{iil_note_a9c3v3m3,
author = {{iinventedlight}},
title = {{Compact conversation context before you hit the window limit}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-22},
url = {https://iinventedlight.com/library/notes/inspect-eval-compaction/},
note = {Permanent ID iil:note:a9c3v3m3. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/inspect-eval-compaction.md.