Skip to content

PipelinePhase

NexusLabs.Needlr.AgentFramework.Workflows

NexusLabs.Needlr.AgentFramework.Workflows.Sequential

PipelinePhase Class

Defines a named group of sequential stages that share runtime configuration. The SequentialPipelineRunner applies the phase's policy (lifecycle hooks, token budget) before executing any stage within it.

public sealed record PipelinePhase : System.IEquatable<NexusLabs.Needlr.AgentFramework.Workflows.Sequential.PipelinePhase>

Inheritance System.Object 🡒 PipelinePhase

Implements System.IEquatable<PipelinePhase>

Example

var phases = new[]
{
    new PipelinePhase("Analysis", [
        new PipelineStage("ParseDiff", diffParser),
        new PipelineStage("SecurityScan", securityScanner),
    ]),
    new PipelinePhase("Synthesis", [
        new PipelineStage("GenerateComments", commentGenerator),
    ], new PipelinePhasePolicy { TokenBudget = 30_000 }),
};

await runner.RunPhasedAsync(workspace, phases, options: null, ct);

Remarks

Phases represent runtime configuration boundaries, not logical groupings. The same phase configuration can appear multiple times in a pipeline — each PipelinePhase instance is a distinct runtime scope with its own OnEnterAsync invocation and budget scope.

Empty phases (zero stages) are valid. OnEnterAsync and progress events still fire, enabling setup-only phases.

Constructors

PipelinePhase(string, IReadOnlyList<PipelineStage>, PipelinePhasePolicy) Constructor

Defines a named group of sequential stages that share runtime configuration. The SequentialPipelineRunner applies the phase's policy (lifecycle hooks, token budget) before executing any stage within it.

public PipelinePhase(string Name, System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.AgentFramework.Workflows.Sequential.PipelineStage> Stages, NexusLabs.Needlr.AgentFramework.Workflows.Sequential.PipelinePhasePolicy? Policy=null);

Parameters

Name System.String

Human-readable name for the phase (used in diagnostics, progress events, and result metadata).

Stages System.Collections.Generic.IReadOnlyList<PipelineStage>

The ordered list of stages within this phase.

Policy PipelinePhasePolicy

Optional PipelinePhasePolicy controlling lifecycle hooks and phase-level budget.

Example

var phases = new[]
{
    new PipelinePhase("Analysis", [
        new PipelineStage("ParseDiff", diffParser),
        new PipelineStage("SecurityScan", securityScanner),
    ]),
    new PipelinePhase("Synthesis", [
        new PipelineStage("GenerateComments", commentGenerator),
    ], new PipelinePhasePolicy { TokenBudget = 30_000 }),
};

await runner.RunPhasedAsync(workspace, phases, options: null, ct);

Remarks

Phases represent runtime configuration boundaries, not logical groupings. The same phase configuration can appear multiple times in a pipeline — each PipelinePhase instance is a distinct runtime scope with its own OnEnterAsync invocation and budget scope.

Empty phases (zero stages) are valid. OnEnterAsync and progress events still fire, enabling setup-only phases.

Properties

PipelinePhase.Name Property

Human-readable name for the phase (used in diagnostics, progress events, and result metadata).

public string Name { get; init; }

Property Value

System.String

PipelinePhase.Policy Property

Optional PipelinePhasePolicy controlling lifecycle hooks and phase-level budget.

public NexusLabs.Needlr.AgentFramework.Workflows.Sequential.PipelinePhasePolicy? Policy { get; init; }

Property Value

PipelinePhasePolicy

PipelinePhase.Stages Property

The ordered list of stages within this phase.

public System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.AgentFramework.Workflows.Sequential.PipelineStage> Stages { get; init; }

Property Value

System.Collections.Generic.IReadOnlyList<PipelineStage>