Microsoft.Agents.AI.Compaction Namespace
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Classes
| Name | Description |
|---|---|
| ChatReducerCompactionStrategy |
A compaction strategy that delegates to an IChatReducer to reduce the conversation's included messages. |
| ChatStrategyExtensions |
Provides extension methods for CompactionStrategy. |
| CompactionMessageGroup |
Represents a logical group of ChatMessage instances that must be kept or removed together during compaction. |
| CompactionMessageIndex |
A collection of CompactionMessageGroup instances and derived metrics based on a flat list of ChatMessage objects. |
| CompactionProvider |
A AIContextProvider that applies a CompactionStrategy to compact the message list before each agent invocation. |
| CompactionStrategy |
Base class for strategies that compact a CompactionMessageIndex to reduce context size. |
| CompactionTriggers |
Factory to create CompactionTrigger predicates. |
| ContextWindowCompactionStrategy |
A compaction strategy that derives token thresholds from a model's context window size and maximum output tokens, applying a two-phase compaction pipeline:
|
| PipelineCompactionStrategy |
A compaction strategy that executes a sequential pipeline of CompactionStrategy instances against the same CompactionMessageIndex. |
| SlidingWindowCompactionStrategy |
A compaction strategy that removes the oldest user turns and their associated response groups to bound conversation length. |
| SummarizationCompactionStrategy |
A compaction strategy that uses an LLM to summarize older portions of the conversation, replacing them with a single summary message that preserves key facts and context. |
| ToolResultCompactionStrategy |
A compaction strategy that collapses old tool call groups into single concise assistant messages, removing the detailed tool results while preserving a record of which tools were called and what they returned. |
| TruncationCompactionStrategy |
A compaction strategy that removes the oldest non-system message groups, keeping at least MinimumPreservedGroups most-recent groups intact. |
Enums
| Name | Description |
|---|---|
| CompactionGroupKind |
Identifies the kind of a CompactionMessageGroup. |
Delegates
| Name | Description |
|---|---|
| CompactionTrigger |
Defines a condition based on CompactionMessageIndex metrics used by a CompactionStrategy to determine when to trigger compaction and when the target compaction threshold has been met. |