WorkflowConfig
Creation
<Input, Output, Meta, Ctx> when you need IDE hints for inputData, metadata, or ctx. Steps declared with schemas remain compatible either way.
Builder (WorkflowBuilder)
.then(step)– append an automatic step (createStep,createMapStep, …)..human(config | step)– add a human step (createHuman)..while(config | step)– add a controlled loop (createWhileStep)..conditions(step)– declare a condition step; chain.then(...)with an object{ branchId: step }or a list of steps..commit()– validate the structure, ensure no cycles, and return an immutableWorkflow.
id. Declare branches before calling commit().
Workflow methods
createRun(runId?: string)
Instantiates a WorkflowRun. A unique runId is generated via createRunId() if omitted.
run(options)
createRun().start(options)).
validateInput(value)
Applies inputSchema; throws WorkflowSchemaError on validation failures.
validateOutput(value)
Runs finalize then outputSchema. Handy for step-level tests.
getInitialMetadata()
Returns a deep copy of the initial metadata (may be undefined).
getTelemetryConfig()
Exposes the current telemetry configuration (boolean or overrides object).
getBaseContext()
Returns the base context (ctx) used for subsequent runs.
withTelemetry(option = true)
Enable/disable telemetry by mutating the workflow and return this. Use withTelemetry(workflow, option) for a functional approach.
inspect()
Provides the workflow graph (nodes, edges, entryId)—useful for visualisation and debugging.
Run options (WorkflowRunOptions)
The result (
WorkflowRunResult) includes:
status("success" \| "failed" \| "cancelled" \| "waiting_human");result(final output);error(if any);steps(snapshots per step, occurrences, branch taken);metadata,ctx(final states);startedAt,finishedAt;pendingHumanwhen the run is waiting for a human step.
WorkflowRun.