Agent.NotifyThreadOfNewMessage 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.
Notfiy the given thread that a new message is available.
protected System.Threading.Tasks.Task NotifyThreadOfNewMessage(Microsoft.SemanticKernel.Agents.AgentThread thread, Microsoft.SemanticKernel.ChatMessageContent message, System.Threading.CancellationToken cancellationToken);
member this.NotifyThreadOfNewMessage : Microsoft.SemanticKernel.Agents.AgentThread * Microsoft.SemanticKernel.ChatMessageContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Function NotifyThreadOfNewMessage (thread As AgentThread, message As ChatMessageContent, cancellationToken As CancellationToken) As Task
Parameters
- thread
- AgentThread
The thread to notify of the new message.
- message
- ChatMessageContent
The message to pass to the thread.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
An async task that completes once the notification is complete.
Remarks
Note that while all agents should notify their threads of new messages, not all threads will necessarily take action. For some treads, this may be the only way that they would know that a new message is available to be added to their history.
For other thread types, where history is managed by the service, the thread may not need to take any action.
Where threads manage other memory components that need access to new messages, notifying the thread will be important, even if the thread itself does not require the message.