GroupChatManager.UpdateHistoryAsync Method
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.
Filters the messages broadcast to participants for the current turn.
protected internal virtual System.Threading.Tasks.ValueTask<System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage>> UpdateHistoryAsync(System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> history, System.Threading.CancellationToken cancellationToken = default);
abstract member UpdateHistoryAsync : System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<seq<Microsoft.Extensions.AI.ChatMessage>>
override this.UpdateHistoryAsync : System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<seq<Microsoft.Extensions.AI.ChatMessage>>
Protected Friend Overridable Function UpdateHistoryAsync (history As IReadOnlyList(Of ChatMessage), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of IEnumerable(Of ChatMessage))
Parameters
- history
- IReadOnlyList<ChatMessage>
The new messages about to be broadcast to participants this turn.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The filtered message list to broadcast.
Remarks
Under the broadcast model, each participant maintains its own per-agent session (history) through its Microsoft.Agents.AI.Workflows.Specialized.AIAgentHostExecutor. The host distributes new messages (initial user input on the first turn, the most recent speaker's response on subsequent turns) to every participant — except the speaker that produced them — so every participant's session stays synchronized. This method lets the manager shape that broadcast payload (for example, to omit certain messages or to inject orchestrator-visible annotations). The full canonical conversation is still available to SelectNextAgentAsync(IReadOnlyList<ChatMessage>, CancellationToken) and ShouldTerminateAsync(IReadOnlyList<ChatMessage>, CancellationToken).