Udostępnij za pośrednictwem


AgentChat.InvokeAgentAsync(Agent, CancellationToken) Method

Definition

Process a discrete incremental interaction between a single Agent an 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

Asynchronous enumeration of messages.

Remarks

Any AgentChat instance does not support concurrent invocation and will throw exception if concurrent activity is attempted.

Applies to