Share via


FunctionExecutor<TInput,TOutput> Constructors

Definition

Overloads

FunctionExecutor<TInput,TOutput>(String, Func<TInput,IWorkflowContext, CancellationToken,ValueTask<TOutput>>, ExecutorOptions, IEnumerable<Type>, IEnumerable<Type>, Boolean)

Executes a user-provided asynchronous function in response to workflow messages of the specified input type,

public FunctionExecutor(string id, Func<TInput,Microsoft.Agents.AI.Workflows.IWorkflowContext,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TOutput>> handlerAsync, Microsoft.Agents.AI.Workflows.ExecutorOptions? options = default, System.Collections.Generic.IEnumerable<Type>? sentMessageTypes = default, System.Collections.Generic.IEnumerable<Type>? outputTypes = default, bool declareCrossRunShareable = false);
new Microsoft.Agents.AI.Workflows.FunctionExecutor<'Input, 'Output> : string * Func<'Input, Microsoft.Agents.AI.Workflows.IWorkflowContext, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Output>> * Microsoft.Agents.AI.Workflows.ExecutorOptions * seq<Type> * seq<Type> * bool -> Microsoft.Agents.AI.Workflows.FunctionExecutor<'Input, 'Output>
Public Sub New (id As String, handlerAsync As Func(Of TInput, IWorkflowContext, CancellationToken, ValueTask(Of TOutput)), Optional options As ExecutorOptions = Nothing, Optional sentMessageTypes As IEnumerable(Of Type) = Nothing, Optional outputTypes As IEnumerable(Of Type) = Nothing, Optional declareCrossRunShareable As Boolean = false)

Parameters

id
String

A unique identifier for the executor.

handlerAsync
Func<TInput,IWorkflowContext,CancellationToken,ValueTask<TOutput>>

A delegate that defines the asynchronous function to execute for each input message.

options
ExecutorOptions

Configuration options for the executor. If null, default options will be used.

sentMessageTypes
IEnumerable<Type>

Additional message types sent by the handler. Defaults to empty, and will filter out non-matching messages.

outputTypes
IEnumerable<Type>

Additional message types yielded as output by the handler. Defaults to empty.

declareCrossRunShareable
Boolean

Declare that this executor may be used simultaneously by multiple runs safely.

Applies to

FunctionExecutor<TInput,TOutput>(String, Func<TInput,IWorkflowContext, CancellationToken,TOutput>, ExecutorOptions, IEnumerable<Type>, IEnumerable<Type>, Boolean)

Creates a new instance of the FunctionExecutor<TInput,TOutput> class.

public FunctionExecutor(string id, Func<TInput,Microsoft.Agents.AI.Workflows.IWorkflowContext,System.Threading.CancellationToken,TOutput> handlerSync, Microsoft.Agents.AI.Workflows.ExecutorOptions? options = default, System.Collections.Generic.IEnumerable<Type>? sentMessageTypes = default, System.Collections.Generic.IEnumerable<Type>? outputTypes = default, bool declareCrossRunShareable = false);
new Microsoft.Agents.AI.Workflows.FunctionExecutor<'Input, 'Output> : string * Func<'Input, Microsoft.Agents.AI.Workflows.IWorkflowContext, System.Threading.CancellationToken, 'Output> * Microsoft.Agents.AI.Workflows.ExecutorOptions * seq<Type> * seq<Type> * bool -> Microsoft.Agents.AI.Workflows.FunctionExecutor<'Input, 'Output>
Public Sub New (id As String, handlerSync As Func(Of TInput, IWorkflowContext, CancellationToken, TOutput), Optional options As ExecutorOptions = Nothing, Optional sentMessageTypes As IEnumerable(Of Type) = Nothing, Optional outputTypes As IEnumerable(Of Type) = Nothing, Optional declareCrossRunShareable As Boolean = false)

Parameters

id
String

A unique identifier for the executor.

handlerSync
Func<TInput,IWorkflowContext,CancellationToken,TOutput>

A synchronous function to execute for each input message and workflow context.

options
ExecutorOptions

Configuration options for the executor. If null, default options will be used.

sentMessageTypes
IEnumerable<Type>

Additional message types sent by the handler. Defaults to empty, and will filter out non-matching messages.

outputTypes
IEnumerable<Type>

Additional message types yielded as output by the handler. Defaults to empty.

declareCrossRunShareable
Boolean

Declare that this executor may be used simultaneously by multiple runs safely.

Applies to