Skip to main content

Interface: SyncStageDefinition<TInput, TOutput, TConfig, TContext, TId>

Defined in: packages/workflow-engine/src/core/stage-factory.ts:183

Sync stage definition

Type Parameters​

TInput​

TInput extends z.ZodTypeAny | "none"

TOutput​

TOutput extends z.ZodTypeAny

TConfig​

TConfig extends z.ZodTypeAny

TContext​

TContext extends Record<string, unknown> = Record<string, unknown>

TId​

TId extends string = string

Properties​

dependencies?​

optional dependencies?: string[]

Defined in: packages/workflow-engine/src/core/stage-factory.ts:197

Stage IDs this stage depends on (validated at workflow build time)


description?​

optional description?: string

Defined in: packages/workflow-engine/src/core/stage-factory.ts:195

Optional description


estimateCost?​

optional estimateCost?: (input, config) => number

Defined in: packages/workflow-engine/src/core/stage-factory.ts:220

Optional: Estimate cost before execution

Parameters​

input​

InferInput<TInput>

config​

output<TConfig>

Returns​

number


execute​

execute: (ctx) => Promise<SimpleSuspendedResult | SimpleStageResult<output<TOutput>>>

Defined in: packages/workflow-engine/src/core/stage-factory.ts:213

Execute the stage logic Return just { output } - metrics are auto-calculated

Parameters​

ctx​

EnhancedStageContext<InferInput<TInput>, output<TConfig>, TContext>

Returns​

Promise<SimpleSuspendedResult | SimpleStageResult<output<TOutput>>>


id​

id: TId

Defined in: packages/workflow-engine/src/core/stage-factory.ts:191

Unique stage identifier


name​

name: string

Defined in: packages/workflow-engine/src/core/stage-factory.ts:193

Human-readable name


schemas​

schemas: object

Defined in: packages/workflow-engine/src/core/stage-factory.ts:200

Zod schemas for validation

config​

config: TConfig

Configuration schema

input​

input: TInput

Input schema, or "none" for stages that use workflowContext

output​

output: TOutput

Output schema