vercel[bot] 1a68b6af41 Take the ws events transport only once its handshake is done
resolveWsTransport treated map membership as 'writable'. A write landing
between openWsChannel and the socket opening therefore resolved the
transport and awaited the in-flight connect, so the first write of a run
paid the whole handshake.

Measured on one WS-enabled deployment over 7 days, run_started:

  ws    p50 269ms   p95 3771ms   (n=295)
  http  p50  79ms   p95  134ms   (n=182)

against ~65ms p50 for every write issued after the socket was up. Going
over the socket made that write slower than not using the socket at all,
and the 34% of run_started writes already falling back were taking the
faster path by accident.

Membership still answers 'does this run have a channel' - the refcount
and sharing across concurrent invocations are unchanged. The write path
now additionally asks whether a frame can go out without setup first. A
reconnect reads as not-ready for the same reason.

This widens the HTTP fallback window on purpose: from 'until the dynamic
import resolves' to 'until the socket is open'. What it buys is that no
write ever blocks on a handshake.

Co-Authored-By: opencode <opencode@vercel.com>

Co-Authored-By: shalabhc <shalabh.chaturvedi@vercel.com>
2026-08-24 20:29:58 +00:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2026-02-05 16:19:16 -08:00
2025-10-23 12:07:52 +03:00
2026-08-14 16:56:05 -04:00
2025-10-23 12:07:52 +03:00

Workflow SDK logo

Workflow SDK

Vercel logo npm version License Join the community on GitHub

Workflow SDK makes TypeScript and JavaScript functions durable. It persists workflow progress, retries failed steps, and provides built-in observability. Workflows can suspend without using compute while they wait.

Quick start

Install the SDK in an existing project:

npm install workflow

Configure the integration for your framework. For example, with Next.js:

// next.config.ts
import { withWorkflow } from 'workflow/next';

export default withWorkflow({});

Then start a workflow from an API route, Server Action, or other server-side code:

import { start } from 'workflow/api';
import { onboardUser } from './workflows/onboard-user';

await start(onboardUser, ['hello@example.com']);

Run your app, then open the local observability UI in another terminal:

npm run dev
npx workflow web

Choose your framework in the getting-started guides.

Note

The workflow package includes its full documentation, so coding agents can read version-matched guides locally from node_modules/workflow/docs.

Run anywhere

Local development uses the bundled backend with no configuration. Deploy to Vercel for managed storage, queuing, scaling, and observability. To self-host, use the Postgres backend or implement a custom World.

The Worlds page lists maintainer-curated third-party Worlds, including self-hosted and managed options. Submit your World by updating the Worlds Manifest.

Community

The Workflow SDK community lives on GitHub Discussions, where you can ask questions, share ideas, and show what you have built.

Contributing

Contributions are welcome. Use issues and discussions to collaborate with the team and wider community. By participating, you agree to our Code of Conduct.

Security

If you find a security vulnerability in Workflow SDK, disclose it responsibly instead of opening a public issue.

To participate in our Open Source Software Bug Bounty program, please email responsible.disclosure@vercel.com. We will add you to the program and provide further instructions for submitting your report.

S
Description
workflow: Creates durable, resumable workflows using Vercel's Workflow SDK. Use when building workflows that need to survive restarts, pause for external events, retry…; workflow-init: Install and configure Vercel Workflow SDK before it exists in node_modules. Use when the user asks to "install workflow", "set up workflow", "add durable…
Readme 140 MiB
Languages
TypeScript 88.8%
JavaScript 5.9%
Rust 4%
CSS 0.5%
Python 0.4%
Other 0.3%