Class: Workflow<TInput, TOutput, TContext>
Defined in: packages/workflow-engine/src/core/workflow.ts:163
Type Parameters
TInput
TInput extends z.ZodTypeAny
TOutput
TOutput extends z.ZodTypeAny
TContext
TContext extends Record<string, unknown> = { }
Constructors
Constructor
new Workflow<
TInput,TOutput,TContext>(id,name,description,inputSchema,outputSchema,stages,contextType?,options?):Workflow<TInput,TOutput,TContext>
Defined in: packages/workflow-engine/src/core/workflow.ts:168
Parameters
id
string
name
string
description
string
inputSchema
TInput
outputSchema
TOutput
stages
StageNode[]
contextType?
TContext
options?
WorkflowDefinitionOptions
Returns
Workflow<TInput, TOutput, TContext>
Properties
contextType?
readonlyoptionalcontextType?:TContext
Defined in: packages/workflow-engine/src/core/workflow.ts:175
description
readonlydescription:string
Defined in: packages/workflow-engine/src/core/workflow.ts:171
id
readonlyid:string
Defined in: packages/workflow-engine/src/core/workflow.ts:169
inputSchema
readonlyinputSchema:TInput
Defined in: packages/workflow-engine/src/core/workflow.ts:172
name
readonlyname:string
Defined in: packages/workflow-engine/src/core/workflow.ts:170
outputSchema
readonlyoutputSchema:TOutput
Defined in: packages/workflow-engine/src/core/workflow.ts:173
Accessors
definitionVersion
Get Signature
get definitionVersion():
string
Defined in: packages/workflow-engine/src/core/workflow.ts:204
The version a run created against this definition is pinned to.
Derived from getDefinitionSnapshot unless the builder declared
one with .version(...), in which case that string is used verbatim
(Conductor-style manual versioning). Editing a stage body, a stage
name or a comment does not change a derived version; adding,
removing, reordering or re-typing a stage does.
Returns
string
Methods
getAllStages()
getAllStages():
StageNode[]
Defined in: packages/workflow-engine/src/core/workflow.ts:245
Get all stages in order
Returns
StageNode[]
getDefaultConfig()
getDefaultConfig():
Record<string,Record<string,unknown>>
Defined in: packages/workflow-engine/src/core/workflow.ts:358
Generate default configuration object for all stages Automatically discovers all stage configs - add/remove stages and this updates automatically
Returns
Record<string, Record<string, unknown>>
getDefinitionSnapshot()
getDefinitionSnapshot():
DefinitionSnapshot
Defined in: packages/workflow-engine/src/core/workflow.ts:188
The structural contract this definition presents to runs pinned to it:
stage ids, execution groups, definition order, dependencies, modes and
the normalised JSON Schema of every schema involved. See
core/definition-version.ts for what is deliberately excluded.
Returns
getExecutionGroupIndex()
getExecutionGroupIndex(
stageId):number
Defined in: packages/workflow-engine/src/core/workflow.ts:387
Get the execution group index for a stage
Parameters
stageId
string
Returns
number
getExecutionPlan()
getExecutionPlan():
StageNode[][]
Defined in: packages/workflow-engine/src/core/workflow.ts:216
Get execution plan as groups of stages Stages in the same group can be executed in parallel
Returns
StageNode[][]
getPreviousStageId()
getPreviousStageId(
stageId):string|undefined
Defined in: packages/workflow-engine/src/core/workflow.ts:396
Get the ID of the stage immediately preceding the given stage
Parameters
stageId
string
Returns
string | undefined
getStage()
getStage(
stageId):Stage<any,any,any,Record<string,unknown>,string> |undefined
Defined in: packages/workflow-engine/src/core/workflow.ts:237
Get a specific stage by ID
Parameters
stageId
string
Returns
Stage<any, any, any, Record<string, unknown>, string> | undefined
getStageConfigs()
getStageConfigs():
Record<string, {defaults:Record<string,unknown>;description?:string;name:string;schema:z.ZodTypeAny; }>
Defined in: packages/workflow-engine/src/core/workflow.ts:321
Get configuration schemas for all stages in this workflow Returns a map of stageId → { schema, defaults, name, description }
Returns
Record<string, { defaults: Record<string, unknown>; description?: string; name: string; schema: z.ZodTypeAny; }>
getStageIds()
getStageIds():
string[]
Defined in: packages/workflow-engine/src/core/workflow.ts:260
Get all stage IDs in execution order
Returns
string[]
Array of stage IDs
Example
const ids = workflow.getStageIds();
// ["data-extraction", "guidelines", "generator"]
getStageIndex()
getStageIndex(
stageId):number
Defined in: packages/workflow-engine/src/core/workflow.ts:380
Get the sequential index of a stage (0-based)
Parameters
stageId
string
Returns
number
getStagesInExecutionGroup()
getStagesInExecutionGroup(
groupIndex):Stage<any,any,any,Record<string,unknown>,string>[]
Defined in: packages/workflow-engine/src/core/workflow.ts:371
Get all stages in a specific execution group
Parameters
groupIndex
number
Returns
Stage<any, any, any, Record<string, unknown>, string>[]
hasStage()
hasStage(
stageId):boolean
Defined in: packages/workflow-engine/src/core/workflow.ts:270
Check if a stage ID exists in this workflow
Parameters
stageId
string
The stage ID to check
Returns
boolean
true if the stage exists
validateConfig()
validateConfig(
config):object
Defined in: packages/workflow-engine/src/core/workflow.ts:281
Validate workflow configuration before execution Checks that all stage configs match their schemas
Parameters
config
Record<string, unknown>
Configuration object with keys matching stage IDs
Returns
object
Validation result with any errors
errors
errors:
object[]
valid
valid:
boolean