Workflows
Define how tasks execute together, either sequentially or in parallel. Compose and nest workflows for complex pipelines.
Overview
Workflows provide a declarative way to orchestrate multiple AI tasks. They handle execution order, data passing between tasks, and error handling automatically.
Creating a Workflow
Create workflows using the Workflow and Task classes:
workflow-basic.ts
Parallel Execution
Run tasks in parallel when they don't depend on each other:
workflow-parallel.ts
Nested Workflows
Combine sequential and parallel execution for complex pipelines:
workflow-nested.ts
Tip
Nest workflows to create sophisticated execution patterns. Each nested workflow completes before the parent continues.
Workflow Types
Sequential
Tasks execute one after another. Output from one task can be used as input for the next.
Task A → Task B → Task CParallel
Tasks execute simultaneously. All tasks must complete before the workflow continues.
Task A ‖ Task B ‖ Task CReal-World Example
Here's a workflow for building a feature:
workflow-feature.ts