.NET API
WorkflowFunctionBinding
Tracon.Workflows.dllBinds functions registered with AddWorkflowFunction to a workflow graph defined in code.
public static class WorkflowFunctionBinding- Inheritance
- object ← WorkflowFunctionBinding
- Inherited Members
- object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”A stored workflow chain gets, for every function node, a time limit, a retry policy, a budget gate, a concurrency limit, a cost line that names the node and a strict read of its settings. A graph built in code with its own executors gets none of them: they live in a wrapper that only the stored chain’s compiler could reach, and the budget gate cannot be built in consumer code at all. This helper hands the same executor to a graph built in code - the same registry entry, the same wrapper, the same order.
The executor’s id is the function’s name. The node name in the run’s events, in the cost lines and in the checkpoint is the name the function was registered with, so use a function once in a graph; to use the same code twice, register it under a second name.
tracon.AddWorkflow("review-and-revise", services =>{ var validate = services.GetWorkflowFunction("validate"); var render = services.GetWorkflowFunction("render", step => step.Timeout = TimeSpan.FromMinutes(5));
return new WorkflowBuilder(validate) .AddEdge(validate, render) .WithOutputFrom(render) .WithName("review-and-revise") .Build();});Methods
Section titled “Methods”GetWorkflowFunction(IServiceProvider, string)
Section titled “ GetWorkflowFunction(IServiceProvider, string)”Binds a registered function to a workflow graph defined in code.
public static ExecutorBinding GetWorkflowFunction(this IServiceProvider services, string functionName)Parameters
Section titled “Parameters”services IServiceProvider
The service provider.
functionName string
The name the function was registered with.
Returns
Section titled “Returns”ExecutorBinding
The executor binding to put in the graph.
Remarks
Section titled “Remarks”Everything the other overload says applies here too. The function runs with its registered time limit, retry policy, concurrency limit and budget gate, and with no settings.
Exceptions
Section titled “Exceptions”services is null.
functionName is empty.
No function is registered with that name. The graph is built for every run, so the run ends
Failed before its first node, and the message names the workflow and the function.
GetWorkflowFunction(IServiceProvider, string, Action<WorkflowFunctionStepOptions>)
Section titled “ GetWorkflowFunction(IServiceProvider, string, Action<WorkflowFunctionStepOptions>)”Binds a registered function to a workflow graph defined in code, with the node’s own timeout and settings.
public static ExecutorBinding GetWorkflowFunction(this IServiceProvider services, string functionName, Action<WorkflowFunctionStepOptions> configure)Parameters
Section titled “Parameters”services IServiceProvider
The service provider.
functionName string
The name the function was registered with.
configure Action<WorkflowFunctionStepOptions>
Sets the node’s timeout and settings; called once, here.
Returns
Section titled “Returns”ExecutorBinding
The executor binding to put in the graph.
Remarks
Section titled “Remarks”The graph is built again for every run, and so is the executor: Microsoft Agent Framework does not allow one executor instance to serve two runs. The settings are read here, once per build, so the handler sees exactly the object that was checked.
Input and output types are the function’s. A node must take what the node before it passes on; Microsoft Agent Framework drops a message no handler takes, without an error. The chain check a stored workflow gets at save time does not run for a graph built in code.
tracon.AddWorkflow("narrated", services =>{ var tts = services.GetWorkflowFunction("tts", step => { step.Timeout = TimeSpan.FromMinutes(10); step.SetSettings(new TtsSettings { Voice = "mira" }); });
return new WorkflowBuilder(tts).WithOutputFrom(tts).WithName("narrated").Build();});Exceptions
Section titled “Exceptions”One of the parameters is null.
functionName is empty.
WorkflowFunctionStepOptions.Timeout is outside one millisecond to about 49.7 days.
No function is registered with that name, or the settings do not fit the settings type the function
declares (or the function declares none). The graph is built for every run, so the run ends
Failed before its first node, and the message names the workflow, the function and the member.