workflow 5.0.0-beta.11 → 5.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -345,29 +345,19 @@ export async function batchProcessingWorkflow(items: string[]) {
345
345
  }
346
346
  ```
347
347
 
348
- ### Streaming AI Responses with `DurableAgent`
348
+ ### Streaming AI Responses with `WorkflowAgent`
349
349
 
350
- Stream AI-generated content using [`DurableAgent`](/docs/api-reference/workflow-ai/durable-agent) from `@workflow/ai`. Tools can also emit progress updates to the same stream using [data chunks](https://ai-sdk.dev/docs/ai-sdk-ui/streaming-data#streaming-custom-data) with the [`UIMessageChunk`](https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol) type from the AI SDK:
350
+ Stream AI-generated content using AI SDK's [`WorkflowAgent`](https://ai-sdk.dev/v7/docs/agents/workflow-agent#workflowagent) from `@ai-sdk/workflow`. The agent writes `ModelCallStreamPart` chunks to the workflow stream, and route handlers convert them to UI message chunks with `createModelCallToUIChunkTransform()` before returning the response:
351
351
 
352
352
  ```typescript title="workflows/ai-assistant.ts" lineNumbers
353
- import { DurableAgent } from "@workflow/ai/agent";
353
+ import { WorkflowAgent, type ModelCallStreamPart } from "@ai-sdk/workflow";
354
+ import { tool } from "ai";
354
355
  import { getWritable } from "workflow";
355
356
  import { z } from "zod";
356
- import type { UIMessageChunk } from "ai";
357
357
 
358
358
  async function searchFlights({ query }: { query: string }) {
359
359
  "use step";
360
360
 
361
- // Tools can emit progress updates to the stream
362
- const writable = getWritable<UIMessageChunk>(); // [!code highlight]
363
- const writer = writable.getWriter(); // [!code highlight]
364
- await writer.write({ // [!code highlight]
365
- type: "data-progress", // [!code highlight]
366
- data: { message: `Searching flights for ${query}...` }, // [!code highlight]
367
- transient: true, // [!code highlight]
368
- }); // [!code highlight]
369
- writer.releaseLock(); // [!code highlight]
370
-
371
361
  // ... search logic ...
372
362
  return { flights: [/* results */] };
373
363
  }
