CopilotStudioAgent.RunAsync 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.
Runs the agent with a collection of chat messages, providing the core invocation logic that all other overloads delegate to.
public override System.Threading.Tasks.Task<Microsoft.Agents.AI.AgentRunResponse> RunAsync(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.RunAsync : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Agents.AI.AgentThread * Microsoft.Agents.AI.AgentRunOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Agents.AI.AgentRunResponse>
Public Overrides Function RunAsync (messages As IEnumerable(Of ChatMessage), Optional thread As AgentThread = Nothing, Optional options As AgentRunOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AgentRunResponse)
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 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 AgentRunResponse with the agent's output.