VercelSlashWorkflow DevKit LogoWorkflow
  • Docs
  • Examples
GitHub
  • Next.js
  • Vite
  • Express
  • Hono
  • Nitro
  • Nuxt
  • SvelteKit
  • Workflows and Steps
  • Starting Workflows
  • Control Flow Patterns
  • Errors & Retrying
  • Hooks & Webhooks
  • Streaming
  • Serialization
  • Idempotency
Observability
API Reference

workflow

Core workflow primitives including steps, context management, streaming, webhooks, and error handling.

Installation

npm i workflow

Functions

Workflow DevKit contains the following functions you can use inside your workflow functions:

getWorkflowMetadata()

A function that returns context about the current workflow execution.

getStepMetadata()

A function that returns context about the current step execution.

sleep()

Sleeping workflows for a specified duration. Deterministic and replay-safe.

fetch()

Make HTTP requests from within a workflow with automatic retry semantics.

createHook()

Create a low-level hook to receive arbitrary payloads from external systems.

defineHook()

Type-safe hook helper for consistent payload types.

createWebhook()

Create a webhook that suspends the workflow until an HTTP request is received.

getWritable()

Access the current workflow run's default stream.

Error Classes

Workflow DevKit includes error classes that can be thrown in a workflow or step to change the error exit strategy of a workflow.

FatalError()

When thrown, marks a step as failed and the step is not retried.

RetryableError()

When thrown, marks a step as retryable with an optional parameter.

API Reference

Previous Page

createHook

Next Page

On this page

Installation
Functions
Error Classes
GitHubEdit this page on GitHub