AgentExecutor.InvokeAgentAsync 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.
Invokes an agent using the provided WorkflowAgentProvider.
protected System.Threading.Tasks.ValueTask<Microsoft.Agents.AI.AgentRunResponse> InvokeAgentAsync(Microsoft.Agents.AI.Workflows.IWorkflowContext context, string agentName, string? conversationId, bool autoSend, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage>? inputMessages = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeAgentAsync : Microsoft.Agents.AI.Workflows.IWorkflowContext * string * string * bool * seq<Microsoft.Extensions.AI.ChatMessage> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Agents.AI.AgentRunResponse>
Protected Function InvokeAgentAsync (context As IWorkflowContext, agentName As String, conversationId As String, autoSend As Boolean, Optional inputMessages As IEnumerable(Of ChatMessage) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of AgentRunResponse)
Parameters
- context
- IWorkflowContext
The workflow execution context providing messaging and state services.
- agentName
- String
The name or identifier of the agent.
- conversationId
- String
The identifier of the conversation.
- autoSend
- Boolean
Send the agent's response as workflow output. (default: true).
- inputMessages
- IEnumerable<ChatMessage>
Optional messages to add to the conversation prior to invocation.
- cancellationToken
- CancellationToken
A token that can be used to observe cancellation.