Basic Usage
Workflows are declarative — the class body is empty. All configuration goes in the decorator metadata.
Signature
Configuration Options
Required Properties
| Property | Type | Description |
|---|---|---|
name | string | Unique workflow identifier |
steps | WorkflowStep[] | Step definitions (minimum 1) |
Optional Properties
| Property | Type | Default | Description |
|---|---|---|---|
description | string | — | Workflow description |
id | string | name | Stable identifier for tracking |
trigger | 'manual' | 'webhook' | 'event' | 'manual' | How the workflow is triggered |
webhook | WorkflowWebhookConfig | — | Webhook configuration |
timeout | number | 600000 | Max total execution time in ms (10 min) |
maxConcurrency | number | 5 | Max parallel step concurrency |
tags | string[] | — | Categorization tags |
labels | Record<string, string> | — | Key-value labels |
hideFromDiscovery | boolean | false | Hide from list-workflows |
permissions | JobPermission[] | — | RBAC permission rules |
inputSchema | ZodShape | — | Workflow-level input schema |
outputSchema | ZodShape | — | Workflow-level output schema |
WorkflowStep
| Property | Type | Default | Description |
|---|---|---|---|
id | string | — | Required. Unique step identifier |
jobName | string | — | Required. Name of the registered job to execute |
dependsOn | string[] | [] | Step IDs that must complete first |
input | object | function | Workflow input | Static input or dynamic callback |
condition | (steps) => boolean | — | Skip step if returns false |
continueOnError | boolean | false | Continue workflow if step fails |
timeout | number | Job default | Per-step timeout override in ms |
retry | JobRetryConfig | Job default | Per-step retry override (maxAttempts, backoffMs, backoffMultiplier, maxBackoffMs) |
WorkflowWebhookConfig
| Property | Type | Default | Description |
|---|---|---|---|
path | string | /workflows/webhook/{name} | Custom webhook path |
secret | string | — | Webhook secret for validation. Load from environment variables or a secrets manager — never hardcode in source. |
methods | ('GET' | 'POST')[] | ['POST'] | Allowed HTTP methods |
Examples
Linear Workflow
Parallel Workflow
Conditional Workflow
A step whose
condition returns false is treated as skipped and satisfies downstream dependsOn dependencies. This means steps that depend on a skipped step will still run.Function-Based Alternative
Related
WorkflowRegistry
Workflow registry API
Workflows Guide
Workflows documentation
@Job
Define jobs
DirectClient
Programmatic execution