Web Dev

Workflow SDK 5: End-to-End Encryption and Regional Deployment

Vercel's Workflow SDK 5 adds end-to-end encryption for sensitive data, deploys infrastructure to every region, and achieves up to 25× performance gains for AI workloads.

4 min readSource: Vercel Blog

Curated by Kandala Guruprasad. Drafted with AI and checked against the source.

Workflow SDK 5: End-to-End Encryption and Regional Deployment

TL;DR

  • Workflow SDK 5 encrypts all payloads end-to-end with AES-256-GCM before leaving your code, with zero configuration on Vercel and key management options for self-hosted deployments
  • Workflow infrastructure now spans every Vercel Function region, allowing runs to execute in the region where they started without cross-region requests on the hot path
  • Performance improvements reach 1.6× to 25× across benchmarks through fewer queue hops, incremental replay optimization, and WebSocket streaming for agent responses
Release
Workflow SDK 5
Encryption
AES-256-GCM, end-to-end
Performance Gain
Up to 25× improvement

What happened

Vercel released Workflow SDK 5, a major update to its durable workflow runtime. The SDK allows developers to write regular async JavaScript that survives crashes, deployments, and long-running operations. Since launch, customers have run over 4 billion workflow steps and 700 million runs, creating two dominant patterns: traditional automation workflows for data processing, orders, and ETL pipelines, and AI agents and harnesses that require durability for long-running operations. Version 5 focuses on three pillars: security, reliability, and performance.

End-to-end encryption without configuration

Workflow SDK 5 encrypts every payload before it leaves your code using AES-256-GCM encryption with a unique key for each run. This protects sensitive customer data, model context, credentials, and tool-call results stored in the workflow event log. The encryption happens automatically—Vercel and the SDK backend see only ciphertext, and plaintext is decrypted only inside your deployment or authorized observability tools.

On Vercel, encryption requires no setup and no code changes. Each run's encryption key is derived from a deployment-scoped key, so a run can only decrypt its own data. Observability tools remain functional: names, timings, and statuses are always visible, and when you need to see a payload, you can decrypt it in the dashboard or CLI. Decryption happens in your browser or terminal, follows the same permissions as the project's environment variables, and every request is logged in your team's audit log.

For self-hosted deployments using a custom World, you implement getEncryptionKeyForRun() with your own key management. You provide a stable 32-byte key for each run so the SDK can encrypt new payloads and decrypt them during replay. Cross-run writes are also sealed: when code resumes another run's hook or writes to a stream from another run, the payload is encrypted to the target run's public key without reading the target's existing data.

An optional retention setting lets you limit how long sensitive data is stored. Setting experimental_retention to 0 deletes inputs, outputs, and stream contents as soon as a run completes or fails, while keeping the run's metadata visible in observability.

Regional deployment and infrastructure reliability

In Workflow SDK 4, all runs lived in a single region (iad1), forcing cross-region requests whenever a step ran elsewhere. Version 5 deployed Workflow infrastructure to every Vercel Function region. Each run now has its own home region: its state, queue dispatch, and streams are served from the region where the run started, eliminating cross-region round trips on the hot path.

By default, a run starts in the region of the function that initiates it. If you deploy to multiple regions, each run stays close to the user who triggered it with no configuration required. You can also pass a region parameter to start() to place a run in a specific region—useful for keeping a workflow next to the database it reads and writes, or meeting data residency requirements. Existing Workflow SDK 4 runs remain in iad1.

Regional isolation improves reliability. A disruption in one region no longer blocks new runs in healthy regions. For projects with Vercel Function failover configured, steps can execute in a fallback region while the run's state remains pinned to its original home region and does not migrate during failover. Working with customer telemetry, the team found and fixed dozens of rare bugs and race conditions. As a result, almost no runs fail or stall because of a platform or runtime bug.

ts
const run = await start(
  processOrder,
  [ order ],
  { region: "fra1" }
);

Agent-focused performance optimization

Workflow SDK 5 achieved 1.6× to 25× latency improvements across measured workloads, making it suitable for AI agents that execute thousands of sequential events, high-throughput token streams, and dynamic tool chains. In Workflow SDK 4, every step involved two queue hops—one to start and one to continue—adding unacceptable latency for AI workloads. The engine was rewritten to minimize queue hops, networking, and CPU overhead while preserving the developer experience.

The runtime now executes several steps inline before yielding for a wait, hook, or timeout. Unnecessary persistence round trips are avoided, and step creation is folded into execution. In a five-step benchmark, the p75 step-to-step overhead fell from 618 ms to 109 ms. On a 1,020-step benchmark, v4's p75 overhead reached 1,748 ms and grew with the event log size; v5 achieves 70 ms overhead with the median time to finish all steps dropping from 21.0 minutes to 3.0 minutes through incremental replay optimization.

For streamed responses, the SDK now writes streams over WebSockets by default on the Vercel World. In a benchmark replaying a 52.4-second agent response, median delivery dropped from 226.1 seconds to 53.5 seconds. Payload compression reduces stored and transferred data; AI token streams average around 80% smaller after compression.

Trace viewer and run observability

The redesigned trace viewer makes runs easier to navigate with span search, zoom, a minimap, and local inspection during development. Run attributes are new in v5, allowing you to attach searchable context to a run—such as an order ID—and then find runs by that attribute. Attributes are stored plaintext and should not contain secrets.

Source

Vercel Bloghttps://vercel.com/blog/workflow-sdk-5

AI-assisted, verified against the source. This post was drafted with AI from the primary source linked above and checked automatically against it. For anything you depend on, read the original.

  • #vercel
  • #workflowsdk
  • #durability
  • #encryption
  • #performance

More in Web Dev