Workflows execute jobs in dependency order with automatic cycle detection, parallel batching, and per-step error handling.
Why Workflows?
Workflows handle orchestration that individual jobs cannot:
Workflows are ideal for:
- Multi-step data pipelines — extract, transform, load sequences
- Approval chains — sequential steps with conditional logic
- Parallel processing — fan-out/fan-in patterns with bounded concurrency
- Event-driven automation — webhook-triggered multi-job flows
Creating Workflows
Workflows are defined declaratively using the@Workflow decorator with a steps array:
Function Style
Registering Workflows
Add workflows to your app via theworkflows array:
Jobs referenced by workflow steps must be registered in the same app or available in the scope’s job registry.
Workflow Steps
Each step defines a job to execute and how it connects to other steps:Step Dependencies
Steps declare dependencies usingdependsOn. The engine validates the DAG before execution:
- Duplicate ID detection — no two steps can share an ID
- Missing reference detection —
dependsOnmust reference existing step IDs - Cycle detection — DFS-based cycle detection prevents infinite loops
Dynamic Input
Steps can compute their input dynamically based on previous step outputs:steps context provides a get(stepId) method that returns WorkflowStepResult:
Conditional Steps
Steps can be conditionally skipped based on previous step results:false, the step is marked as skipped and downstream steps that depend on it will still execute (skipped steps are treated as completed for dependency resolution).
Parallel Execution
Steps with no mutual dependencies execute in parallel, bounded bymaxConcurrency:
Configuration
Webhook Configuration
Triggers
Execution Flow
Error Handling
When a step fails:- Default behavior — the step is marked as
failed, and downstream dependents areskipped - With
continueOnError: true— the step is marked asfailedbut treated as completed for dependency resolution, allowing downstream steps to proceed
MCP Tools
When workflows are enabled, the following MCP tools are automatically registered:
Hyphen aliases (
list-workflows, execute-workflow, …) still resolve with a deprecation log line for one release — agents and code that hardcoded the old form keep working.
Best Practices
Do:- Keep steps focused on a single job each
- Use
dependsOnto make data flow explicit - Set
continueOnError: truefor non-critical steps - Use dynamic input functions to pass data between steps
- Set appropriate
maxConcurrencybased on resource constraints
- Create deeply nested dependency chains when parallel execution is possible
- Skip DAG validation by referencing non-existent step IDs
- Set
maxConcurrencytoo high for resource-intensive jobs - Use workflows for single-step operations (use jobs directly)
Next Steps
Jobs
Define the jobs that workflows orchestrate
@Workflow
Decorator reference
WorkflowRegistry
Registry API reference
DirectClient
Programmatic workflow execution