Pranay Prakash 08318f6da0 perf(core): arm one queue-owned backstop per replay pass and gate it on ownership-stamping runs
Review follow-ups on #4100:

- The queue-owned row no longer sends a backstop per running step per
  replay. The dispatch pass folds every queue-owned running step into ONE
  delayed run continuation, due when the latest bare start's lease expires
  and keyed `${runId}:queue-backstop:${latestStartedAt}`. The invocation
  remembers the epochs it armed and skips the send on later passes over an
  unchanged log, so three replay passes over one running step (or one pass
  over N running steps) cost a single publish; concurrent invocations
  collapse onto one pending wake server-side via the shared key. A coarser
  bucket key would either be deduped against an in-flight wake that fires
  before a newer step's lease expires, or need a delay past the queue's
  per-message cap, so the epoch is the key. A wake on a finished run is the
  ordinary already-terminal exit.
- `isQueueOwnedRunning` additionally requires the run's specVersion to be
  at or above SPEC_VERSION_SUPPORTS_SLOT_IDENTITY (6), the first spec
  version every ownership-stamping runtime mints (#2848 shipped under spec
  5). A bare start on an older or unknown run is not proof of a queue
  delivery, since the replay contract tolerates a legacy unstamped inline
  start, so such runs keep the immediate re-enqueue.
- `workflow.queue_ownership.backstop_wakes_armed` is now 0/1 per pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 13:51:14 -07: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
2025-10-23 12:07:52 +03: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%