CompactionConfig
Automatic conversation-history compaction.
Long-running sessions (weeks-long WhatsApp threads) grow unbounded; budget truncation silently loses the early relationship. Compaction summarizes the older history into one system note and keeps the recent tail verbatim, so the model retains facts/decisions without paying the full token cost.
Runs post-turn (off the user’s latency path) when the estimated history
tokens exceed triggerTokens, and force-runs as the recovery step after a
provider context-overflow error (see contextOverflow.ts).
Properties
Section titled “Properties”keepRecentMessages?
Section titled “keepRecentMessages?”optional keepRecentMessages?: number;Number of recent messages kept verbatim. Default: 12.
model?
Section titled “model?”optional model?: LanguageModel;Summarizer model. Defaults to the active agent’s controlModel/model.
summaryPrompt?
Section titled “summaryPrompt?”optional summaryPrompt?: string;Override the summarizer system prompt.
triggerTokens?
Section titled “triggerTokens?”optional triggerTokens?: number;Estimated history tokens that trigger compaction. Default: 8000.