Define a workflow
Create a file inworkflows/:
workflows/content-pipeline.ts
Steps
A step runs an agent or a tool:Step options
| Property | Type | Description |
|---|---|---|
agent | string | Agent | Agent to run (by ID or instance) |
tool | string | Tool | Tool to execute (by ID or instance) |
input | string | object | (ctx) => unknown | Step input |
checkpoint | boolean | Persist state after this step |
retry | RetryConfig | Retry on failure |
timeout | string | number | Step timeout |
skip | (ctx) => boolean | Skip this step conditionally |
Parallel execution
Run steps concurrently:"compile" step waits for all of them to finish.
Parallel strategies
Branching
Usebranch for conditional paths:
Human-in-the-loop
Pause a workflow until a human approves or rejects:waitForApproval and resumes when an approver responds. If the timeout expires, the workflow fails.
Wait for events
Pause until an external event arrives:Loops
Repeat steps based on conditions:Workflow configuration
React hooks
Track workflow progress from the client:Next
- Multi-Agent: compose agents in workflows and tools
- Providers: configure the LLM providers that power your agents
Related
veryfront/workflow: workflow API reference