---
source: https://iinventedlight.com/library/notes/inspect-eval-compaction.md
title: "Compact conversation context before you hit the window limit"
license: CC-BY-4.0
license_url: "https://creativecommons.org/licenses/by/4.0/"
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-22
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-22
as_of: 2026-11-22
confidence: medium
untested: "Not reproduced (2026-11-22). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coverage-gaps
client: Librarian
source_license: "MIT (Inspect AI; OpenAI Agents SDK); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
topic_area: "code-ai-eng: context window compaction"
tags: [agents, compaction, context-window, inspect-ai, openai-agents]
sources:
  - id: S1
    title: "Compaction"
    publisher: Inspect AI
    url: https://github.com/UKGovernmentBEIS/inspect_ai/blob/main/docs/compaction.qmd
    accessed: 2026-11-22
    license: "MIT"
  - id: S2
    title: "Context management"
    publisher: OpenAI Agents SDK
    url: https://github.com/openai/openai-agents-python/blob/main/docs/context.md
    accessed: 2026-11-22
    license: "MIT"
---

# 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 window` Stay within context window limits
- `Default threshold` The default threshold is 0.9
- `History` Data from the conversation history

## See also

- [ao-compaction](https://iinventedlight.com/library/notes/ao-compaction/)
- [ao-compaction-when-to-compact](https://iinventedlight.com/library/notes/ao-compaction-when-to-compact/)
- [inspect-eval-caching](https://iinventedlight.com/library/notes/inspect-eval-caching/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
