PipelineCompactionStrategy Class
Definition
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.
A compaction strategy that executes a sequential pipeline of CompactionStrategy instances against the same CompactionMessageIndex.
public sealed class PipelineCompactionStrategy : Microsoft.Agents.AI.Compaction.CompactionStrategy
type PipelineCompactionStrategy = class
inherit CompactionStrategy
Public NotInheritable Class PipelineCompactionStrategy
Inherits CompactionStrategy
- Inheritance
Remarks
Each strategy in the pipeline operates on the result of the previous one, enabling composed behaviors such as summarizing older messages first and then truncating to fit a token budget.
The pipeline itself always executes while each child strategy evaluates its own Trigger independently to decide whether it should compact.
Constructors
| Name | Description |
|---|---|
| PipelineCompactionStrategy(IEnumerable<CompactionStrategy>) |
Initializes a new instance of the PipelineCompactionStrategy class. |
Properties
| Name | Description |
|---|---|
| Strategies |
Gets the ordered list of strategies in this pipeline. |
| Target |
Gets the target predicate that controls when compaction stops.
Strategies re-evaluate this after each incremental exclusion and stop when it returns |
| Trigger |
Gets the trigger predicate that controls when compaction proceeds. (Inherited from CompactionStrategy) |
Methods
| Name | Description |
|---|---|
| CompactAsync(CompactionMessageIndex, ILogger, CancellationToken) |
Evaluates the Trigger and, when it fires, delegates to CompactCoreAsync(CompactionMessageIndex, ILogger, CancellationToken) and reports compaction metrics. (Inherited from CompactionStrategy) |
| CompactCoreAsync(CompactionMessageIndex, ILogger, CancellationToken) |
Applies the strategy-specific compaction logic to the specified message index. (Inherited from CompactionStrategy) |
Extension Methods
| Name | Description |
|---|---|
| AsChatReducer(CompactionStrategy) |
Returns an IChatReducer that applies this CompactionStrategy to reduce a list of messages. |