# Class PipelineRunner

Compiles PlanContracts and executes them as graphs.

- Defined in packages/nexus-agents/src/pipeline/pipeline-runner.ts:101

##### Index

### Constructors

constructor

### Methods

compile
execute
retryFailed

## Constructors

### constructor

- new PipelineRunner(): PipelineRunner

  #### Returns PipelineRunner

## Methods

### compile

- compile(
  plan: {
  taskId: string;
  stages: {
  id: string;
  type: "analyze" | "validate" | "aggregate" | "execute" | "gate" | "route";
  pluginId: string;
  inputArtifacts: string[];
  outputArtifacts: string[];
  dependencies: string[];
  config: Record<string, unknown>;
  preferredCli?: string;
  maxRetries?: number;
  timeoutMs?: number;
  }[];
  policyGates: {
  id: string;
  afterStage: string;
  beforeStage: string;
  rules: string[];
  onFail: "warn"
  | "block"
  | "escalate";
  }[];
  estimatedCost: {
  totalTokensIn: number;
  totalTokensOut: number;
  estimatedCostUsd: number;
  modelCalls: number;
  };
  approvalRequired: boolean;
  maxIterations: number;
  timeoutMs: number;
  },
  options?: PlanCompileOptions,
  ): CompileResult

  Compiles a PlanContract into a CompiledPipeline.

  #### Parameters

  - plan: {
    taskId: string;
    stages: {
    id: string;
    type: "analyze" | "validate" | "aggregate" | "execute" | "gate" | "route";
    pluginId: string;
    inputArtifacts: string[];
    outputArtifacts: string[];
    dependencies: string[];
    config: Record<string, unknown>;
    preferredCli?: string;
    maxRetries?: number;
    timeoutMs?: number;
    }[];
    policyGates: {
    id: string;
    afterStage: string;
    beforeStage: string;
    rules: string[];
    onFail: "warn"
    | "block"
    | "escalate";
    }[];
    estimatedCost: {
    totalTokensIn: number;
    totalTokensOut: number;
    estimatedCostUsd: number;
    modelCalls: number;
    };
    approvalRequired: boolean;
    maxIterations: number;
    timeoutMs: number;
    }
  - `Optional` options: PlanCompileOptions

  #### Returns CompileResult

  - Defined in packages/nexus-agents/src/pipeline/pipeline-runner.ts:103

### execute

- execute(
  pipeline: CompiledPipeline,
  task: {
  id: string;
  description: string;
  status:
  | "failed"
  | "planning"
  | "executing"
  | "approved"
  | "done"
  | "intake"
  | "clarifying"
  | "validating";
  analysis: { complexity: string; taskType: string; ambiguityScore: number };
  constraints: { time?: string; quality?: string; scope: string[] };
  requiredCapabilities: { tools: string[]; experts: string[] };
  capabilityGaps: {
  available: { tools: string[]; experts: string[] };
  gaps: unknown[];
  allSatisfied: boolean;
  };
  parentId?: string;
  artifacts: {
  id: string;
  type: | "code"
  | "plan"
  | "analysis"
  | "review"
  | "test"
  | "spec"
  | "report"
  | "vote";
  }[];
  metadata: Record<string, unknown>;
  createdAt: number;
  updatedAt: number;
  completedAt?: number;
  error?: string;
  },
  options?: PipelineExecuteOptions,
  ): Promise<ExecuteResult>

  Executes a compiled pipeline.

  #### Parameters

  - pipeline: CompiledPipeline
  - task: {
    id: string;
    description: string;
    status:
    | "failed"
    | "planning"
    | "executing"
    | "approved"
    | "done"
    | "intake"
    | "clarifying"
    | "validating";
    analysis: { complexity: string; taskType: string; ambiguityScore: number };
    constraints: { time?: string; quality?: string; scope: string[] };
    requiredCapabilities: { tools: string[]; experts: string[] };
    capabilityGaps: {
    available: { tools: string[]; experts: string[] };
    gaps: unknown[];
    allSatisfied: boolean;
    };
    parentId?: string;
    artifacts: {
    id: string;
    type: | "code"
    | "plan"
    | "analysis"
    | "review"
    | "test"
    | "spec"
    | "report"
    | "vote";
    }[];
    metadata: Record<string, unknown>;
    createdAt: number;
    updatedAt: number;
    completedAt?: number;
    error?: string;
    }
  - `Optional` options: PipelineExecuteOptions

  #### Returns Promise<ExecuteResult>

  - Defined in packages/nexus-agents/src/pipeline/pipeline-runner.ts:118

### retryFailed

- retryFailed(
  pipeline: CompiledPipeline,
  previousResult: PipelineResult,
  task: {
  id: string;
  description: string;
  status:
  | "failed"
  | "planning"
  | "executing"
  | "approved"
  | "done"
  | "intake"
  | "clarifying"
  | "validating";
  analysis: { complexity: string; taskType: string; ambiguityScore: number };
  constraints: { time?: string; quality?: string; scope: string[] };
  requiredCapabilities: { tools: string[]; experts: string[] };
  capabilityGaps: {
  available: { tools: string[]; experts: string[] };
  gaps: unknown[];
  allSatisfied: boolean;
  };
  parentId?: string;
  artifacts: {
  id: string;
  type: | "code"
  | "plan"
  | "analysis"
  | "review"
  | "test"
  | "spec"
  | "report"
  | "vote";
  }[];
  metadata: Record<string, unknown>;
  createdAt: number;
  updatedAt: number;
  completedAt?: number;
  error?: string;
  },
  options?: PipelineExecuteOptions,
  ): Promise<ExecuteResult>

  Re-executes only the failed/skipped steps from a previous result. Requires the original pipeline and a result with stepResults.

  #### Parameters

  - pipeline: CompiledPipeline
  - previousResult: PipelineResult
  - task: {
    id: string;
    description: string;
    status:
    | "failed"
    | "planning"
    | "executing"
    | "approved"
    | "done"
    | "intake"
    | "clarifying"
    | "validating";
    analysis: { complexity: string; taskType: string; ambiguityScore: number };
    constraints: { time?: string; quality?: string; scope: string[] };
    requiredCapabilities: { tools: string[]; experts: string[] };
    capabilityGaps: {
    available: { tools: string[]; experts: string[] };
    gaps: unknown[];
    allSatisfied: boolean;
    };
    parentId?: string;
    artifacts: {
    id: string;
    type: | "code"
    | "plan"
    | "analysis"
    | "review"
    | "test"
    | "spec"
    | "report"
    | "vote";
    }[];
    metadata: Record<string, unknown>;
    createdAt: number;
    updatedAt: number;
    completedAt?: number;
    error?: string;
    }
  - `Optional` options: PipelineExecuteOptions

  #### Returns Promise<ExecuteResult>

  - Defined in packages/nexus-agents/src/pipeline/pipeline-runner.ts:154