Share via


FunctionExecutor<TInput> Constructors

Definition

Overloads

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

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

public FunctionExecutor(string id, Action<TInput,Microsoft.Agents.AI.Workflows.IWorkflowContext,System.Threading.CancellationToken> 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> : string * Action<'Input, Microsoft.Agents.AI.Workflows.IWorkflowContext, System.Threading.CancellationToken> * Microsoft.Agents.AI.Workflows.ExecutorOptions * seq<Type> * seq<Type> * bool -> Microsoft.Agents.AI.Workflows.FunctionExecutor<'Input>
Public Sub New (id As String, handlerSync As Action(Of TInput, IWorkflowContext, CancellationToken), 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
Action<TInput,IWorkflowContext,CancellationToken>

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>

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

outputTypes
IEnumerable<Type>

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>(String, Func<TInput,IWorkflowContext, CancellationToken,ValueTask>, 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> 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> : string * Func<'Input, Microsoft.Agents.AI.Workflows.IWorkflowContext, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask> * Microsoft.Agents.AI.Workflows.ExecutorOptions * seq<Type> * seq<Type> * bool -> Microsoft.Agents.AI.Workflows.FunctionExecutor<'Input>
Public Sub New (id As String, handlerAsync As Func(Of TInput, IWorkflowContext, CancellationToken, ValueTask), 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>

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>

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

outputTypes
IEnumerable<Type>

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