Skip to content

AgentPrismWorkflowsBuilderExtensions

Namespace AgentPrism · Assembly AgentPrism.Workflows.dll

Extensions that register workflow execution.

public static class AgentPrismWorkflowsBuilderExtensions

objectAgentPrismWorkflowsBuilderExtensions

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

AddWorkflow(IAgentPrismBuilder, string, Func<IServiceProvider, Workflow>, string?)

Section titled “ AddWorkflow(IAgentPrismBuilder, string, Func<IServiceProvider, Workflow>, string?)”

Defines a factory-based workflow in code. How the graph is built is entirely up to the caller.

public static IAgentPrismBuilder AddWorkflow(this IAgentPrismBuilder builder, string name, Func<IServiceProvider, Workflow> factory, string? description = null)

builder IAgentPrismBuilder

The AgentPrism configuration chain.

name string

The workflow name.

factory Func<IServiceProvider, Workflow>

The factory that builds the graph.

description string?

A short description.

IAgentPrismBuilder

The chain, for continued configuration.

A workflow defined in code takes precedence over a database definition with the same name. The same rule applies to the agent catalog: someone with write access to the database cannot take over a behavior registered in code.

builder.AddAgentPrism()
.UseWorkflows()
.AddWorkflow("triage", provider => BuildTriageGraph(provider), "Routes an incoming ticket.");

ArgumentNullException

One of the parameters is null.

ArgumentException

name is empty.

UseWorkflows(IAgentPrismBuilder, Action<AgentPrismWorkflowOptions>?)

Section titled “ UseWorkflows(IAgentPrismBuilder, Action<AgentPrismWorkflowOptions>?)”

Registers the workflow execution engine. Agents from the catalog can be chained together with ready-made patterns, and every execution produces a runs row.

public static IAgentPrismBuilder UseWorkflows(this IAgentPrismBuilder builder, Action<AgentPrismWorkflowOptions>? configure = null)

builder IAgentPrismBuilder

The AgentPrism configuration chain.

configure Action<AgentPrismWorkflowOptions>?

The option customizer.

IAgentPrismBuilder

The chain, for continued configuration.

Security boundary. A workflow defined from the UI does not produce new behavior: it only sequences catalog agents with ready-made patterns whose order is fixed. A free-form graph - custom Executor types, conditional edges, sub-workflows - is only defined in code, with AgentPrismWorkflowsBuilderExtensions.AddWorkflow. The code-only tools rule is preserved this way.

The definition and checkpoint stores are already registered by AddAgentPrism; this call only turns execution on. While the engine is not registered, the HTTP layer can still list and manage definitions - only the execution endpoint returns 501.

AgentPrismWorkflowOptions.SectionName (AgentPrism:Workflows) is BOUND from IConfiguration - the same contract as every other Use* extension (UseOpenAI, UsePostgreSql, UseSkillScripts, and so on). configure runs AFTER this binding, so code can still override the config.

builder.AddAgentPrism()
.UseOpenAI(apiKey)
.UsePostgreSql(connectionString)
.UseWorkflows()
.UseUI();

ArgumentNullException

builder is null.