AgentChat.InvokeAgentAsync(Agent, CancellationToken) Method

Definition

Processes a discrete incremental interaction between a single Agent and a AgentChat.

protected System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.ChatMessageContent> InvokeAgentAsync(Microsoft.SemanticKernel.Agents.Agent agent, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeAgentAsync : Microsoft.SemanticKernel.Agents.Agent * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.ChatMessageContent>
Protected Function InvokeAgentAsync (agent As Agent, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatMessageContent)

Parameters

agent
Agent

The agent actively interacting with the chat.

cancellationToken
CancellationToken

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

Returns

An asynchronous enumeration of messages.

Remarks

AgentChat instances don't support concurrent invocation and will throw exception if concurrent activity is attempted.

Applies to