Share via


CopilotStudioAgent.RunCoreAsync Method

Definition

Core implementation of the agent invocation logic with a collection of chat messages.

protected override System.Threading.Tasks.Task<Microsoft.Agents.AI.AgentResponse> RunCoreAsync(System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Agents.AI.AgentSession? session = default, Microsoft.Agents.AI.AgentRunOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
override this.RunCoreAsync : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Agents.AI.AgentSession * Microsoft.Agents.AI.AgentRunOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Agents.AI.AgentResponse>
Protected Overrides Function RunCoreAsync (messages As IEnumerable(Of ChatMessage), Optional session As AgentSession = Nothing, Optional options As AgentRunOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AgentResponse)

Parameters

messages
IEnumerable<ChatMessage>

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

session
AgentSession

The conversation session to use for this invocation. If null, a new session will be created. The session will be updated with the input messages and any response messages 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

A task that represents the asynchronous operation. The task result contains an AgentResponse with the agent's output.

Applies to