@assistant-ui/mcp-docs-server 0.1.30 → 0.1.31

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.
Files changed (208) hide show
  1. package/.docs/organized/code-examples/waterfall.md +1 -1
  2. package/.docs/organized/code-examples/with-a2a.md +2 -2
  3. package/.docs/organized/code-examples/with-ag-ui.md +3 -3
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +5 -5
  5. package/.docs/organized/code-examples/with-artifacts.md +5 -5
  6. package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +79 -50
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +4 -4
  9. package/.docs/organized/code-examples/with-cloud.md +4 -4
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +56 -11
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +7 -7
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +7 -7
  13. package/.docs/organized/code-examples/with-expo.md +16 -16
  14. package/.docs/organized/code-examples/with-external-store.md +2 -2
  15. package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
  16. package/.docs/organized/code-examples/with-generative-ui.md +5 -5
  17. package/.docs/organized/code-examples/with-google-adk.md +4 -4
  18. package/.docs/organized/code-examples/with-heat-graph.md +1 -1
  19. package/.docs/organized/code-examples/with-interactables.md +5 -5
  20. package/.docs/organized/code-examples/with-langchain.md +3 -3
  21. package/.docs/organized/code-examples/with-langgraph.md +3 -3
  22. package/.docs/organized/code-examples/with-livekit.md +8 -8
  23. package/.docs/organized/code-examples/with-opencode.md +99 -54
  24. package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
  25. package/.docs/organized/code-examples/with-react-hook-form.md +5 -5
  26. package/.docs/organized/code-examples/with-react-ink.md +1 -1
  27. package/.docs/organized/code-examples/with-react-router.md +8 -8
  28. package/.docs/organized/code-examples/with-store.md +1 -1
  29. package/.docs/organized/code-examples/with-tanstack.md +5 -5
  30. package/.docs/organized/code-examples/with-tap-runtime.md +2 -2
  31. package/.docs/raw/docs/(docs)/cli.mdx +2 -1
  32. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  33. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  34. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  35. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  36. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  38. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  39. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/index.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/installation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/rtl.mdx +1 -0
  43. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +34 -0
  44. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +41 -0
  45. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +26 -0
  46. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +34 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +31 -0
  48. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +26 -0
  50. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +72 -0
  51. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +41 -0
  52. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +48 -0
  53. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +30 -0
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +23 -0
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +21 -0
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +7 -0
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +65 -0
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +50 -6
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +15 -0
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +36 -1
  61. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +38 -0
  62. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +5 -0
  63. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +144 -6
  64. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +230 -2
  65. package/.docs/raw/docs/cloud/ai-sdk.mdx +221 -3
  66. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  67. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +41 -36
  68. package/.docs/raw/docs/guides/branching.mdx +76 -0
  69. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  70. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +50 -22
  71. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +2 -0
  72. package/.docs/raw/docs/guides/editing.mdx +102 -0
  73. package/.docs/raw/docs/guides/index.mdx +103 -0
  74. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +49 -0
  75. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +51 -8
  76. package/.docs/raw/docs/{(docs)/guides → guides}/mentions.mdx +61 -86
  77. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +8 -2
  78. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +64 -4
  79. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +10 -17
  80. package/.docs/raw/docs/{(docs)/guides → guides}/slash-commands.mdx +103 -37
  81. package/.docs/raw/docs/guides/speech.mdx +156 -0
  82. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +21 -83
  83. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +108 -36
  84. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +131 -35
  85. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +39 -0
  86. package/.docs/raw/docs/ink/index.mdx +1 -3
  87. package/.docs/raw/docs/ink/migration.mdx +1 -3
  88. package/.docs/raw/docs/ink/primitives.mdx +37 -1
  89. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  90. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  91. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  92. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  93. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  94. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  95. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  96. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  97. package/.docs/raw/docs/integrations/gateways/index.mdx +157 -0
  98. package/.docs/raw/docs/integrations/index.mdx +173 -0
  99. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  100. package/.docs/raw/docs/integrations/observability/langfuse.mdx +156 -0
  101. package/.docs/raw/docs/integrations/observability/langsmith.mdx +146 -0
  102. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  103. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  104. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  105. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  106. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  107. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  108. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  109. package/.docs/raw/docs/primitives/composer.mdx +2 -1
  110. package/.docs/raw/docs/primitives/error.mdx +1 -0
  111. package/.docs/raw/docs/primitives/index.mdx +2 -1
  112. package/.docs/raw/docs/primitives/message.mdx +68 -5
  113. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  114. package/.docs/raw/docs/primitives/suggestion.mdx +1 -0
  115. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  116. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  117. package/.docs/raw/docs/react-native/index.mdx +1 -3
  118. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  119. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  120. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  121. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  122. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  123. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  124. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +123 -0
  125. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  126. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +71 -131
  127. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +69 -63
  128. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +330 -123
  129. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  130. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  131. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  132. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  133. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  134. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +323 -0
  135. package/.docs/raw/docs/runtimes/custom/external-store.mdx +253 -1236
  136. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  137. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  138. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  139. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  140. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  141. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  142. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  143. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  144. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  145. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  146. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  147. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  148. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  149. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  150. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  151. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  152. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  153. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  154. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  155. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +71 -203
  156. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  157. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  158. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  159. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  160. package/.docs/raw/docs/ui/badge.mdx +1 -0
  161. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +1 -0
  162. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  163. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  164. package/.docs/raw/docs/ui/directive-text.mdx +1 -0
  165. package/.docs/raw/docs/ui/file.mdx +1 -0
  166. package/.docs/raw/docs/ui/image.mdx +1 -0
  167. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  168. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  169. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  170. package/.docs/raw/docs/ui/model-selector.mdx +1 -0
  171. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  172. package/.docs/raw/docs/ui/quote.mdx +1 -0
  173. package/.docs/raw/docs/ui/reasoning.mdx +66 -33
  174. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  175. package/.docs/raw/docs/ui/select.mdx +1 -0
  176. package/.docs/raw/docs/ui/sources.mdx +1 -0
  177. package/.docs/raw/docs/ui/streamdown.mdx +1 -0
  178. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  179. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  180. package/.docs/raw/docs/ui/thread-list.mdx +17 -0
  181. package/.docs/raw/docs/ui/thread.mdx +56 -1
  182. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  183. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  184. package/.docs/raw/docs/ui/voice.mdx +1 -0
  185. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  186. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  187. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  188. package/package.json +3 -3
  189. package/src/tools/tests/path-traversal.test.ts +1 -1
  190. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  191. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  192. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  193. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  194. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  195. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  196. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -314
  197. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  198. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  199. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  200. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  201. package/.docs/raw/docs/runtimes/langchain/comparison.mdx +0 -60
  202. package/.docs/raw/docs/runtimes/langchain/index.mdx +0 -210
  203. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -699
  204. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  205. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  206. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  207. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  208. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: Overview
