Share via


IWorkflowExecutionEnvironment.RunAsync<TInput> Method

Definition

Initiates a non-streaming execution of the workflow with the specified input.

public System.Threading.Tasks.ValueTask<Microsoft.Agents.AI.Workflows.Run> RunAsync<TInput>(Microsoft.Agents.AI.Workflows.Workflow workflow, TInput input, string? sessionId = default, System.Threading.CancellationToken cancellationToken = default);
abstract member RunAsync : Microsoft.Agents.AI.Workflows.Workflow * 'Input * string * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Agents.AI.Workflows.Run>
Public Function RunAsync(Of TInput) (workflow As Workflow, input As TInput, Optional sessionId As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Run)

Type Parameters

TInput

The type of input accepted by the workflow. Must be non-nullable.

Parameters

workflow
Workflow

The workflow to be executed. Must not be null.

input
TInput

The input message to be processed as part of the run.

sessionId
String

An optional unique identifier for the session. If not provided, a new identifier will be generated.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

A ValueTask<TResult> that represents the asynchronous operation. The result contains a Run for managing and interacting with the streaming run.

Remarks

The workflow will run until its first halt, and the returned Run will capture all outgoing events. Use the Run instance to resume execution with responses to outgoing events.

Applies to