Peter Wielander fd621b1167 perf(core): ship build-time V8 code cache for workflow bundles
On a cold serverless instance the first replay parses the entire workflow
bundle before it can reach the first step. The in-process vm.Script cache
(#2471) only helps subsequent replays in the same process; the cold first
one still pays a full parse, which grows ~30ms/MB and dominates
time-to-first-step for large bundles.

Producer (builders/next): for bundles over a size threshold, compile the
bundle at build time and emit Script.createCachedData() as base64 in the
generated flow route, passed via workflowEntrypoint's cachedData option.
Skipped for small bundles (parse is ~1ms; the blob would just bloat the
artifact) and via WORKFLOW_DISABLE_BUNDLE_CODE_CACHE.

Consumer (core): getCachedWorkflowScript compiles with the cachedData so
V8 skips parsing on the first compile. The blob is filename-independent so
one build-time cache serves every per-workflow filename; V8 validates it
and falls back to a full parse on any version/source mismatch, so a stale
blob is never a correctness risk.

Measured fresh-process parse: 2MB 34->4.8ms, 8MB 147->21ms (~7x).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:28:01 -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
2026-02-05 16:19:16 -08:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-11-29 21:21:49 -08:00

Workflow SDK logo

Workflow SDK

Vercel logo NPM version License Join the community on GitHub

Getting Started

The Workflow SDK lets you easily add durability, reliability, and observability to async JavaScript. Build apps and AI agents that can suspend, resume, and maintain state with ease.

Visit https://workflow-sdk.dev to view the full documentation.

Community

The Workflow SDK community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects with other people.

Contributing

Contributions to Workflow SDK are welcome and highly appreciated. Please use GitHub issues and discussions to collaborate with the team and wider community.

Author list

Workflow SDK was built by engineers at Vercel and the Open Source Community.

The initial core contributing engineers are:

The Workflow SDK logo was designed by Cecilio Ruiz @ceciliorz


Security

If you believe you have found a security vulnerability in Workflow SDK, we encourage you to responsibly disclose this and not open 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%