Skip to main content
Intelligent Conversation Compaction extracts the conversation’s topic, current goal, key decisions, and action items into a structured summary that preserves narrative continuity.
The user keeps chatting; long history compacts into structured topic, goals, and action items before the next reply.

Quick Start

1

Enable on Agent via ManagerConfig

2

Low-Level Class

3

Direct API for full control


How It Works

Analyzer Strategy Decision:

ConversationContext Shape

The protocol classes were renamed in PR #1899 to ConversationAnalyzerProtocol and ConversationCompactorProtocol. The old unsuffixed names (ConversationAnalyzer, ConversationCompactor) remain as deprecated backward-compatible aliases.
.to_summary_message() example output:

ManagerConfig Fields


OptimizerStrategy.CONVERSATION

Use strategy="conversation" for:
  • Long conversations with topic evolution β€” preserves narrative flow better than basic summarization
  • Multi-hour planning sessions β€” tracks decisions and action items across topic changes
  • Iterative development β€” maintains context of completed work and next steps
When to use different strategies:
  • strategy="conversation" β†’ Structured summaries with topic/goal tracking
  • strategy="smart" β†’ Adaptive optimization (pruning, sliding window, etc.)
  • strategy="summarize" β†’ Simple LLM summarization without structure

Common Patterns

Multi-hour planning sessions:
Agent handoff with context preservation:
Recover from ineffective basic summarization:

Best Practices

Setting the minimum compaction ratio to at least 30% ensures summaries provide meaningful token savings. Lower ratios may waste computational resources on minimal gains.
The hybrid strategy provides the best balance of quality and reliability. Use rule_based only when LLM costs are prohibitive, and llm_only only when maximum fidelity is critical.
Preserving the last 5 messages maintains immediate context while allowing effective compaction. Increase this for tool-heavy conversations where recent outputs are critical.
Always verify that critical decisions were captured correctly by checking context.key_decisions. This helps catch cases where important information might be lost.

LLM Context Compression

LLM-driven compression with session lineage and head/tail protection

Context Optimizer

Overview of all optimization strategies including conversation compaction

Context Strategies

Choosing the right optimization approach for your use case

Context Compaction

Basic compaction strategies and when to use intelligent compaction