Skip to main content

Interface: Stage<TInput, TOutput, TConfig, TWorkflowContext, TId>

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

Type Parameters​

TInput​

TInput extends z.ZodTypeAny

TOutput​

TOutput extends z.ZodTypeAny

TConfig​

TConfig extends z.ZodTypeAny

TWorkflowContext​

TWorkflowContext = Record<string, unknown>

TId​

TId extends string = string

Properties​

checkCompletion?​

optional checkCompletion?: (suspendedState, context) => Promise<CompletionCheckResult<output<TOutput>>>

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

Parameters​

suspendedState​
batchId​

string = ...

maxWaitTime?​

number = ...

Milliseconds.

Deprecated

Prefer pollConfig.maxWaitTime. Back-filled by defineStage() for async-batch checkCompletion; goes away with that mode, not before.

metadata?​

Record<string, unknown> = ...

pollInterval?​

number = ...

Milliseconds.

Deprecated

Prefer pollConfig.pollInterval. Back-filled by defineStage() for async-batch checkCompletion; goes away with that mode, not before.

statusUrl?​

string = ...

submittedAt?​

string = ...

ISO date string.

Deprecated

Read timing from pollConfig instead. defineStage() still back-fills this for checkCompletion implementations of the async-batch mode; it goes away with that mode, not before.

context​

CheckCompletionContext<output<TConfig>>

Returns​

Promise<CompletionCheckResult<output<TOutput>>>


configSchema​

configSchema: TConfig

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


dependencies?​

optional dependencies?: string[]

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

Optional: List of stage IDs that this stage depends on. The workflow builder will validate that all dependencies are present in the workflow before this stage is executed.

Example: dependencies: ["data-extraction", "guidelines"]


description?​

optional description?: string

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


estimateCost?​

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

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

Parameters​

input​

output<TInput>

config​

output<TConfig>

Returns​

number


execute​

execute: (context) => Promise<SuspendedResult | StageResult<output<TOutput>>>

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

Parameters​

context​

StageContext<output<TInput>, output<TConfig>, TWorkflowContext>

Returns​

Promise<SuspendedResult | StageResult<output<TOutput>>>


id​

id: TId

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


inputSchema​

inputSchema: TInput

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


mode?​

optional mode?: StageMode

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


name​

name: string

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


outputSchema​

outputSchema: TOutput

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