3
+ description: Vercel AI SDK integration for assistant-ui across major versions.
4
+ ---
5
+
6
+ import { VercelIcon } from "@/components/icons/vercel";
7
+
8
+ `@assistant-ui/react-ai-sdk` integrates assistant-ui with the [Vercel AI SDK](https://ai-sdk.dev/). It covers `useChat` flows, custom transports, frontend tools, attachments, quote context, multi-step agents, token usage, and cloud persistence.
9
+
10
+ ## Pick a version
11
+
12
+ | AI SDK | Runtime package | Docs |
13
+ | --- | --- | --- |
14
+ | `ai@^6` + `@ai-sdk/react@^3` | `@assistant-ui/react-ai-sdk` (latest) | [v6 (current)](/docs/runtimes/ai-sdk/v6) |
15
+ | `ai@^5` + `@ai-sdk/react@^2` | `@assistant-ui/react-ai-sdk@0.x` | [v5 (legacy)](/docs/runtimes/ai-sdk/v5-legacy) |
16
+ | `ai@^4` | `@assistant-ui/react-data-stream` | [v4 (legacy)](/docs/runtimes/ai-sdk/v4-legacy) |
17
+
18
+ New projects should target v6. v5 and v4 are documented for projects that have not migrated yet; both have known compatibility gaps and receive no new features.
19
+
20
+ ## Architecture
21
+
22
+ `@assistant-ui/react-ai-sdk` is layered on `ExternalStoreRuntime` (see [architecture](/docs/runtimes/concepts/architecture)). Features that ship as runtime adapters work the same way they do everywhere else; see [adapters](/docs/runtimes/concepts/adapters).
23
+
24
+ ## Choosing useChatRuntime vs useAISDKRuntime
25
+
26
+ Both ship in the same package.
27
+
28
+ - **`useChatRuntime`** (recommended) wraps the AI SDK's `useChat` hook and adds cloud thread support, the standard adapter slots, and `AssistantChatTransport` (which forwards system messages and frontend tools by default). Use this unless you have a reason not to.
29
+ - **`useAISDKRuntime`** is a lower-level hook that takes an existing `useChat` instance you control directly. Use it when you need to share the chat instance with non-assistant-ui code or wire in a custom transport that does not inherit from `AssistantChatTransport`.
30
+
31
+ ## Next
32
+
33
+ <Cards>
34
+ <Card
35
+ icon={<VercelIcon width={20} height={20} />}
36
+ title="v6 (current)"
37
+ description="Quickstart, frontend tools, attachments, quotes, history, multi-step, useAISDKRuntime."
38
+ href="/docs/runtimes/ai-sdk/v6"
39
+ />
40
+ <Card
41
+ icon={<VercelIcon width={20} height={20} />}
42
+ title="v5 (legacy)"
43
+ description="Reference for projects still on AI SDK v5."
44
+ href="/docs/runtimes/ai-sdk/v5-legacy"
45
+ />
46
+ <Card
47
+ icon={<VercelIcon width={20} height={20} />}
48
+ title="v4 (legacy)"
49
+ description="Reference for projects still on AI SDK v4."
50
+ href="/docs/runtimes/ai-sdk/v4-legacy"
51
+ />
52
+ </Cards>
@@ -1,66 +1,51 @@
1
1
  ---
2
- title: AI SDK v4 (Legacy)
3
- description: Legacy integration for Vercel AI SDK v4 using data stream runtime.
2
+ title: AI SDK v4 (legacy)
3
+ description: Reference for projects still on AI SDK v4. New projects should use v6.
4
4
  ---
5
5
 
6
+ import { VercelIcon } from "@/components/icons/vercel";
6
7
 
7
- ## Overview
8
-
9
- If you're using AI SDK v4 (legacy), you can integrate with assistant-ui using the `@assistant-ui/react-data-stream` package and its `useDataStreamRuntime` hook. This provides a compatible runtime that works with AI SDK v4's streaming responses.
10
-
11
- <Callout type="warning">
12
- AI SDK v4 is now considered legacy. We recommend upgrading to [AI SDK
13
- v6](/docs/runtimes/ai-sdk/v6) for improved features and better
14
- TypeScript support. This documentation is provided for projects that haven't
15
- migrated yet.
8
+ <Callout type="warn">
9
+ AI SDK v4 is a legacy version. New projects should use [AI SDK v6](/docs/runtimes/ai-sdk/v6). v4 integrations use the older `@assistant-ui/react-data-stream` package, not `@assistant-ui/react-ai-sdk`.
16
10
  </Callout>
17
11
 
18
- ## Getting Started
12
+ ## Why legacy
19
13
 
14
+ Vercel ships AI SDK majors roughly yearly; v4 is two majors behind v6. The current `@assistant-ui/react-ai-sdk` package targets v6+ exclusively, so v4 users plug into [`@assistant-ui/react-data-stream`](/docs/runtimes/custom/data-stream) instead — the same data stream protocol that v4's `toDataStreamResponse()` emits.
20
15
 
21
- ### Option 1: Using @assistant-ui/react-data-stream (Recommended)
16
+ This page is reference for existing v4 projects. Plan to migrate to v6 when feasible.
17
+
18
+ ## Setup
22
19
 
23
20
  <Steps>
24
- <Step>
25
- ### Install the required packages
21
+ <Step>
26
22
 
27
- Install `@assistant-ui/react-data-stream` alongside assistant-ui and AI SDK v4:
23
+ ### Install
28
24
 
29
25
  <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-data-stream", "ai@^4"]} />
30
26
 
31
- </Step>
32
- <Step>
33
-
34
- ### Setup your backend route
27
+ </Step>
28
+ <Step>
35
29
 
36
- Create an API route that uses AI SDK v4's streaming capabilities:
30
+ ### Backend route
37
31
 
38
- `@/app/api/chat/route.ts`
39
-
40
- ```tsx
32
+ ```ts title="@/app/api/chat/route.ts"
41
33
  import { streamText } from "ai";
42
34
  import { openai } from "@ai-sdk/openai";
43
35
 
44
36
  export async function POST(req: Request) {
45
37
  const { messages } = await req.json();
46
-
47
- const result = streamText({
48
- model: openai("gpt-4"),
49
- messages,
50
- });
51
-
38
+ const result = streamText({ model: openai("gpt-4"), messages });
52
39
  return result.toDataStreamResponse();
53
40
  }
54
41
  ```
55
42
 
56
- </Step>
57
- <Step>
43
+ </Step>
44
+ <Step>
58
45
 
59
- ### Use `useDataStreamRuntime` in your component
46
+ ### Frontend
60
47
 
61
- `@/app/page.tsx`
62
-
63
- ```tsx
48
+ ```tsx title="@/app/page.tsx"
64
49
  "use client";
65
50
 
66
51
  import { AssistantRuntimeProvider } from "@assistant-ui/react";
@@ -68,10 +53,7 @@ import { useDataStreamRuntime } from "@assistant-ui/react-data-stream";
68
53
  import { Thread } from "@/components/assistant-ui/thread";
69
54
 
70
55
  export default function Home() {
71
- const runtime = useDataStreamRuntime({
72
- api: "/api/chat",
73
- });
74
-
56
+ const runtime = useDataStreamRuntime({ api: "/api/chat" });
75
57
  return (
76
58
  <AssistantRuntimeProvider runtime={runtime}>
77
59
  <div className="h-full">
@@ -82,96 +64,54 @@ export default function Home() {
82
64
  }
83
65
  ```
84
66
 
85
- </Step>
67
+ </Step>
86
68
  </Steps>
87
69
 
88
- ### Option 2: Using @assistant-ui/react-ai-sdk v0.1.10 (Legacy)
89
-
90
- Alternatively, you can use the older version of the AI SDK integration package, though this version is no longer actively maintained:
91
-
92
- <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk@0.1.10", "ai@^4"]} />
93
-
94
- <Callout type="warning">
95
- Version 0.1.10 of `@assistant-ui/react-ai-sdk` is no longer actively
96
- maintained. We recommend using the `@assistant-ui/react-data-stream` approach
97
- or upgrading to AI SDK v6 for continued support.
98
- </Callout>
99
-
100
- With this legacy version, you would use the `useVercelUseChatRuntime` hook:
101
-
102
- ```tsx
103
- "use client";
104
-
105
- import { useChat } from "ai/react";
106
- import { AssistantRuntimeProvider } from "@assistant-ui/react";
107
- import { useVercelUseChatRuntime } from "@assistant-ui/react-ai-sdk";
108
- import { Thread } from "@/components/assistant-ui/thread";
109
-
110
- export default function Home() {
111
- const chat = useChat({
112
- api: "/api/chat",
113
- });
114
- const runtime = useVercelUseChatRuntime(chat);
115
-
116
- return (
117
- <AssistantRuntimeProvider runtime={runtime}>
118
- <div className="h-full">
119
- <Thread />
120
- </div>
121
- </AssistantRuntimeProvider>
122
- );
123
- }
124
- ```
125
-
126
- ## API Reference
127
-
128
- ### `useDataStreamRuntime`
129
-
130
- The `useDataStreamRuntime` hook creates a runtime compatible with assistant-ui from AI SDK v4's streaming responses.
131
-
132
- ```tsx
133
- import { useDataStreamRuntime } from "@assistant-ui/react-data-stream";
134
-
135
- const runtime = useDataStreamRuntime({
136
- api: "/api/chat",
137
- // Options similar to AI SDK v4's useChat
138
- initialMessages: [],
139
- onFinish: (message) => {
140
- console.log("Message completed:", message);
141
- },
142
- onError: (error) => {
143
- console.error("Chat error:", error);
144
- },
145
- });
146
- ```
147
-
148
- #### Options
149
-
150
- The `useDataStreamRuntime` hook accepts options similar to AI SDK v4's `useChat` hook:
151
-
152
- - **`api`**: The API endpoint for chat requests (required)
153
- - **`initialMessages`**: Initial messages to populate the chat
154
- - **`onFinish`**: Callback when a message completes streaming
155
- - **`onError`**: Callback for handling errors
156
- - **`headers`**: Additional headers to send with requests
157
- - **`body`**: Additional body parameters to send with requests
158
-
159
- <Callout type="info">
160
- The `useDataStreamRuntime` API is designed to be familiar to developers
161
- already using AI SDK v4's `useChat` hook, making migration straightforward.
162
- </Callout>
163
-
164
- ## Migration to AI SDK v6
165
-
166
- When you're ready to upgrade to AI SDK v6:
167
-
168
- 1. Replace `@assistant-ui/react-data-stream` with `@assistant-ui/react-ai-sdk`
169
- 2. Update your backend to use AI SDK v6's `streamText` API
170
- 3. Switch from `useDataStreamRuntime` to `useChatRuntime`
171
- 4. Take advantage of improved TypeScript support and automatic system/tool forwarding
172
-
173
- See our [AI SDK v6 documentation](/docs/runtimes/ai-sdk/v6) for the complete migration guide.
174
-
175
- ## Example
176
-
177
- For a working example with AI SDK v4, you can adapt the patterns from our [AI SDK examples](https://github.com/assistant-ui/assistant-ui/tree/main/examples) using the `@assistant-ui/react-data-stream` package instead of the v6 integration.
70
+ `useDataStreamRuntime` accepts `api`, `initialMessages`, `onFinish`, `onError`, `headers`, `body`, and the standard `LocalRuntimeOptions`. For the full reference, see [Data Stream Protocol](/docs/runtimes/custom/data-stream).
71
+
72
+ ## Differences from v6
73
+
74
+ | Feature | v4 | v6 |
75
+ | --- | --- | --- |
76
+ | `ai` package | `ai@^4` | `ai@^6` |
77
+ | Runtime package | `@assistant-ui/react-data-stream` | `@assistant-ui/react-ai-sdk` |
78
+ | Runtime hook | `useDataStreamRuntime` | `useChatRuntime` |
79
+ | Response | `toDataStreamResponse()` | `toUIMessageStreamResponse()` |
80
+ | Tool schema | `parameters: z.object({...})` | `inputSchema: zodSchema(z.object({...}))` |
81
+ | Message type | (untyped) | `UIMessage` |
82
+
83
+ ## Migration to v6
84
+
85
+ When you are ready to upgrade:
86
+
87
+ 1. Swap `@assistant-ui/react-data-stream` for `@assistant-ui/react-ai-sdk`.
88
+ 2. Update your backend to AI SDK v6's `streamText` (see [v6 docs](/docs/runtimes/ai-sdk/v6)).
89
+ 3. Switch the runtime hook from `useDataStreamRuntime` to `useChatRuntime`.
90
+
91
+ AI SDK provides codemods at [ai-sdk.dev/docs/migration-guides](https://ai-sdk.dev/docs/migration-guides) that handle the package-side rewrites.
92
+
93
+ ## Alternative: react-ai-sdk@0.1.10
94
+
95
+ An older release line of `@assistant-ui/react-ai-sdk` (0.1.10) supported AI SDK v4 directly. It is no longer maintained and has no upgrade path; if you are starting a new v4 project, use `@assistant-ui/react-data-stream` instead.
96
+
97
+ ## Related
98
+
99
+ <Cards>
100
+ <Card
101
+ icon={<VercelIcon width={20} height={20} />}
102
+ title="AI SDK v6"
103
+ description="Current integration; what new projects should target."
104
+ href="/docs/runtimes/ai-sdk/v6"
105
+ />
106
+ <Card
107
+ title="Data Stream Protocol"
108
+ description="The runtime v4 integrations are built on."
109
+ href="/docs/runtimes/custom/data-stream"
110
+ />
111
+ <Card
112
+ icon={<VercelIcon width={20} height={20} />}
113
+ title="AI SDK v5 (legacy)"
114
+ description="The intermediate legacy version."
115
+ href="/docs/runtimes/ai-sdk/v5-legacy"
116
+ />
117
+ </Cards>
@@ -1,45 +1,35 @@
1
1
  ---
2
- title: AI SDK v5 (Legacy)
3
- description: Integrate Vercel AI SDK v5 with useChatRuntime for streaming chat.
2
+ title: AI SDK v5 (legacy)
3
+ description: Reference for projects still on AI SDK v5. New projects should use v6.
4
4
  ---
5
5
 
6
- <Callout type="error">
7
- AI SDK v5 is no longer supported. The `@assistant-ui/react-ai-sdk` package now requires AI SDK v6+.
8
- Please upgrade to [AI SDK v6](/docs/runtimes/ai-sdk/v6).
9
- </Callout>
6
+ import { VercelIcon } from "@/components/icons/vercel";
10
7
 
11
- ## Overview
8
+ <Callout type="warn">
9
+ AI SDK v5 is a legacy version. New projects should use [AI SDK v6](/docs/runtimes/ai-sdk/v6). v5 users stay on `@assistant-ui/react-ai-sdk@0.x`; the latest line targets v6+.
10
+ </Callout>
12
11
 
13
- This documentation is preserved for reference. For new projects, use [AI SDK v6](/docs/runtimes/ai-sdk/v6).
12
+ ## Why legacy
14
13
 
15
- ## Getting Started
14
+ AI SDK v6 introduced major API changes: async `convertToModelMessages`, a new tool schema, and `toUIMessageStreamResponse()`. v5 still works but no longer receives new features in `@assistant-ui/react-ai-sdk`. Pinning to `@0.x` keeps you on the v5-compatible surface.
16
15
 
17
- <Steps>
18
- <Step>
19
- ### Create a Next.js project
20
-
21
- ```sh
22
- npx create-next-app@latest my-app
23
- cd my-app
24
- ```
16
+ This page is reference for existing v5 projects. Plan to migrate to v6 when feasible.
25
17
 
26
- </Step>
27
- <Step>
18
+ ## Setup
28
19
 
29
- ### Install AI SDK v5 and `@assistant-ui/react`
20
+ <Steps>
21
+ <Step>
30
22
 
31
- ```sh
32
- npm install @assistant-ui/react @assistant-ui/react-ai-sdk@0.x ai@^5 @ai-sdk/openai@^1 zod
33
- ```
23
+ ### Install v5-compatible versions
34
24
 
35
- </Step>
36
- <Step>
25
+ <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk@0.x", "ai@^5", "@ai-sdk/openai@^1", "zod"]} />
37
26
 
38
- ### Setup a backend route under `/api/chat`
27
+ </Step>
28
+ <Step>
39
29
 
40
- `@/app/api/chat/route.ts`
30
+ ### Backend route
41
31
 
42
- ```tsx
32
+ ```ts title="@/app/api/chat/route.ts"
43
33
  import { openai } from "@ai-sdk/openai";
44
34
  import { streamText, tool } from "ai";
45
35
  import type { Message } from "ai";
@@ -49,35 +39,27 @@ export const maxDuration = 30;
49
39
 
50
40
  export async function POST(req: Request) {
51
41
  const { messages }: { messages: Message[] } = await req.json();
52
-
53
42
  const result = streamText({
54
43
  model: openai("gpt-4o"),
55
44
  messages,
56
45
  tools: {
57
46
  get_current_weather: tool({
58
47
  description: "Get the current weather",
59
- parameters: z.object({
60
- city: z.string(),
61
- }),
62
- execute: async ({ city }) => {
63
- return `The weather in ${city} is sunny`;
64
- },
48
+ parameters: z.object({ city: z.string() }),
49
+ execute: async ({ city }) => `The weather in ${city} is sunny`,
65
50
  }),
66
51
  },
67
52
  });
68
-
69
53
  return result.toDataStreamResponse();
70
54
  }
71
55
  ```
72
56
 
73
- </Step>
74
- <Step>
57
+ </Step>
58
+ <Step>
75
59
 
76
- ### Setup the frontend
60
+ ### Frontend
77
61
 
78
- `@/app/page.tsx`
79
-
80
- ```tsx
62
+ ```tsx title="@/app/page.tsx"
81
63
  "use client";
82
64
 
83
65
  import { Thread } from "@/components/assistant-ui/thread";
@@ -86,7 +68,6 @@ import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
86
68
 
87
69
  export default function Home() {
88
70
  const runtime = useChatRuntime();
89
-
90
71
  return (
91
72
  <AssistantRuntimeProvider runtime={runtime}>
92
73
  <div className="h-full">
@@ -97,33 +78,58 @@ export default function Home() {
97
78
  }
98
79
  ```
99
80
 
81
+ </Step>
82
+ </Steps>
83
+
100
84
  <Callout type="info">
101
- `useChatRuntime` was introduced in `@assistant-ui/react-ai-sdk@0.11.3`. If you're using an older 0.x version, use `useVercelUseChatRuntime` with `useChat` from `ai/react` instead:
85
+ On `@assistant-ui/react-ai-sdk` versions older than 0.11.3, use `useVercelUseChatRuntime` with `useChat` from `ai/react` instead:
102
86
 
103
- ```tsx
104
- import { useChat } from "ai/react";
105
- import { useVercelUseChatRuntime } from "@assistant-ui/react-ai-sdk";
87
+ ```tsx
88
+ import { useChat } from "ai/react";
89
+ import { useVercelUseChatRuntime } from "@assistant-ui/react-ai-sdk";
106
90
 
107
- const chat = useChat({ api: "/api/chat" });
108
- const runtime = useVercelUseChatRuntime(chat);
109
- ```
91
+ const chat = useChat({ api: "/api/chat" });
92
+ const runtime = useVercelUseChatRuntime(chat);
93
+ ```
110
94
  </Callout>
111
95
 
112
- </Step>
113
- </Steps>
114
-
115
- ## Key Differences from v6
96
+ ## Differences from v6
116
97
 
117
98
  | Feature | v5 | v6 |
118
- |---------|----|----|
119
- | **ai package** | `ai@^5` | `ai@^6` |
120
- | **@assistant-ui/react-ai-sdk** | `@0.x` | `@latest` |
121
- | **@ai-sdk/openai** | `@ai-sdk/openai@^1` | `@ai-sdk/openai@^3` |
122
- | **Message type** | `Message` | `UIMessage` |
123
- | **convertToModelMessages** | Sync | Async (`await`) |
124
- | **Tool schema** | `parameters: z.object({...})` | `inputSchema: zodSchema(z.object({...}))` |
125
- | **Response** | `toDataStreamResponse()` | `toUIMessageStreamResponse()` |
99
+ | --- | --- | --- |
100
+ | `ai` package | `ai@^5` | `ai@^6` |
101
+ | `@assistant-ui/react-ai-sdk` | `@0.x` | `@latest` |
102
+ | `@ai-sdk/openai` | `^1` | `^3` |
103
+ | Message type | `Message` | `UIMessage` |
104
+ | `convertToModelMessages` | Sync | Async (`await`) |
105
+ | Tool schema | `parameters: z.object({...})` | `inputSchema: zodSchema(z.object({...}))` |
106
+ | Response | `toDataStreamResponse()` | `toUIMessageStreamResponse()` |
126
107
 
127
108
  ## Migration to v6
128
109
 
129
- See the [AI SDK v6 documentation](/docs/runtimes/ai-sdk/v6) for the latest integration guide.
110
+ When you are ready to upgrade:
111
+
112
+ 1. Update `ai` from `@^5` to `@^6`, and `@assistant-ui/react-ai-sdk` to the latest line.
113
+ 2. Add `await` to `convertToModelMessages(...)` calls.
114
+ 3. Convert tool schemas: `parameters: z.object({...})` → `inputSchema: zodSchema(z.object({...}))`.
115
+ 4. Replace `toDataStreamResponse()` with `toUIMessageStreamResponse()`.
116
+ 5. Switch the `Message` type to `UIMessage`.
117
+
118
+ AI SDK provides codemods at [ai-sdk.dev/docs/migration-guides/migration-guide-6-0](https://ai-sdk.dev/docs/migration-guides/migration-guide-6-0) that handle most of the package-side rewrites.
119
+
120
+ ## Related
121
+
122
+ <Cards>
123
+ <Card
124
+ icon={<VercelIcon width={20} height={20} />}
125
+ title="AI SDK v6"
126
+ description="Current integration; what new projects should target."
127
+ href="/docs/runtimes/ai-sdk/v6"
128
+ />
129
+ <Card
130
+ icon={<VercelIcon width={20} height={20} />}
131
+ title="AI SDK v4 (legacy)"
132
+ description="The earlier legacy version using react-data-stream."
133
+ href="/docs/runtimes/ai-sdk/v4-legacy"
134
+ />
135
+ </Cards>