SummarizingConversationManager
Defined in: src/conversation-manager/summarizing-conversation-manager.ts:95
Implements a summarization strategy for managing conversation history.
When a ContextWindowOverflowError occurs, this manager summarizes the oldest messages using a model call and replaces them with a single summary message, preserving context that would otherwise be lost.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SummarizingConversationManager(config?): SummarizingConversationManager;Defined in: src/conversation-manager/summarizing-conversation-manager.ts:103
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config? | SummarizingConversationManagerConfig |
Returns
Section titled “Returns”SummarizingConversationManager
Overrides
Section titled “Overrides”ConversationManager.constructor
Properties
Section titled “Properties”_compressionThreshold
Section titled “_compressionThreshold”protected readonly _compressionThreshold: number;Defined in: src/conversation-manager/conversation-manager.ts:116
Inherited from
Section titled “Inherited from”ConversationManager._compressionThreshold
readonly name: "strands:summarizing-conversation-manager" = 'strands:summarizing-conversation-manager';Defined in: src/conversation-manager/summarizing-conversation-manager.ts:96
A stable string identifier for this conversation manager.
Overrides
Section titled “Overrides”Methods
Section titled “Methods”initAgent()
Section titled “initAgent()”initAgent(agent): void;Defined in: src/conversation-manager/conversation-manager.ts:170
Initialize the conversation manager with the agent instance.
Registers two hooks:
AfterModelCallEvent: Overflow recovery — when a ContextWindowOverflowError occurs, calls ConversationManager.reduce witherrorset and retries if reduction succeeded.BeforeModelCallEvent: Proactive compression — when projected input tokens exceed the configured compression threshold, calls ConversationManager.reduce withouterror. The hook is always registered but only acts when proactive compression is enabled.
Subclasses that override initAgent MUST call super.initAgent(agent) to
preserve overflow recovery and proactive compression behavior.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
agent | LocalAgent | The agent to register hooks with |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”reduce()
Section titled “reduce()”reduce(options): Promise<boolean>;Defined in: src/conversation-manager/summarizing-conversation-manager.ts:124
Reduce the conversation history by summarizing older messages.
When error is set (reactive overflow recovery), summarization failure is rethrown
with the original error as cause — the agent loop must not proceed with an overflow.
When error is undefined (proactive compression), summarization failure is logged
and returns false — the model call proceeds regardless.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | ConversationManagerReduceOptions | The reduction options |
Returns
Section titled “Returns”Promise<boolean>
true if the history was reduced, false otherwise