CompactionSettings
AgentPrism.Abstractions.dllDetermines how an agent compacts its conversation history.
public sealed record CompactionSettings : IEquatable<CompactionSettings>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”IEquatable<CompactionSettings>
Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”When left null no compaction is applied, and the run fails once the conversation history no longer fits the model context window. An invalid combination of fields (for example choosing CompactionStrategyKind.Summarization without any trigger) is rejected while the agent is built, with AgentPrismCompilationException; it is not ignored silently.
Constructors
Section titled “Constructors”CompactionSettings()
Section titled “ CompactionSettings()”public CompactionSettings()Properties
Section titled “Properties”MaxContextWindowTokens
Section titled “ MaxContextWindowTokens”Gets the context window size. It is required for CompactionStrategyKind.ContextWindow and ignored by the other strategies.
public int? MaxContextWindowTokens { get; init; }Property Value
Section titled “Property Value”int?
MaxOutputTokens
Section titled “ MaxOutputTokens”Gets the upper output token limit for CompactionStrategyKind.ContextWindow.
When it is not given, ModelBinding.MaxOutputTokens from the agent’s own
model binding is used, and 4096 when that is missing too.
public int? MaxOutputTokens { get; init; }Property Value
Section titled “Property Value”int?
MinimumPreservedGroups
Section titled “ MinimumPreservedGroups”Gets the minimum number of groups kept for CompactionStrategyKind.Truncation, CompactionStrategyKind.ToolResult and CompactionStrategyKind.Summarization. 4 is used when it is not given.
public int? MinimumPreservedGroups { get; init; }Property Value
Section titled “Property Value”int?
MinimumPreservedTurns
Section titled “ MinimumPreservedTurns”Gets the minimum number of turns kept for CompactionStrategyKind.SlidingWindow. 2 is used when it is not given.
public int? MinimumPreservedTurns { get; init; }Property Value
Section titled “Property Value”int?
Strategy
Section titled “ Strategy”Gets the strategy to apply.
public CompactionStrategyKind Strategy { get; init; }Property Value
Section titled “Property Value”SummarizationModel
Section titled “ SummarizationModel”Gets the model used for the summarization call. When it is empty the order is followed: the application-wide helper model setting, and the agent’s own model when that is missing.
public ModelBinding? SummarizationModel { get; init; }Property Value
Section titled “Property Value”SummarizationPrompt
Section titled “ SummarizationPrompt”Gets the extra instruction added to the summarization prompt for CompactionStrategyKind.Summarization and CompactionStrategyKind.Pipeline. When null the default prompt of MAF is used.
public string? SummarizationPrompt { get; init; }Property Value
Section titled “Property Value”TriggerMessages
Section titled “ TriggerMessages”Gets the message count above which compaction is triggered.
public int? TriggerMessages { get; init; }Property Value
Section titled “Property Value”int?
TriggerTokens
Section titled “ TriggerTokens”Gets the token count above which compaction is triggered.
public int? TriggerTokens { get; init; }Property Value
Section titled “Property Value”int?
TriggerTurns
Section titled “ TriggerTurns”Gets the turn count above which compaction is triggered.
public int? TriggerTurns { get; init; }Property Value
Section titled “Property Value”int?
Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(CompactionSettings?)
Section titled “ Equals(CompactionSettings?)”public bool Equals(CompactionSettings? other)Parameters
Section titled “Parameters”other CompactionSettings?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(CompactionSettings?, CompactionSettings?)
Section titled “ operator ==(CompactionSettings?, CompactionSettings?)”public static bool operator ==(CompactionSettings? left, CompactionSettings? right)Parameters
Section titled “Parameters”left CompactionSettings?
right CompactionSettings?
Returns
Section titled “Returns”operator !=(CompactionSettings?, CompactionSettings?)
Section titled “ operator !=(CompactionSettings?, CompactionSettings?)”public static bool operator !=(CompactionSettings? left, CompactionSettings? right)Parameters
Section titled “Parameters”left CompactionSettings?
right CompactionSettings?