@@ -375,27 +365,28 @@ async function searchFlights({ query }: { query: string }) {
375
365
  export async function aiAssistantWorkflow(userMessage: string) {
376
366
  "use workflow";
377
367
 
378
- const agent = new DurableAgent({
368
+ const agent = new WorkflowAgent({
379
369
  model: "anthropic/claude-haiku-4.5",
380
- system: "You are a helpful flight assistant.",
370
+ instructions: "You are a helpful flight assistant.",
381
371
  tools: {
382
- searchFlights: {
372
+ searchFlights: tool({
383
373
  description: "Search for flights",
384
374
  inputSchema: z.object({ query: z.string() }),
385
375
  execute: searchFlights,
386
- },
376
+ }),
387
377
  },
388
378
  });
389
379
 
390
380
  // LLM response will be streamed to the run's writable
391
381
  await agent.stream({
392
382
  messages: [{ role: "user", content: userMessage }],
393
- writable: getWritable<UIMessageChunk>(), // [!code highlight]
383
+ writable: getWritable<ModelCallStreamPart>(), // [!code highlight]
394
384
  });
395
385
  }
396
386
  ```
397
387
 
398
388
  ```typescript title="app/api/ai-assistant/route.ts" lineNumbers
389
+ import { createModelCallToUIChunkTransform } from "@ai-sdk/workflow";
399
390
  import { createUIMessageStreamResponse } from "ai";
400
391
  import { start } from "workflow/api";
401
392
  import { aiAssistantWorkflow } from "./workflows/ai";
@@ -406,13 +397,13 @@ export async function POST(request: Request) {
406
397
  const run = await start(aiAssistantWorkflow, [message]);
407
398
 
408
399
  return createUIMessageStreamResponse({
409
- stream: run.readable,
400
+ stream: run.readable.pipeThrough(createModelCallToUIChunkTransform()), // [!code highlight]
410
401
  });
411
402
  }
412
403
  ```
413
404
 
414
405
  <Callout type="info">
415
- For a complete implementation, see the [flight booking example](https://github.com/vercel/workflow-examples/tree/main/flight-booking-app) which demonstrates streaming AI responses with tool progress updates.
406
+ For the full agent API and migration notes, see the [`WorkflowAgent` documentation](https://ai-sdk.dev/v7/docs/agents/workflow-agent#workflowagent).
416
407
  </Callout>
417
408
 
418
409
  ### Streaming Between Steps
@@ -594,7 +585,7 @@ Stream errors don't trigger automatic retries for the producer step. Design your
594
585
  - [`start()` API Reference](/docs/api-reference/workflow-api/start) - Start workflows and access the `Run` object
595
586
  - [`getRun()` API Reference](/docs/api-reference/workflow-api/get-run) - Retrieve runs and their streams later
596
587
  - [world.streams](/docs/api-reference/workflow-api/world/streams) - Low-level stream read/write/close via World SDK
597
- - [DurableAgent](/docs/api-reference/workflow-ai/durable-agent) - AI agents with built-in streaming support
588
+ - [WorkflowAgent](https://ai-sdk.dev/v7/docs/agents/workflow-agent#workflowagent) - AI agents with durable, resumable streaming support
598
589
  - [Errors and Retries](/docs/foundations/errors-and-retries) - Understanding error handling and retry behavior
599
590
  - [Serialization](/docs/foundations/serialization) - Understanding what data types can be passed in workflows
600
591
  - [Workflows and Steps](/docs/foundations/workflows-and-steps) - Core concepts of workflow execution
@@ -16,4 +16,6 @@ This page is only visible on preview deployments and local development. It does
16
16
 
17
17
  Changelog entries staged here for review before publishing to the Vercel website.
18
18
 
19
+ - [Local web UI in Nitro dev](/docs/internal/nitro-web-ui) — unreleased (next beta)
20
+ - [Native Nitro v3 bundling for workflows](/docs/internal/nitro-native-build) — May 22, 2026
19
21
  - [Serializable AbortController and AbortSignal](/docs/internal/serializable-abort-controller) — March 12, 2026
@@ -1,5 +1,10 @@
1
1
  {
2
2
  "title": "Internal",
3
- "pages": ["index", "serializable-abort-controller"],
3
+ "pages": [
4
+ "index",
5
+ "nitro-web-ui",
6
+ "nitro-native-build",
7
+ "serializable-abort-controller"
8
+ ],
4
9
  "defaultOpen": false
5
10
  }
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: Native Nitro v3 bundling for workflows
3
+ description: Workflow routes are now bundled by Nitro v3, so steps run in your app's runtime and can call any server-side Nitro API.
4
+ type: overview
5
+ ---
6
+
7
+ # Native Nitro v3 bundling for workflows
8
+
9
+ <span className="text-sm text-fd-muted-foreground">May 22, 2026</span>
10
+
11
+ Workflow routes are now handled as Nitro v3 handlers and bundled by Nitro, rather than built separately for the Vercel Build Output API. Your workflows are part of the same bundle as the rest of your app.
12
+
13
+ ## What's new
14
+
15
+ - **Call any server-side Nitro API from a step.** Workflow steps now run inside the same bundled runtime as the rest of your Nitro app, so you can call `useStorage()`, `useDatabase()`, `useRuntimeConfig()`, virtual imports, and any other server-side Nitro API directly from a `"use step"` function.
16
+ - **Workflows are part of your Nitro bundle.** Workflow routes are bundled by Nitro alongside your application code, instead of being built into a separate output. There's nothing extra to configure.
17
+ - **Minimal runtime output.** During bundling, Nitro automatically traces native dependencies and tree-shakes unused code to produce a minimal runtime output.
18
+ - **Nitro v2 is unchanged.** This applies to Nitro v3. Apps on Nitro v2 keep their existing behavior.
19
+
20
+ ## Using Nitro APIs from a step
21
+
22
+ Because steps run inside your Nitro runtime, server-side utilities work directly inside a `"use step"` function:
23
+
24
+ ```typescript
25
+ export async function cacheResult(key: string, value: string) {
26
+ "use step";
27
+
28
+ const storage = useStorage("cache");
29
+ await storage.setItem(key, value);
30
+
31
+ return { cached: true };
32
+ }
33
+ ```
34
+
35
+ ## Learn more
36
+
37
+ - [Nitro](/docs/getting-started/nitro) — Set up Workflow SDK in a Nitro v3 app
38
+ - [Deploying](/docs/deploying) — How workflow bundles are deployed
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: Local web UI in Nitro dev
3
+ description: Inspect, monitor, and debug your workflow runs from the /_workflow route during Nitro development.
4
+ type: overview
5
+ ---
6
+
7
+ # Local web UI in Nitro dev
8
+
9
+ {/* TODO: unreleased — changeset .changeset/nitro-dashboard-route.md is pending; ships in the next @workflow/nitro beta (5.0.0-beta.12). Update this date on publish. */}
10
+ <span className="text-sm text-fd-muted-foreground">June 2, 2026</span>
11
+
12
+ The Workflow SDK web UI is now built into the Nitro dev server. During development, open `/_workflow` in your browser to inspect, monitor, and debug your workflow runs.
13
+
14
+ ## What's new
15
+
16
+ - **Built-in `/_workflow` route in development.** The route starts the local web UI and redirects to it — no separate command or process required.
17
+ - **Inspect runs in place.** Inspect, monitor, and debug your workflow runs directly from the dev server you're already running.
18
+
19
+ ![Workflow SDK web UI on the /_workflow route](/local-web-ui.png)
20
+
21
+ ## Learn more
22
+
23
+ - [Observability](/docs/observability) — Inspect runs with the web UI and CLI
24
+ - [Nitro](/docs/getting-started/nitro) — Set up Workflow SDK in a Nitro v3 app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow",
3
- "version": "5.0.0-beta.11",
3
+ "version": "5.0.0-beta.13",
4
4
  "description": "Workflow SDK - Build durable, resilient, and observable workflows",
5
5
  "main": "dist/typescript-plugin.cjs",
6
6
  "type": "module",
@@ -57,18 +57,18 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "ms": "2.1.3",
60
- "@workflow/astro": "5.0.0-beta.11",
61
- "@workflow/cli": "5.0.0-beta.11",
62
- "@workflow/core": "5.0.0-beta.11",
63
- "@workflow/errors": "5.0.0-beta.6",
60
+ "@workflow/astro": "5.0.0-beta.13",
61
+ "@workflow/cli": "5.0.0-beta.13",
62
+ "@workflow/core": "5.0.0-beta.13",
63
+ "@workflow/errors": "5.0.0-beta.7",
64
64
  "@workflow/typescript-plugin": "5.0.0-beta.4",
65
65
  "@workflow/utils": "5.0.0-beta.3",
66
- "@workflow/next": "5.0.0-beta.11",
67
- "@workflow/nest": "5.0.0-beta.11",
68
- "@workflow/nitro": "5.0.0-beta.11",
69
- "@workflow/nuxt": "5.0.0-beta.11",
70
- "@workflow/sveltekit": "5.0.0-beta.11",
71
- "@workflow/rollup": "5.0.0-beta.11"
66
+ "@workflow/next": "5.0.0-beta.13",
67
+ "@workflow/nest": "5.0.0-beta.13",
68
+ "@workflow/nitro": "5.0.0-beta.13",
69
+ "@workflow/nuxt": "5.0.0-beta.13",
70
+ "@workflow/sveltekit": "5.0.0-beta.13",
71
+ "@workflow/rollup": "5.0.0-beta.13"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/ms": "2.1.0",