Skip to content

CompactionConfig

Configuration for context window compaction. When the message history exceeds the context budget, the compaction strategy is applied to reduce the message list while preserving essential information.

---
title: CompactionConfig
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class CompactionConfig {
        +string strategy
        +int32 budget
        +dictionary options
    }
strategy: summarize
budget: 50000
options:
preserveSystemMessages: true
NameTypeDescription
strategystringThe compaction strategy identifier. Built-in strategies include ‘summarize’. Can also be a path to a .prompty file used as the summarization prompt.
budgetint32Character budget for the compacted context. Overrides TurnOptions.contextBudget when set.
optionsdictionaryAdditional strategy-specific options