Vercel Workflow SDK 5.8: Which Steps Are Safe to Run Early?
Vercel cut step-to-step overhead from 85 ms to 7 ms. See how speculative execution works, which steps need a retry policy, and how to roll out the upgrade.
Published

Vercel Workflow SDK 5.8 cut the wait between steps from 85 ms to 7 ms in Vercel’s benchmark. Before upgrading, find the steps that charge a customer, send a receipt, or otherwise change something outside the workflow. Whether the engine can safely start those steps early depends on what happens if it calls them again.
Where the time went in 5.8
A durable workflow records progress so it can resume after an interruption. That bookkeeping shows up in the gap between the last line of one step and the first line of the next. If your agent streams a response, calls tools, and returns to the model, it pays for those handoffs throughout the turn. Here are Vercel’s measurements as of November 2026. November 25 release notes
The fan-out rows answer different questions. A caller waiting for all the branches saw about 2.5 seconds of overhead on 5.8. Across the functions doing that work, the runtime consumed 105 seconds beyond the steps themselves. The latter is the figure to consider when reviewing compute usage. To translate usage into cost on your plan, see Vercel pricing.
For a sense of elapsed time including the work, Vercel’s median long run took 111 seconds on 5.8 and 3.0 minutes on 5.2. Both included 102 seconds of simulated step work. If an external service takes most of your time, that portion remains in your latency budget.
How Vercel measured the gap
Vercel runs the same benchmark app on separate production deployments in iad1, using the managed Vercel World. It warms the deployments before collecting samples. The standard step exchanges 1 KB of JSON in each direction and does 100 ms of simulated work. Vercel excludes simulated work from overhead and pools samples across runs. At p75, three quarters of the samples fall at or below the reported value. The 5.2 step-gap and resume figures date to November 12, 2026. The other release figures date to November 24. Benchmark methodology
The streaming agent benchmark makes that subtraction concrete. Each version ran the loop 15 times with streaming. The simulated model streamed tokens, called two tools in parallel on each of the first four turns, then answered on the fifth. Vercel subtracted 900 ms of model and tool work on the critical path. The remaining 912 ms measures what the runtime added across the loop. A team seeing slow responses can use that distinction to decide whether to investigate model latency or the orchestration around its tools.
How a step starts before its record is durable
With speculative execution, the engine can begin an eligible step while the write recording its start is still in flight. On the Node.js engine, when nothing else can change the workflow’s next decision, the orchestrator can also pass an inline step’s result back to the workflow while its outcome is being saved. The writes still commit in order. Overlapping the work with those writes removes waits between steps. Runtime tuning
That overlap matters if the step reaches a payment service and the worker then loses confirmation. The payment may have succeeded. Another attempt must leave the customer with the same charge. This property is idempotency, and the receiving service has a part in it.
chargeUser sends the payment request with its stepId.
The response is lost. The step retries with the same stepId.
Stripe creates the charge under that idempotency key.
Stripe recognizes the key. The customer has one charge.
Keep a keyed payment retryable
In Vercel’s payment example, getStepMetadata() supplies an ID unique to this step invocation. It stays stable across retries and speculative re-execution. Pass it to the configured Stripe client as a request option, where Stripe can use it to deduplicate the charge. Step idempotency
import { getStepMetadata } from "workflow";
async function chargeUser(userId: string, amount: number) {
"use step";
const { stepId } = getStepMetadata();
await stripe.charges.create(
{ customer: userId, amount, currency: "usd" },
{ idempotencyKey: stepId },
);
}An existing step that already does this can keep its retry policy. The key protects attempts at that particular step. If duplicate checkout requests can start separate workflow runs for the same order, address duplicate starts separately. Each run can reach its own valid payment step.
Give an unkeyed receipt one attempt
Vercel’s other example sends a receipt through SMTP. A mail server can accept the message before the sender gets confirmation, and SMTP has no idempotency key to pass back on another attempt. Set the retry policy on the step function itself. The snippet assumes your mail client is configured. Errors and retries
async function sendReceiptEmail(to: string, orderId: string) {
"use step";
await smtp.sendMail({ to, subject: `Your receipt for order ${orderId}` });
}
sendReceiptEmail.maxRetries = 0;With zero retries the engine waits for the start to be recorded and runs the step at most once. If the attempt fails, the SDK leaves recovery of that send to you. If the outcome is ambiguous, check the mail provider’s record before resending.
Audit the steps before switching engines
- Find each
"use step"that writes outside the workflow. For an agent, follow each tool call down to the API or database operation it actually performs. The production agent guardrails playbook shows where to put that check. - Ask what a customer would see if the external write succeeded and its response vanished. Trace every side effect in the step. A keyed charge and an unkeyed receipt in the same function still leave the receipt exposed.
- Where the receiver supports deduplication, verify that every attempt sends the same key for the same operation. Where a duplicate would be harmful and you cannot make the operation idempotent, isolate it in a step with
maxRetries = 0and decide who can reconcile a failure. - Keep retryable work eligible where it is safe. In Vercel’s agent benchmark, making a model step wait for its start record with
maxRetries = 0added about 70 ms per turn on 5.8.0. Agent benchmark
Upgrade without stranding active runs
For an application already on 5.2, install workflow@5.8.0 or later and deploy it. To install the release Vercel benchmarked, use the command below. If you are on 4.x, start with the major-version migration guide.
npm install workflow@5.8.0A World is the backend that provides the workflow’s queue and durable storage. Vercel’s maintained Worlds support the new engine. For a third-party World, check support for World spec version 9 before expecting the release’s gains. World implementation guide
As of Nov 27, 2026 · Source: Vercel Workflow changelog and runtime tuning guide
If several deployments or worker processes share a World, set WORKFLOW_SPEC_VERSION=8 on the upgraded processes while you bring them all to 5.8.0 or later. Once they are ready and your steps are safe, remove the pin to enable the new engine for new runs. You can keep the pin if you need longer. Once spec 9 or later runs exist, keep the upgraded SDK in place because older releases fail writes to those runs. Spec version settings
One setting deserves a separate decision for approval workflows. Vercel’s 184 ms resume figure followed a one-second pause. A hook resumed after more than five seconds may incur more overhead. If fast resumption matters, WORKFLOW_ORCHESTRATOR_HOOK_LINGER_MS controls how long the idle orchestrator stays live for open hooks, capped by WORKFLOW_ORCHESTRATOR_LINGER_MS. A longer window spends more compute waiting for a reply. Hook linger settings
Choosing an AI gateway for coding agents
If model calls dominate the turn after the workflow upgrade, compare the gateways that route those calls.
- Published
- Category
- Build







