AIAgent.NotifyThreadOfNewMessagesAsync 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.
Notifies the specified thread about new messages that have been added to the conversation.
protected static System.Threading.Tasks.Task NotifyThreadOfNewMessagesAsync(Microsoft.Agents.AI.AgentThread thread, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, System.Threading.CancellationToken cancellationToken);
static member NotifyThreadOfNewMessagesAsync : Microsoft.Agents.AI.AgentThread * seq<Microsoft.Extensions.AI.ChatMessage> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Shared Function NotifyThreadOfNewMessagesAsync (thread As AgentThread, messages As IEnumerable(Of ChatMessage), cancellationToken As CancellationToken) As Task
Parameters
- thread
- AgentThread
The conversation thread to notify about the new messages.
- messages
- IEnumerable<ChatMessage>
The collection of new messages to report to the thread.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
A task that represents the asynchronous notification operation.
Exceptions
thread or messages is null.
Remarks
This method ensures that conversation threads are kept informed about message additions, which is important for threads that manage their own state, memory components, or derived context. While all agent implementations should notify their threads, the specific actions taken by each thread type may vary.