Skip to content

WorkflowDefinition

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Represents the full definition of a workflow, whether defined through the UI or in code.

public sealed record WorkflowDefinition : IEquatable<WorkflowDefinition>

objectWorkflowDefinition

IEquatable<WorkflowDefinition>

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

A definition is a graph, not code: it only wires together agents from the catalog. Users do not write new behavior, they arrange existing behavior. A free-form graph (custom Executor types) can only be defined in code, via AddWorkflow(name, factory).

WorkflowDefinition.AgentNames is a list of names only. Each name must resolve to an agent in the catalog; if it does not, compilation fails. The same rule applies to AgentDefinition.ToolNames and draws the same security boundary.

public WorkflowDefinition()

Gets the agent names to enter the graph. Order is meaningful for WorkflowKind.Sequential; for other kinds it defines the participant set.

public IReadOnlyList<string> AgentNames { get; init; }

IReadOnlyList<string>

Gets the short description of what the workflow does.

public string? Description { get; init; }

string?

Gets the display name shown in the UI. Name is used if left empty.

public string? DisplayName { get; init; }

string?

Gets the extra instruction that tells the model how to decide on a handoff. Used only for WorkflowKind.Handoff.

public string? HandoffInstructions { get; init; }

string?

Gets the built-in pattern to use.

public required WorkflowKind Kind { get; init; }

WorkflowKind

Gets the manager agent’s name. Required for WorkflowKind.Magentic, unused in other patterns.

public string? ManagerAgentName { get; init; }

string?

Gets the maximum number of turns. The only guard against an infinite loop in the WorkflowKind.GroupChat, WorkflowKind.Handoff, and WorkflowKind.Magentic patterns.

public int? MaxIterations { get; init; }

int?

Gets the workflow’s unique name. Serves as the key in the catalog and in API routes.

public required string Name { get; init; }

string

Gets the ordered node list for a WorkflowKind.Sequential workflow that mixes agent and function nodes.

public IReadOnlyList<WorkflowNodeReference> Nodes { get; init; }

IReadOnlyList<WorkflowNodeReference>

Empty for every definition that does not use a function node - which keeps WorkflowDefinition.AgentNames driving the graph exactly as before this field existed. When non-empty, WorkflowDefinition.Kind must be WorkflowKind.Sequential and WorkflowDefinition.AgentNames must be empty; the validator in AgentPrism.Core enforces both rules. Microsoft Agent Framework’s ready-made builders for the other four patterns (Concurrent, Handoff, GroupChat, Magentic) accept only agents, so a function node cannot enter those graphs without hand-writing their orchestration logic - out of scope.

Whether each function name is actually registered is checked at save time (the HTTP layer, via IWorkflowFunctionCatalog) and again at compile time, unlike agent names - which are checked only at compile time because the agent catalog can change between the two. The function registry cannot: it is fixed for the lifetime of the process, so checking early gives an honest guarantee.

Gets whether the plan the manager agent builds must be approved by a human before execution starts. Applies only to WorkflowKind.Magentic.

public bool RequirePlanApproval { get; init; }

bool

When enabled, Microsoft Agent Framework publishes an external request at the end of the first super-step; the run becomes RunStatus.AwaitingInput and its state is written to a checkpoint. The response is given via POST /api/workflows/runs/{runId}/respond: the plan is either approved or sent back with revision text.

Cost. The manager agent runs again on every turn; a revision request makes it rebuild the plan from scratch. The default of false is deliberate: a run never stalls half-way unless a definition opts in explicitly (the no-surprises rule - zero surprises).

Gets the tenant the definition belongs to. null for workflows defined in code.

public string? TenantId { get; init; }

string?

Gets the last modification time (UTC).

public DateTimeOffset? UpdatedAt { get; init; }

DateTimeOffset?

Gets the definition version. Increments by one on every save.

public int Version { get; init; }

int

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(WorkflowDefinition? other)

other WorkflowDefinition?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(WorkflowDefinition?, WorkflowDefinition?)

Section titled “ operator ==(WorkflowDefinition?, WorkflowDefinition?)”
public static bool operator ==(WorkflowDefinition? left, WorkflowDefinition? right)

left WorkflowDefinition?

right WorkflowDefinition?

bool

operator !=(WorkflowDefinition?, WorkflowDefinition?)

Section titled “ operator !=(WorkflowDefinition?, WorkflowDefinition?)”
public static bool operator !=(WorkflowDefinition? left, WorkflowDefinition? right)

left WorkflowDefinition?

right WorkflowDefinition?

bool