Dev & EngARTICLE

6 min read

Vercel cuts latency between workflow steps by up to 12x with new engine

Vercel cuts latency between workflow steps by up to 12x with new engine
Image: Carina Ferreira
Article · Dev & Eng
Reading
6 min
Tables
1
Code
1
In short

Workflow SDK version 5.8 swaps out the execution engine, drastically cutting dead time between steps and the cost of parallel fan-outs, right at the backbone of durable AI agents.

Vercel published in its changelog, in late November 2026, the release of workflow@5.8.0, a version of the Workflow SDK that swaps the execution engine for one rebuilt from scratch for performance. According to Vercel itself, p75 latency between one step and the next dropped 12 times, and large fan-outs (the example cited is running 256 steps in parallel) consume 14 times less function time outside the steps' own code. The most direct effect, according to the changelog, shows up in the response time of durable AI agents that depend on turn loops.

For those building with the SDK, the change is opt-in by update, not by manual configuration: workflows already running on a previous version keep running on the old engine until they finish, and only new runs start using the new engine by default. It's a detail that avoids the worst-case scenario of an execution infrastructure upgrade, which is swapping the ground out from under a process already underway.

What the new engine changes under the hood

The performance gain doesn't come from incremental optimization, it comes from a model change: the new engine now executes speculatively steps that are retryable, meaning it starts running the next step before being 100% certain that the previous one has already been confirmed as successfully completed. This is only safe when the step is idempotent, because speculation can, in some cases, lead to a re-execution of the same step.

Vercel sums up the requirement plainly: any step that can be repeated without side effects is already ready to benefit from speculation without any code changes. The example given in the changelog is a charge via Stripe, where the workflow's stepId becomes the idempotencyKey passed to the API:

Expert views

What people are saying about it.

Data Egret, a consultancy, published a set of questions to assess, before running in production, the real risk of an ALTER TABLE, a constraint validation, or a bulk UPDATE in PostgreSQL.

Roberto Dinizin an iMasters article · Read the article: Data Egret checklist helps avoid downtime in PostgreSQL DDL and DML migrations

JetBrains has confirmed that CVE-2026-114938, nicknamed Java4Shell, affects the JBR embedded in all its IDEs as well as the JDK running in production. There's a patch and a workaround, but they are separate fixes.

Bisneto Bragain an iMasters article · Read the article: Java4Shell vulnerability exposes JVM in production: here's how to fix it now
typescript
import { getStepMetadata } from "workflow";

// Idempotent: stepId stays the same across retries and speculative
// re-executions, so Stripe creates a single charge.
async function chargeUser(userId: string, amount: number) {
 "use step";
 const { stepId } = getStepMetadata();
 await stripe.charges.create(
 { amount, currency: "usd", customer: userId },
 { idempotencyKey: stepId },
 );
}

A step that fires off an email via SMTP, on the other hand, has no way to be idempotent, because the protocol offers no deduplication key: running it twice sends two emails. For these cases, the SDK expects the developer to mark the step with maxRetries = 0, explicitly opting out of speculation and guaranteeing at most one execution.

In short: anyone already following the SDK's recommended practice, of making steps idempotent whenever possible and marking sensitive ones with maxRetries = 0, doesn't need to change anything in the code to reap the performance gain. Anyone who wasn't following that discipline risks discovering duplicated side effects only after the upgrade.

The numbers, compared

Vercel published benchmarks comparing three SDK versions: v4.8.18, v5.2.0 (measured on November 12, 2026) and v5.8.0 (measured on November 24, 2026), excluding the simulated work time inside the steps.

Bar charts compare step-to-step overhead, agent loop overhead, and 256 parallel step execution across versions v4.8.18, v5.2.0, and v5.8.0 of the Workflow SDK
Bar charts compare step-to-step overhead, agent loop overhead, and 256 parallel step execution across versions v4.8.18, v5.2.0, and v5.8.0 of the Workflow SDK. Reprodução: vercel.com.
Metricv4.8.18v5.2.0v5.8.0
Step-to-step overhead (p75)997 ms85 ms7 ms
Overhead in agent loop, 5 turns9,745 ms3,023 ms912 ms
Overhead in fan-out of 256 parallel steps11,483 ms13,534 ms2,466 ms
Resume after 1s idle720 ms425 ms184 ms
Function time in fan-out of 256 steps1,381 s1,446 s105 s

Two points stand out in this table. First, the median run, with 102 seconds of real work in the steps, dropped from 3 minutes to 111 seconds between 5.2.0 and 5.8.0, meaning orchestration overhead stopped dominating the execution's total time. Second, the 256-parallel-step fan-out got worse from v4.8.18 to v5.2.0 (from 11.5s to 13.5s of overhead) before improving abruptly in v5.8.0: a reminder that intermediate versions of an evolving SDK don't always improve every metric at the same time.

Resuming, not rebuilding: what changes in cost

For those paying for function time in production, the difference between 1,446 seconds and 105 seconds of function overhead in a 256-step fan-out is the difference between the orchestration engine costing more than the useful work and costing a small fraction of it. It's this number that backs up the "14x lower cost" in the piece's title: it's not a cheaper AI model, it's less function time spent coordinating steps that have already finished.

The resume gain also matters for those using durable streams, the SDK's mechanism for keeping a token stream alive across function invocations. Resuming an execution stopped for 1 second dropped from 425ms to 184ms, a 2.3x improvement. Vercel warns that resumptions more than 5 seconds out may have somewhat higher overhead, and that it's possible to keep functions warm for longer to optimize this resume time, trading that for higher compute cost.

How to migrate without surprises

The upgrade is straightforward in most cases:

  1. Run npm install workflow@latest to get to 5.8.0 or higher.
  2. Review existing steps and confirm that the retryable ones already use some form of idempotency (such as the stepId-as-key pattern).
  3. Mark with maxRetries = 0 any sensitive step that can't be safely repeated, such as sending email or calling systems without deduplication support.
  4. If it's necessary to temporarily keep the previous behavior, set the environment variable WORKFLOW_SPEC_VERSION=8 to keep creating runs on the old engine.

Those coming from 4.x versions need to first follow the upgrade guide to v5, since that's a major release with changes beyond the engine. And there's an important caveat for those using a third-party "World" (the SDK's abstraction for where workflow state is persisted): the improvement only applies if that World already supports "World spec version 9". Worlds maintained by Vercel itself already support it; third-party integrations depend on their own updates, outside the control of a team that only swapped the SDK version.

What remains open

The changelog doesn't detail what happens when speculation gets it wrong, that is, when a speculative step runs and it's later discovered that the previous one actually failed: presumably the speculative result is discarded, but the text doesn't spell out the rollback mechanism nor the cost of a wasted speculation in high-error-rate scenarios. There's also no data on behavior in workflows with steps that do heavy I/O or calls to expensive LLMs, where running one extra speculative step can have non-trivial cost, even if the orchestration itself gets cheaper.

For teams already running durable AI agents on the Workflow SDK, the safest path is to treat this update like any critical runtime change: apply it first in a staging environment, audit the steps that still aren't idempotent, and only then let production traffic migrate to the new engine by default.

Translated from the Brazilian Portuguese original · Read the original