ICopilotClient.ExecuteAsync(String, IActivity, CancellationToken) 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.
Executes an activity within the context of a specific conversation. This method ensures the activity is associated with the provided conversation ID.
public System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.Core.Models.IActivity> ExecuteAsync(string conversationId, Microsoft.Agents.Core.Models.IActivity activityToSend, System.Threading.CancellationToken cancellationToken);
abstract member ExecuteAsync : string * Microsoft.Agents.Core.Models.IActivity * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.Core.Models.IActivity>
Public Function ExecuteAsync (conversationId As String, activityToSend As IActivity, cancellationToken As CancellationToken) As IAsyncEnumerable(Of IActivity)
Parameters
- conversationId
- String
The conversation ID to execute the activity within. Cannot be null.
- activityToSend
- IActivity
The activity to send to the Copilot Studio agent. Cannot be null.
- cancellationToken
- CancellationToken
Cancellation token to cancel the operation.
Returns
An async enumerable stream of activities representing the agent's responses.
Exceptions
Thrown when activityToSend or conversationId is null.
Thrown when the HTTP request to Copilot Studio fails.
Thrown when the response cannot be deserialized.
Remarks
This method forces the activity's conversation ID to match the provided parameter, overriding any conversation ID that may already be set on the activity.