Language

IOrchestratedClient.InvokeToolAsync Method

Definition

Invokes a tool (topic) in an externally orchestrated conversation.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.CopilotStudio.Client.Models.OrchestratedResponse> InvokeToolAsync(string conversationId, Microsoft.Agents.CopilotStudio.Client.Models.ToolInvocationInput toolInputs, Microsoft.Agents.Core.Models.IActivity? activity = default, Microsoft.Agents.CopilotStudio.Client.Models.RequestProperties? requestProperties = default, System.Threading.CancellationToken cancellationToken = default);
abstract member InvokeToolAsync : string * Microsoft.Agents.CopilotStudio.Client.Models.ToolInvocationInput * Microsoft.Agents.Core.Models.IActivity * Microsoft.Agents.CopilotStudio.Client.Models.RequestProperties * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.CopilotStudio.Client.Models.OrchestratedResponse>
Public Function InvokeToolAsync (conversationId As String, toolInputs As ToolInvocationInput, Optional activity As IActivity = Nothing, Optional requestProperties As RequestProperties = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of OrchestratedResponse)

Parameters

conversationId
String

The conversation ID.

toolInputs
ToolInvocationInput

The tool invocation input containing the tool schema name and parameters.

activity
IActivity

An optional activity to include with the tool invocation.

requestProperties
RequestProperties

Optional properties mapped to HTTP request headers.

cancellationToken
CancellationToken

Cancellation token to cancel the operation.

Returns

An async enumerable stream of orchestrated responses from the copilot.

Exceptions

Thrown when conversationId or toolInputs is null.

Thrown when the HTTP request fails.

Thrown when the response cannot be deserialized.

Applies to