workflow
Core workflow primitives for steps, streaming, webhooks, and error handling.
Core workflow primitives including steps, context management, streaming, webhooks, and error handling.
Installation
npm i workflowWorkflow-only APIs
These functions must be called inside "use workflow" functions:
sleep()
Suspend a workflow for a specified duration or until a date. Deterministic and replay-safe.
fetch()
Make HTTP requests from within a workflow. Runs as a step under the hood.
createHook()
Create a hook with an optional custom token, resumed server-side via resumeHook().
createWebhook()
Create a webhook with a randomly generated token and public HTTP endpoint.
Workflow and Step APIs
These functions can be called from either "use workflow" or "use step" functions:
getWorkflowMetadata()
Return context about the current workflow execution.
getWritable()
Access the current workflow run's stream.
Cross-context Helpers
These helpers span workflow and runtime contexts:
Step-only APIs
These functions must be called inside "use step" functions:
Error Classes
Error classes that can be thrown inside a step to control retry behavior.