WDK: Built-in Persistence for Reliable Applications - Vercel
Building Reliable Software Without Mastering Distributed Systems
Developers building AI agents or data pipelines often struggle to make async functions reliable. Traditionally, that has meant setting up message queues, retry logic, and persistence layers — infrastructure that can take more time to implement than the business logic itself.
The Workflow Development Kit (WDK) is an open-source TypeScript framework that elevates durability to a language-level feature.
It works with any framework, platform, or runtime:
Functions can pause for minutes or months, survive deployments and crashes, and resume exactly where they left off.
---
Turning Async Functions into Durable Workflows
WDK introduces two simple directives that automatically handle queues, retries, and persistence:
- `use workflow` marks a function as a durable workflow.
- `use step` marks a unit of work that saves progress and retries automatically on error.
Example: Ride-Hailing Workflow
export async function hailRide(requestId: string) {
"use workflow";
const request = await validateRideRequest(requestId);
const trip = await assignDriver(request);
const confirmation = await notifyRider(trip);
const receipt = await createReceipt(trip);
return receipt;
}In this ride-hailing example:
- Workflow Function coordinates multiple steps.
- Each Step persists automatically, can pause, and resumes across deployments.
Step Functions
async function validateRideRequest(requestId: string) {
"use step";
const response = await fetch(`https://api.example.com/rides/${requestId}`);
if (!response.ok) throw new Error("Ride request validation failed");
const request = await response.json();
return { rider: request.rider, pickup: request.pickup };
}
async function assignDriver(request: any) {
"use step";
// Assign the nearest available driver
}
async function notifyRider(trip: any) {
"use step";
// Notify the rider their driver is on the way
}
async function createReceipt(trip: any) {
"use step";
// Generate a receipt for the trip
}Key Points:
- Each step runs in isolation and retries on error.
- Inputs and outputs are recorded so runs can be deterministically replayed.
- The workflow suspends while a step runs, using no extra resources, then resumes right where it left off.
---
Long-Running Tasks Made Simple
Some workflows need to pause for hours, days, or even weeks — without losing state.
import { sleep } from "workflow";
export async function offerLoyaltyReward(riderId: string) {
"use workflow";
await sleep("3d"); // No resources used during sleep
return { riderId, reward: "Ride Credit" };
}WDK Benefits:
- Works with plain `async` / `await`.
- No YAML, state machines, or orchestration syntax.
- Removes the need for manual message queues or schedulers.
---
Webhooks: Pausing Until External Events Arrive
Workflows often must wait for external data (e.g., payment confirmation, user input).
Webhooks in WDK:
- Create an endpoint that listens for incoming HTTP requests.
- Resume the workflow automatically when data arrives.
- No polling or manual state management required.
Payment Method Validation Example
import { createWebhook, fetch } from "workflow";
export async function validatePaymentMethod(rideId: string) {
"use workflow";
const webhook = createWebhook();
await fetch("https://api.example-payments.com/validate-method", {
method: "POST",
body: JSON.stringify({ rideId, callback: webhook.url }),
});
const { request } = await webhook;
const confirmation = await request.json();
return { rideId, status: confirmation.status };
}---
Reliability, Durability, and Observability by Default
- All workflow events — steps, inputs, outputs, pauses, errors — are logged and accessible.
- Observability is built-in: via API, CLI, and Web UI.
- View runs in real time, trace failures, and analyze performance without extra code.


> Vercel automatically detects durable functions and dynamically provisions optimal infrastructure.
---
Worlds: Run Workflows Anywhere
Worlds in WDK define execution, orchestration, and persistence for a given environment.
Types:
- Local World – Virtual infrastructure for local dev, no queues or DB needed.
- Vercel World – Uses Framework-defined infrastructure (FdI) to configure persistence, queues, and routing.
- Custom Worlds – Deploy to other runtimes or cloud providers.
- Example: Postgres World on GitHub
- Community Worlds include Jazz.
Advantages:
- No vendor lock-in (Open SDKs Philosophy).
- Portable across infrastructures while retaining reliability and observability.
---
Built for Intelligent & Reliable Systems
Systems WDK is ideal for:
- AI agents that need to pause between calls.
- RAG pipelines surviving multi-hour processes.
- Commerce flows waiting for user confirmation for days.
By extending JavaScript with durability semantics, WDK lets you:
- Focus on logic, not infrastructure.
- Write async code that persists across environments.
Reliability becomes a core feature, not an afterthought.
---
Start Building Durable Workflows Today
Write workflows that:
- Persist across deployments.
- Survive crashes.
- Require no additional infrastructure.
---
This rewrite keeps your Markdown valid, adds clear headings, bold emphasis, grouped lists, and preserves all original links and code blocks.
Do you want me to also create a one-page quick-start guide version of this for developers? That would make onboarding even faster.