---
title: DurableAgent is now WorkflowAgent
description: "Use AI SDK v7's WorkflowAgent for durable, resumable AI agents."
docs_index: /llms.txt
lastUpdated: 2026-10-13
type: guide
summary: "Build durable, resumable AI agents with AI SDK v7's WorkflowAgent."
---

> For an index of all documentation, see [/llms.txt](/llms.txt).

**Prompt for coding agents**

Convert this stateless AI SDK agent to a durable agent with AI SDK v7's \`WorkflowAgent\`. Install/use \`@ai-sdk/workflow\` and \`workflow\`. Replace the manual \`streamText\` loop with \`new WorkflowAgent(...)\` from \`@ai-sdk/workflow\`, run inside an exported function with \`"use workflow"\`. Mark side-effectful tool \`execute\` functions with \`"use step"\` so they run as durable workflow steps with retries and observability. Stream \`ModelCallStreamPart\` chunks with \`getWritable()\` from \`workflow\`, convert the run stream to UI message chunks with \`createModelCallToUIChunkTransform()\` in the API route, and expose a route that starts or reconnects to the run. If migrating from the deprecated \`DurableAgent\`, follow the migration guide at https\://ai-sdk.dev/v7/docs/agents/workflow-agent#migrating-from-durableagent. Verify tool retries, stream output, and resume/reconnect behavior.

## WorkflowAgent from AI SDK v7

Use AI SDK v7's [`WorkflowAgent`](https://ai-sdk.dev/v7/docs/agents/workflow-agent#workflowagent) for durable agents in Workflow 5. It replaces `DurableAgent` and keeps the current agent pattern in the AI SDK package.

- Import `WorkflowAgent` from `@ai-sdk/workflow` and run it inside a `"use workflow"` function.
- Pass `"spacexai/grok-4.6"` as a plain model string so AI SDK routes requests through Vercel AI Gateway.
- Stream `ModelCallStreamPart` chunks with `getWritable()`, then convert the run stream to UI message chunks with `createModelCallToUIChunkTransform()` in your route.
- Mark tool `execute` functions with `"use step"` when they should run as durable workflow steps with retry and observability behavior.

```typescript
import { WorkflowAgent, type ModelCallStreamPart } from "@ai-sdk/workflow";
import { getWritable } from "workflow";

export async function agentWorkflow(prompt: string) {
  "use workflow";

  const agent = new WorkflowAgent({
    model: "spacexai/grok-4.6",
    instructions: "You are a helpful assistant.",
  });

  return agent.stream({
    messages: [{ role: "user", content: prompt }],
    writable: getWritable<ModelCallStreamPart>(),
  });
}
```

> `DurableAgent` is deprecated and remains documented for existing code only. See the [migration guide](https://ai-sdk.dev/v7/docs/agents/workflow-agent#migrating-from-durableagent), or the [`DurableAgent` API reference](/docs/api-reference/workflow-ai/durable-agent) while migrating.

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)