Share via


CopilotStudioAgent.RunStreamingAsync Method

Definition

Runs the agent in streaming mode with a collection of chat messages, providing the core streaming invocation logic.

public override System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.AI.AgentRunResponseUpdate> RunStreamingAsync(System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Agents.AI.AgentThread? thread = default, Microsoft.Agents.AI.AgentRunOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
override this.RunStreamingAsync : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Agents.AI.AgentThread * Microsoft.Agents.AI.AgentRunOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.AI.AgentRunResponseUpdate>
Public Overrides Function RunStreamingAsync (messages As IEnumerable(Of ChatMessage), Optional thread As AgentThread = Nothing, Optional options As AgentRunOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of AgentRunResponseUpdate)

Parameters

messages
IEnumerable<ChatMessage>

The collection of messages to send to the agent for processing.

thread
AgentThread

The conversation thread to use for this invocation. If null, a new thread will be created. The thread will be updated with the input messages and any response updates generated during invocation.

options
AgentRunOptions

Optional configuration parameters for controlling the agent's invocation behavior.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

An asynchronous enumerable of AgentRunResponseUpdate instances representing the streaming response.

Applies to