Building durable Agents with Workflow DevKit & AI SDK - Peter Wielander, Vercel
TL;DR
Peter Wielander demonstrates how Vercel's open-source Workflow DevKit transforms local AI agents into production-grade systems by wrapping AI SDK code in durable, retryable workflows with minimal refactoring, enabling automatic observability and resumable streams without managing queues or databases.
🏗️ Workflow Pattern & Architecture 3 insights
Eliminating production boilerplate
The workflow pattern removes the need to manually wire up queues, databases, and error handling for long-running agents by providing a deterministic orchestration layer that persists state and retries failed steps automatically.
Deterministic step isolation
The `use workflow` directive compiles agent loops into isolated bundles that separate LLM calls and tool executions into discrete, replayable steps with cached inputs and outputs.
Serverless durability
Each marked step runs in an isolated serverless instance, allowing agents to execute for hours or days across multiple invocations without losing context or state.
🛠️ Implementation & Migration 3 insights
Minimal code changes required
Migrate existing AI SDK agents by simply adding the `use workflow` directive to the orchestration function and wrapping tool executions with `use step`, or use the pre-built `DurableAgent` class to handle LLM calls automatically.
Framework integration
The kit provides Next.js helpers (`withWorkflow`) and TypeScript compiler plugins that maintain deterministic execution while preserving compatibility with existing frontends and any cloud provider.
Stream persistence
The `getWritable` API creates durable streams that exist independently of the API handler lifecycle, allowing tools to write data packets that persist even if the client disconnects.
✨ Production Features & Observability 3 insights
Built-in local debugging
Running `npx workflow web` launches a local observability UI that visualizes every workflow run, step execution, input/output data, and associated events without additional instrumentation.
Resumable client sessions
Streams remain active on the backend even after client disconnections, enabling users to reconnect and resume exactly where the agent left off, critical for long-running coding or research tasks.
Human-in-the-loop support
The framework supports suspending workflows at any step to await human approval via webhooks or manual resume commands, making it easy to implement safety checks for production agents.
Bottom Line
Add Workflow DevKit to your AI SDK projects using simple `use workflow` and `use step` directives to automatically gain production durability, resumable streams, and step-by-step observability without rewriting agent logic or managing infrastructure.
More from AI Engineer
View all
How METR measures Long Tasks and Experienced Open Source Dev Productivity - Joel Becker, METR
Joel Becker from METR argues that slowing compute growth would proportionally delay AI capabilities milestones measured by task time horizons, while presenting findings that experienced open-source developers showed minimal productivity gains from AI coding assistants like Cursor, challenging optimistic adoption curves.
Identity for AI Agents - Patrick Riley & Carlos Galan, Auth0
Auth0/Okta leaders Patrick Riley and Carlos Galan unveil new AI identity infrastructure including Token Vault for secure credential management and Async OAuth for human approvals, presenting a four-pillar framework to authenticate users and authorize autonomous agent actions across enterprise applications.
OpenAI + @Temporalio : Building Durable, Production Ready Agents - Cornelia Davis, Temporal
Cornelia Davis from Temporal demonstrates how integrating OpenAI's Agents SDK with Temporal's distributed systems platform creates production-ready AI agents that automatically handle crashes, retries, and state persistence without developers writing complex resilience code.
Your MCP Server is Bad (and you should feel bad) - Jeremiah Lowin, Prefect
Jeremiah Lowin argues that most MCP servers fail because developers treat them like REST APIs for humans rather than curated interfaces optimized for AI agents' specific constraints around discovery cost, iteration speed, and limited context windows.