workflow-wire-tap: Inspecting the Infinite Loop: Inside Workflow Wire Tap

How a "sidecar" pattern for Vercel Workflows turns the black box of durable execution into a real-time developer workbench.

• View on GitHub • More from vercel-labs

A vintage telephone operator's switchboard where one specific cable is tapped by a glowing fiber-optic line leading to a modern monitor, illustrating the concept of observing a live workflow.
The Wire Tap pattern allows developers to observe live workflow state without interrupting the primary execution.

The Workflow Development Kit (WDK) is an open source TypeScript framework that makes durability a language-level concept. It runs on any framework, platform, and runtime. Functions can pause for minutes or months, survive deployments and crashes, and resume exactly where they stopped.

Pranay Prakash, Dan Fein, Nate Rajlich, Gal Schlezinger, Dan Erickson, Authors, Vercel Blog · Built-in durability: Introducing Workflow Development Kit

Key Takeaways

The Observable Execution

Most developers think of background workflows as "set and forget." You dispatch a job to a queue, and maybe, if you're lucky, you get a webhook when it finishes. But workflow-wire-tap introduces a profound technical surprise: the run.getReadable() pattern. It treats a background process not as a batch job, but as a live broadcast.

By repurposing the classic "Wire Tap" enterprise integration pattern for the streaming era, it turns invisible backend state into a real-time, side-by-side Control Room UI. You can subscribe to a running durable function exactly like you would subscribe to a Twitch stream.

The Streaming Bridge: How data is tapped from a running workflow and streamed to the client.

Breaking the Black Box

The primary tax on modern AI development is the "Black Box" problem. When a durable workflow or an autonomous agent runs for ten minutes and then fails, developers are usually left scrolling through thousands of lines of static, disconnected logs. Traditional console.log fails when a process spans multiple days or serverless invocations.

Portrait of Pranay Prakash

Anatomy of a Tap

The core of the repository is the app/api/readable route. It converts internal workflow events into a standards-compliant Server-Sent Events (SSE) stream for the frontend. Using the Web Streams API, it wraps raw workflow chunks into the required format without buffering.

export async function GET(req: Request, { params }: { params: { runId: string } }) {
  const run = await workflow.getRun(params.runId);
  const stream = await run.getReadable();

  const sseStream = stream.pipeThrough(
    new TransformStream({
      transform(chunk, controller) {
        controller.enqueue(`data: ${JSON.stringify(chunk)}\n\n`);
      },
    })
  );

  return new Response(sseStream, {
    headers: {
      'Content-Type': 'text/event-stream',
      'Cache-Control': 'no-cache',
      'Connection': 'keep-alive',
      'X-Accel-Buffering': 'no',
    },
  });
}

The Developer Workbench

The React UI maps incoming stream events to specific lines of source code. By maintaining a line map on the server and syncing it with the incoming SSE events via an AbortController, it creates a live-tracking IDE experience directly in the browser.

A split visual showing a developer overwhelmed by messy static logs on the left, and a clean, highlighted code pathway on a glass screen on the right.
Static logging versus the live developer workbench experience.

Line-Mapping Sync: How the frontend highlights the exact line of code currently executing.

Lightweight Durability

Compared to heavyweight engines, the Vercel Labs approach operates as a lightweight sidecar. It requires zero infrastructure setup, leaning entirely on Next.js route handlers and the Vercel Workflow DevKit.

FeatureWorkflow Wire-TapTemporalInngest
MechanismSidecar / Middleware TapCentralized OrchestratorEvent-Driven SDK
Setup OverheadZero (Next.js Route)High (Docker/Database)Low (Cloud/Dev Server)
VisibilityReal-time Streaming UIPoll-based Web UIDashboard Aggregation

This pattern is the prerequisite for true agentic workflows. When an AI agent loops autonomously, you don't just need to know if it finished; you need to watch it think.