Share via


HostApplicationBuilderWorkflowExtensions.AddWorkflow Method

Definition

Registers a custom workflow using a factory delegate.

public static Microsoft.Agents.AI.Hosting.IHostedWorkflowBuilder AddWorkflow(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Func<IServiceProvider,string,Microsoft.Agents.AI.Workflows.Workflow> createWorkflowDelegate);
static member AddWorkflow : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Func<IServiceProvider, string, Microsoft.Agents.AI.Workflows.Workflow> -> Microsoft.Agents.AI.Hosting.IHostedWorkflowBuilder
<Extension()>
Public Function AddWorkflow (builder As IHostApplicationBuilder, name As String, createWorkflowDelegate As Func(Of IServiceProvider, String, Workflow)) As IHostedWorkflowBuilder

Parameters

name
String

The unique name for the workflow.

createWorkflowDelegate
Func<IServiceProvider,String,Workflow>

A factory function that creates the Workflow instance. The function receives the service provider and workflow name as parameters.

Returns

An IHostedWorkflowBuilder that can be used to further configure the workflow.

Exceptions

Thrown when builder, name, or createWorkflowDelegate is null.

Thrown when name is empty.

Thrown when the factory delegate returns null or a workflow with a name that doesn't match the expected name.

Applies to