Your AI agent works perfectly in the demo. It crashes on the third tool call in production. You restart it, it starts over from zero, and the user is gone. This is the dominant failure mode for TypeScript AI agents in 2026 — and it is exactly what Vercel addressed when it shipped AI SDK 7 on June 25. The headline feature is WorkflowAgent: a durable execution primitive that checkpoints state before every tool call and resumes from that checkpoint after a crash, a redeploy, or a human approval that comes in three hours later. That alone makes SDK 7 worth evaluating. But five other changes make it worth the upgrade for TypeScript teams already on the platform.
WorkflowAgent: When Your Agent Survives the Deploy #
Every tool call in a WorkflowAgent
becomes a durable step inside a Vercel Workflow. Before execution, state is written to a configurable store. If the process terminates — scheduled deploy, crash, OOM kill — the agent restores from that checkpoint and continues. Not from the beginning. From exactly where it stopped.
The human approval flow benefits from the same durability. Mark a tool with needsApproval: true
and the agent s and waits. The user can approve four hours later on a different device. Because the workflow step is durable, the approval survives any number of restarts between the and the resume.
import { WorkflowAgent } from "@ai-sdk/workflow";
import { anthropic } from "@ai-sdk/anthropic";
const agent = new WorkflowAgent({
model: anthropic("claude-sonnet-5"),
tools: {
sendEmail: {
description: "Send an email on behalf of the user",
parameters: z.object({ to: z.string(), subject: z.string(), body: z.string() }),
needsApproval: true, // s; waits for human confirmation
execute: async ({ to, subject, body }) => sendEmail({ to, subject, body }),
},
},
});
The catch — and it is a real one — is platform dependency. WorkflowAgent runs inside Vercel Workflows. If your agents live on AWS Lambda, Cloudflare Workers, or a bare server, this primitive does not help you without rearchitecting your deployment. That is not a reason to avoid SDK 7, but it is a reason to read the fine print before upgrading.
Typed Tool Context: The Daily DX Win #
WorkflowAgent gets the attention, but typed tool context is what your team will thank you for every day. In SDK 6 and earlier, passing request-scoped values — a user ID, an organization ID, an auth token — into tool execution meant casting through any
or polluting tool signatures with optional parameters. SDK 7 solves this cleanly.
Each tool defines a contextSchema
. The caller injects a matching typed object at runtime. TypeScript enforces the shape. Your IDE autocompletes on it.
const auditTool = createTool({
contextSchema: z.object({ userId: z.string(), orgId: z.string() }),
parameters: z.object({ action: z.string(), resourceId: z.string() }),
execute: async ({ action, resourceId }, { context }) => {
// context.userId is typed — no cast, no runtime surprise
await audit({ userId: context.userId, action, resourceId });
},
});
// At the call site:
agent.run({ toolsContext: { userId: req.user.id, orgId: req.user.orgId } });
This is the change that eliminates an entire category of production bugs: the ones where a tool silently received undefined
for a context value and either produced wrong results or threw at runtime instead of at compile time.
Timeout Controls: Stop Guessing, Start Budgeting #
LLM latency is not stable. The same model on the same prompt can take 2 seconds or 22 seconds depending on load, token count, and tooling overhead. Without explicit timeout controls, a slow tool call hangs your entire agent indefinitely. SDK 7 introduces a layered timeout budget.
const result = await generateText({
model: anthropic("claude-sonnet-5"),
prompt: userInput,
timeout: {
total: 120_000, // entire call: 2 minutes hard cap
perStep: 30_000, // each LLM step: 30 seconds
perChunk: 5_000, // streaming: fail if no chunk in 5s
defaultTool: 10_000, // default for all tools
tools: { slowApiTool: 60_000 }, // override for specific tools
},
});
Timeout violations throw TimeoutError
with an abort reason that flows through the streaming and UI protocols. You can catch it and respond gracefully, rather than having your UI hang until a CDN timeout kills the connection for you.
Telemetry: Register Once, Observe Everything #
The previous telemetry pattern required instrumenting each generateText
call individually — tedious, easy to miss, inconsistent. SDK 7 replaces this with a single registerOtelProvider()
call that instruments all subsequent AI SDK calls automatically. The @ai-sdk/otel package handles the OpenTelemetry trace export; Node.js tracing channels offer a lighter-weight alternative for teams not running a full OTel stack.
Lifecycle callbacks give you structured hooks: onStepStart
, onStepFinish
, onToolCall
, onToolResult
. Step performance statistics are built in. You can now answer “which tool call is slowing my agent down” without building custom instrumentation.
The Migration Reality #
SDK 7 requires Node.js 22. That is the hardest part of the upgrade for teams still on Node.js 20 LTS. Everything else — the code changes — is handled by npx @ai-sdk/codemod v7
, which migrates message types, streaming protocol changes, and removed APIs automatically. The full list of breaking changes is in the official migration guide.
For teams using Cloudflare Agents SDK alongside Vercel AI SDK: as of July 23, Cloudflare packages now support both ai@^6 and ai@^7. You can upgrade Cloudflare packages independently of the AI SDK version, or migrate both at once. No forced coupling.
Who Should Upgrade Now #
Upgrade now if you are on Node.js 22, deploying to Vercel, and building agents that either run long enough to crash or need human approval flows. The WorkflowAgent durability and typed tool context will pay back the migration cost immediately.
Wait if you are on Node.js 18 or 20 and cannot upgrade infrastructure yet. Wait also if your agents run on Cloudflare Workers or AWS Lambda and you need platform-portable durability — WorkflowAgent is not the answer there. For those cases, plan the upgrade as a project, not a weekend sprint.
Either way, AI SDK 7 is where Vercel agent platform is going. The WorkflowAgent documentation is thorough and the codemod reduces friction significantly. If production reliability has been the gap between your AI demos and what you ship, this is the upgrade that closes it.