@assistant-ui/mcp-docs-server 0.1.23 → 0.1.25

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 (137) hide show
  1. package/.docs/organized/code-examples/waterfall.md +5 -3
  2. package/.docs/organized/code-examples/with-a2a.md +676 -0
  3. package/.docs/organized/code-examples/with-ag-ui.md +7 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +28 -16
  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 +34 -26
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +10 -8
  9. package/.docs/organized/code-examples/with-cloud.md +5 -5
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
  11. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
  12. package/.docs/organized/code-examples/with-expo.md +571 -539
  13. package/.docs/organized/code-examples/with-external-store.md +3 -4
  14. package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
  15. package/.docs/organized/code-examples/with-google-adk.md +353 -0
  16. package/.docs/organized/code-examples/with-heat-graph.md +304 -0
  17. package/.docs/organized/code-examples/with-langgraph.md +25 -23
  18. package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
  19. package/.docs/organized/code-examples/with-react-hook-form.md +6 -9
  20. package/.docs/organized/code-examples/with-react-ink.md +265 -0
  21. package/.docs/organized/code-examples/with-react-router.md +10 -11
  22. package/.docs/organized/code-examples/with-store.md +29 -18
  23. package/.docs/organized/code-examples/with-tanstack.md +7 -7
  24. package/.docs/organized/code-examples/with-tap-runtime.md +6 -4
  25. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
  26. package/.docs/raw/blog/2026-03-launch-week/index.mdx +227 -0
  27. package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
  28. package/.docs/raw/docs/(docs)/cli.mdx +14 -9
  29. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
  30. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
  31. package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
  32. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
  33. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
  34. package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
  35. package/.docs/raw/docs/(docs)/guides/attachments.mdx +9 -11
  36. package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
  37. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
  38. package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
  39. package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
  40. package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
  41. package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
  42. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +2 -1
  43. package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +173 -0
  44. package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
  45. package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
  46. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
  47. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
  48. package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
  49. package/.docs/raw/docs/(docs)/index.mdx +3 -3
  50. package/.docs/raw/docs/(docs)/installation.mdx +69 -46
  51. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
  52. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
  53. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +99 -45
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
  63. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
  64. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
  65. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
  66. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
  67. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
  68. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
  69. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
  70. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
  71. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
  72. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
  73. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
  74. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
  75. package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
  76. package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
  77. package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
  78. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
  79. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
  80. package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
  81. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +89 -7
  82. package/.docs/raw/docs/cloud/ai-sdk.mdx +19 -5
  83. package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
  84. package/.docs/raw/docs/ink/adapters.mdx +41 -0
  85. package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
  86. package/.docs/raw/docs/ink/hooks.mdx +448 -0
  87. package/.docs/raw/docs/ink/index.mdx +239 -0
  88. package/.docs/raw/docs/ink/migration.mdx +140 -0
  89. package/.docs/raw/docs/ink/primitives.mdx +699 -0
  90. package/.docs/raw/docs/react-native/adapters.mdx +63 -87
  91. package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
  92. package/.docs/raw/docs/react-native/hooks.mdx +214 -232
  93. package/.docs/raw/docs/react-native/index.mdx +118 -159
  94. package/.docs/raw/docs/react-native/migration.mdx +144 -0
  95. package/.docs/raw/docs/react-native/primitives.mdx +431 -302
  96. package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
  97. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
  98. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
  99. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +53 -0
  100. package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
  101. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
  102. package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
  103. package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
  104. package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
  105. package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
  106. package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
  107. package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
  108. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
  109. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
  110. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
  111. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
  112. package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
  113. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
  114. package/.docs/raw/docs/ui/context-display.mdx +147 -0
  115. package/.docs/raw/docs/ui/file.mdx +5 -4
  116. package/.docs/raw/docs/ui/image.mdx +5 -4
  117. package/.docs/raw/docs/ui/markdown.mdx +3 -1
  118. package/.docs/raw/docs/ui/model-selector.mdx +8 -8
  119. package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
  120. package/.docs/raw/docs/ui/quote.mdx +210 -0
  121. package/.docs/raw/docs/ui/reasoning.mdx +12 -11
  122. package/.docs/raw/docs/ui/sources.mdx +88 -17
  123. package/.docs/raw/docs/ui/streamdown.mdx +16 -7
  124. package/.docs/raw/docs/ui/thread-list.mdx +11 -13
  125. package/.docs/raw/docs/ui/thread.mdx +28 -33
  126. package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
  127. package/.docs/raw/docs/ui/tool-group.mdx +9 -8
  128. package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
  129. package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
  130. package/package.json +4 -4
  131. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
  132. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
  133. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
  134. package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
  135. package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
  136. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
  137. /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
@@ -57,7 +57,7 @@ NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id
57
57
  subset of endpoints that you need and perform authorization checks.
58
58
  </Callout>
59
59
 
60
- ```tsx twoslash title="@/api/api/[...path]/route.ts"
60
+ ```tsx twoslash title="@/app/api/[...path]/route.ts"
61
61
  import { NextRequest, NextResponse } from "next/server";
62
62
 
63
63
  function getCorsHeaders() {
@@ -95,16 +95,29 @@ async function handleRequest(req: NextRequest, method: string) {
95
95
  options,
96
96
  );
97
97
 
98
+ const headers = new Headers(res.headers);
99
+ headers.delete("content-encoding");
100
+ headers.delete("content-length");
101
+ headers.delete("transfer-encoding");
102
+ const corsHeaders = getCorsHeaders();
103
+ for (const [key, value] of Object.entries(corsHeaders)) {
104
+ headers.set(key, value);
105
+ }
106
+
98
107
  return new NextResponse(res.body, {
99
108
  status: res.status,
100
109
  statusText: res.statusText,
101
- headers: {
102
- ...res.headers,
103
- ...getCorsHeaders(),
104
- },
110
+ headers,
105
111
  });
106
- } catch (e: any) {
107
- return NextResponse.json({ error: e.message }, { status: e.status ?? 500 });
112
+ } catch (e: unknown) {
113
+ if (e instanceof Error) {
114
+ const typedError = e as Error & { status?: number };
115
+ return NextResponse.json(
116
+ { error: typedError.message },
117
+ { status: typedError.status ?? 500 },
118
+ );
119
+ }
120
+ return NextResponse.json({ error: "Unknown error" }, { status: 500 });
108
121
  }
109
122
  }
110
123
 
@@ -113,16 +126,11 @@ export const POST = (req: NextRequest) => handleRequest(req, "POST");
113
126
  export const PUT = (req: NextRequest) => handleRequest(req, "PUT");
114
127
  export const PATCH = (req: NextRequest) => handleRequest(req, "PATCH");
115
128
  export const DELETE = (req: NextRequest) => handleRequest(req, "DELETE");
116
-
117
- // Add a new OPTIONS handler
118
- export const OPTIONS = () => {
119
- return new NextResponse(null, {
129
+ export const OPTIONS = () =>
130
+ new NextResponse(null, {
120
131
  status: 204,
121
- headers: {
122
- ...getCorsHeaders(),
123
- },
132
+ headers: getCorsHeaders(),
124
133
  });
125
- };
126
134
  ```
127
135
 
128
136
  </Step>
@@ -134,8 +142,8 @@ export const OPTIONS = () => {
134
142
  // @filename: /lib/chatApi.ts
135
143
 
136
144
  // ---cut---
137
- import { Client } from "@langchain/langgraph-sdk";
138
- import { LangChainMessage, LangGraphSendMessageConfig } from "@assistant-ui/react-langgraph";
145
+ import { Client, type ThreadState } from "@langchain/langgraph-sdk";
146
+ import { LangChainMessage, LangGraphCommand } from "@assistant-ui/react-langgraph";
139
147
 
140
148
  const createClient = () => {
141
149
  const apiUrl = process.env["NEXT_PUBLIC_LANGGRAPH_API_URL"] || "/api";
@@ -158,21 +166,19 @@ export const getThreadState = async (
158
166
 
159
167
  export const sendMessage = async (params: {
160
168
  threadId: string;
161
- messages: LangChainMessage[];
162
- config?: LangGraphSendMessageConfig;
169
+ messages?: LangChainMessage[];
170
+ command?: LangGraphCommand;
163
171
  }) => {
164
172
  const client = createClient();
165
- const { checkpointId, ...restConfig } = params.config ?? {};
166
173
  return client.runs.stream(
167
174
  params.threadId,
168
175
  process.env["NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID"]!,
169
176
  {
170
- input: params.messages.length > 0
177
+ input: params.messages?.length
171
178
  ? { messages: params.messages }
172
179
  : null,
173
- streamMode: "messages-tuple",
174
- ...(checkpointId && { checkpoint_id: checkpointId }),
175
- ...restConfig,
180
+ command: params.command,
181
+ streamMode: ["messages", "updates"],
176
182
  },
177
183
  );
178
184
  };
@@ -198,14 +204,17 @@ import { createThread, getThreadState, sendMessage } from "@/lib/chatApi";
198
204
 
199
205
  export function MyAssistant() {
200
206
  const runtime = useLangGraphRuntime({
201
- stream: async (messages, { initialize, ...config }) => {
207
+ stream: async function* (messages, { initialize, command }) {
202
208
  const { externalId } = await initialize();
203
209
  if (!externalId) throw new Error("Thread not found");
204
- return sendMessage({
210
+
211
+ const generator = await sendMessage({
205
212
  threadId: externalId,
206
213
  messages,
207
- config
214
+ command,
208
215
  });
216
+
217
+ yield* generator;
209
218
  },
210
219
  create: async () => {
211
220
  const { thread_id } = await createThread();
@@ -321,6 +330,7 @@ const runtime = useLangGraphRuntime({
321
330
  // Fired when an "updates" event is received
322
331
  },
323
332
  onMetadata: (metadata) => { /* thread metadata */ },
333
+ onInfo: (info) => { /* informational messages */ },
324
334
  onError: (error) => { /* stream errors */ },
325
335
  onCustomEvent: (type, data) => { /* custom events */ },
326
336
  },
@@ -378,6 +388,7 @@ For persistent thread history across sessions, integrate with assistant-cloud:
378
388
  const runtime = useLangGraphRuntime({
379
389
  cloud: new AssistantCloud({
380
390
  baseUrl: process.env.NEXT_PUBLIC_ASSISTANT_BASE_URL,
391
+ anonymous: true,
381
392
  }),
382
393
  // ... stream, create, load functions
383
394
  });
@@ -17,7 +17,7 @@ This agent leverages the following features:
17
17
 
18
18
  ## Prerequisites
19
19
 
20
- - Node.js 18.x or higher
20
+ - Node.js 24 or higher
21
21
 
22
22
  ## Final Result
23
23
 
@@ -20,22 +20,32 @@ import { File, Folder, Files } from "fumadocs-ui/components/files";
20
20
  <Folder name="my-app" defaultOpen>
21
21
  <Folder name="app" defaultOpen>
22
22
  <Folder name="api" defaultOpen>
23
- <Folder name="[...path]" defaultOpen>
23
+ <Folder name="[..._path]" defaultOpen>
24
24
  <File name="route.ts" />
25
25
  </Folder>
26
26
  </Folder>
27
+ <File name="assistant.tsx" />
27
28
  <File name="globals.css" />
28
29
  <File name="layout.tsx" />
29
- <File name="MyRuntimeProvider.tsx" />
30
30
  <File name="page.tsx" />
31
31
  </Folder>
32
+ <Folder name="components" defaultOpen>
33
+ <Folder name="assistant-ui">
34
+ <File name="thread.tsx" />
35
+ </Folder>
36
+ <Folder name="ui">
37
+ <File name="button.tsx" />
38
+ <File name="tooltip.tsx" />
39
+ </Folder>
40
+ </Folder>
32
41
  <Folder name="lib">
33
42
  <File name="chatApi.ts" />
43
+ <File name="utils.ts" />
34
44
  </Folder>
45
+ <File name="components.json" />
35
46
  <File name="next.config.ts" />
36
47
  <File name="package.json" />
37
48
  <File name="postcss.config.mjs" />
38
- <File name="tailwind.config.ts" />
39
49
  <File name="tsconfig.json" />
40
50
  </Folder>
41
51
  </Files>
@@ -95,26 +105,11 @@ import starter from "./images/conversation-starters.png";
95
105
  className="mx-auto rounded-lg border shadow"
96
106
  />
97
107
 
98
- ```tsx title="@/app/page.tsx" {5-17}
108
+ ```tsx title="@/app/page.tsx"
99
109
  export default function Home() {
100
110
  return (
101
111
  <div className="flex h-full flex-col">
102
- <Thread
103
- welcome={{
104
- suggestions: [
105
- {
106
- prompt: "How much revenue did Apple make last year?",
107
- },
108
- {
109
- prompt: "Is McDonald's profitable?",
110
- },
111
- {
112
- prompt: "What's the current stock price of Tesla?",
113
- },
114
- ],
115
- }}
116
- assistantMessage={{ components: { Text: MarkdownText } }}
117
- />
112
+ <Thread />
118
113
  </div>
119
114
  );
120
115
  }
@@ -98,10 +98,8 @@ import { PriceSnapshotTool } from "@/components/tools/price-snapshot/PriceSnapsh
98
98
  export default function Home() {
99
99
  return (
100
100
  <div className="flex h-full flex-col">
101
- <Thread
102
- ...
103
- tools={[PriceSnapshotTool]}
104
- />
101
+ <PriceSnapshotTool />
102
+ <Thread />
105
103
  </div>
106
104
  );
107
105
  }
@@ -321,17 +319,15 @@ export const ToolFallback: ToolCallMessagePartComponent = ({
321
319
 
322
320
  ### Bind fallback UI
323
321
 
324
- ```tsx title="@/app/page.tsx" {1,8}
325
- import { ToolFallback } from "@/components/tools/ToolFallback";
326
-
322
+ ```tsx title="@/app/page.tsx"
327
323
  export default function Home() {
328
324
  return (
329
325
  <div className="flex h-full flex-col">
330
- <Thread
331
- ...
332
- assistantMessage={{ components: { Text: MarkdownText, ToolFallback } }}
333
- />
326
+ <PriceSnapshotTool />
327
+ <Thread />
334
328
  </div>
335
329
  );
336
330
  }
337
331
  ```
332
+
333
+ The `Thread` component from `@assistant-ui/ui` already includes a built-in `ToolFallback` and `MarkdownText`, so no additional configuration is needed.
@@ -89,18 +89,17 @@ Then we use `makeAssistantToolUI` to define the tool UI:
89
89
  import { TransactionConfirmationPending } from "./transaction-confirmation-pending";
90
90
  import { TransactionConfirmationFinal } from "./transaction-confirmation-final";
91
91
  import { makeAssistantToolUI } from "@assistant-ui/react";
92
- import { updateState } from "@/lib/chatApi";
93
92
 
94
93
  export const PurchaseStockTool = makeAssistantToolUI<PurchaseStockArgs, string>(
95
94
  {
96
95
  toolName: "purchase_stock",
97
96
  render: function PurchaseStockUI({ args, result, status, addResult }) {
98
97
  const handleReject = async () => {
99
- addResult({ approve: false });
98
+ addResult(JSON.stringify({ approve: false }));
100
99
  };
101
100
 
102
101
  const handleConfirm = async () => {
103
- addResult({ approve: true });
102
+ addResult(JSON.stringify({ approve: true }));
104
103
  };
105
104
 
106
105
  return (
@@ -215,10 +214,9 @@ import { PurchaseStockTool } from "@/components/tools/purchase-stock/PurchaseSto
215
214
  export default function Home() {
216
215
  return (
217
216
  <div className="flex h-full flex-col">
218
- <Thread
219
- ...
220
- tools={[PriceSnapshotTool, PurchaseStockTool]}
221
- />
217
+ <PriceSnapshotTool />
218
+ <PurchaseStockTool />
219
+ <Thread />
222
220
  </div>
223
221
  );
224
222
  }
@@ -308,7 +306,6 @@ We will import the new `<TransactionConfirmationFinal />` component and use it i
308
306
  import { TransactionConfirmationPending } from "./transaction-confirmation-pending";
309
307
  import { TransactionConfirmationFinal } from "./transaction-confirmation-final";
310
308
  import { makeAssistantToolUI } from "@assistant-ui/react";
311
- import { updateState } from "@/lib/chatApi";
312
309
 
313
310
  type PurchaseStockArgs = {
314
311
  ticker: string;
@@ -335,11 +332,11 @@ export const PurchaseStockTool = makeAssistantToolUI<PurchaseStockArgs, string>(
335
332
  }
336
333
 
337
334
  const handleReject = () => {
338
- addResult({ cancelled: true });
335
+ addResult(JSON.stringify({ approve: false }));
339
336
  };
340
337
 
341
338
  const handleConfirm = async () => {
342
- addResult({ approve: true });
339
+ addResult(JSON.stringify({ approve: true }));
343
340
  };
344
341
 
345
342
  return (
@@ -372,7 +369,7 @@ export const PurchaseStockTool = makeAssistantToolUI<PurchaseStockArgs, string>(
372
369
 
373
370
  ### Try it out!
374
371
 
375
- Confirm the purchase of shares. You should see the approval confimration UI appear.
372
+ Confirm the purchase of shares. You should see the approval confirmation UI appear.
376
373
 
377
374
  import purchase2 from "./images/acme-confirmed.png";
378
375
 
@@ -4,7 +4,7 @@ description: Connect to LangServe endpoints via Vercel AI SDK integration.
4
4
  ---
5
5
 
6
6
  <Callout type="warning">
7
- This integration has not been tested with AI SDK v5.
7
+ This integration has not been tested with AI SDK v6.
8
8
  </Callout>
9
9
 
10
10
  ## Overview
@@ -67,7 +67,6 @@ export async function POST(req: Request) {
67
67
  // ---cut---
68
68
  "use client";
69
69
 
70
- import { useChat } from "@ai-sdk/react";
71
70
  import { AssistantRuntimeProvider } from "@assistant-ui/react";
72
71
  import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
73
72
 
@@ -104,11 +103,11 @@ export default function RootLayout({
104
103
  children: ReactNode;
105
104
  }>) {
106
105
  return (
107
- <MyRuntimeProvider>
108
- <html lang="en">
109
- <body>{children}</body>
110
- </html>
111
- </MyRuntimeProvider>
106
+ <html lang="en">
107
+ <body>
108
+ <MyRuntimeProvider>{children}</MyRuntimeProvider>
109
+ </body>
110
+ </html>
112
111
  );
113
112
  }
114
113
  ```
@@ -14,6 +14,8 @@ graph TD
14
14
  B -->|LangGraph| D[Use LangGraph Runtime]
15
15
  B -->|LangServe| E[Use LangServe Runtime]
16
16
  B -->|Mastra| F[Use Mastra Runtime]
17
+ B -->|AG-UI Protocol| J[Use AG-UI Runtime]
18
+ B -->|A2A Protocol| K[Use A2A Runtime]
17
19
  B -->|Custom Backend| G{State Management?}
18
20
  G -->|Let assistant-ui handle it| H[Use LocalRuntime]
19
21
  G -->|I'll manage it myself| I[Use ExternalStoreRuntime]
@@ -43,8 +45,8 @@ For popular frameworks, we provide ready-to-use integrations built on top of our
43
45
  <Cards>
44
46
  <Card
45
47
  title="Vercel AI SDK"
46
- description="For useChat and useAssistant hooks - streaming with all major providers"
47
- href="/docs/runtimes/ai-sdk/use-chat"
48
+ description="For useChat hook - streaming with all major providers"
49
+ href="/docs/runtimes/ai-sdk/v6"
48
50
  />
49
51
  <Card
50
52
  title="Data Stream Protocol"
@@ -66,6 +68,16 @@ For popular frameworks, we provide ready-to-use integrations built on top of our
66
68
  description="For workflow orchestration with Mastra's ecosystem"
67
69
  href="/docs/runtimes/mastra/overview"
68
70
  />
71
+ <Card
72
+ title="AG-UI Protocol"
73
+ description="For backends implementing the AG-UI (Agent-User Interaction) protocol"
74
+ href="https://www.npmjs.com/package/@assistant-ui/react-ag-ui"
75
+ />
76
+ <Card
77
+ title="A2A Protocol"
78
+ description="For Agent-to-Agent protocol communication between AI agents"
79
+ href="/docs/runtimes/a2a"
80
+ />
69
81
  </Cards>
70
82
 
71
83
  ## Understanding Runtime Architecture
@@ -78,6 +90,8 @@ The pre-built integrations (AI SDK, LangGraph, etc.) are **not separate runtime
78
90
  - **LangGraph Runtime** → Built on `LocalRuntime` with graph execution adapter
79
91
  - **LangServe Runtime** → Built on `LocalRuntime` with LangServe client adapter
80
92
  - **Mastra Runtime** → Built on `LocalRuntime` with workflow adapter
93
+ - **AG-UI Runtime** → Built on `LocalRuntime` with AG-UI protocol adapter
94
+ - **A2A Runtime** → Built on `LocalRuntime` with Agent-to-Agent protocol adapter
81
95
 
82
96
  This means you get all the benefits of `LocalRuntime` (automatic state management, built-in features) with zero configuration for your specific framework.
83
97
 
@@ -127,6 +141,7 @@ Pre-built integrations can always be replaced with a custom `LocalRuntime` or `E
127
141
  ### Vercel AI SDK with Streaming
128
142
 
129
143
  ```tsx
144
+ import { AssistantRuntimeProvider, Thread } from "@assistant-ui/react";
130
145
  import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
131
146
 
132
147
  export function MyAssistant() {
@@ -209,7 +224,7 @@ Explore our implementation examples:
209
224
 
210
225
  1. **Choose your runtime** based on the decision tree above
211
226
  2. **Follow the specific guide**:
212
- - [AI SDK Integration](/docs/runtimes/ai-sdk/use-chat)
227
+ - [AI SDK Integration](/docs/runtimes/ai-sdk/v6)
213
228
  - [`LocalRuntime` Guide](/docs/runtimes/custom/local)
214
229
  - [`ExternalStoreRuntime` Guide](/docs/runtimes/custom/external-store)
215
230
  - [LangGraph Integration](/docs/runtimes/langgraph)
@@ -0,0 +1,147 @@
1
+ ---
2
+ title: Context Display
3
+ description: Visualize token usage relative to a model's context window — ring, bar, or text — with a detailed hover popover.
4
+ ---
5
+
6
+ import { ContextDisplaySample } from "@/components/docs/samples/context-display";
7
+
8
+ <ContextDisplaySample />
9
+
10
+ <Callout type="info">
11
+ This component requires server-side setup to [forward token usage metadata](#forward-token-usage-from-your-route-handler). Without it, ContextDisplay will show 0 usage and no breakdown data.
12
+ </Callout>
13
+
14
+ ## Getting Started
15
+
16
+ <Steps>
17
+ <Step>
18
+
19
+ ### Add `context-display`
20
+
21
+ <InstallCommand shadcn={["context-display"]} />
22
+
23
+ This adds a `/components/assistant-ui/context-display.tsx` file to your project.
24
+
25
+ </Step>
26
+ <Step>
27
+
28
+ ### Forward token usage from your route handler
29
+
30
+ Use `messageMetadata` in your Next.js route to attach `usage` from `finish` and `modelId` from `finish-step`:
31
+
32
+ ```tsx title="app/api/chat/route.ts"
33
+ import { streamText, convertToModelMessages } from "ai";
34
+
35
+ export async function POST(req: Request) {
36
+ const { messages, modelName } = await req.json();
37
+ const result = streamText({
38
+ model: getModel(modelName),
39
+ messages: await convertToModelMessages(messages),
40
+ });
41
+ return result.toUIMessageStreamResponse({
42
+ messageMetadata: ({ part }) => {
43
+ if (part.type === "finish") {
44
+ return {
45
+ usage: part.totalUsage,
46
+ };
47
+ }
48
+ if (part.type === "finish-step") {
49
+ return {
50
+ modelId: part.response.modelId,
51
+ };
52
+ }
53
+ return undefined;
54
+ },
55
+ });
56
+ }
57
+ ```
58
+
59
+ </Step>
60
+ <Step>
61
+
62
+ ### Use in your application
63
+
64
+ Pick a variant and place it in your thread footer, composer, or sidebar. Pass `modelContextWindow` with your model's token limit.
65
+
66
+ ```tsx title="/components/assistant-ui/thread.tsx" {1,8}
67
+ import { ContextDisplay } from "@/components/assistant-ui/context-display";
68
+
69
+ const ThreadFooter: FC = () => {
70
+ return (
71
+ <div className="flex items-center justify-end px-3 py-1.5">
72
+ <ContextDisplay.Bar modelContextWindow={128000} />
73
+ </div>
74
+ );
75
+ };
76
+ ```
77
+
78
+ </Step>
79
+ </Steps>
80
+
81
+ ## Variants
82
+
83
+ Three preset variants are available, each wrapping the shared tooltip popover:
84
+
85
+ ```tsx
86
+ // SVG donut ring (default, compact)
87
+ <ContextDisplay.Ring modelContextWindow={128000} />
88
+
89
+ // Horizontal progress bar with label
90
+ <ContextDisplay.Bar modelContextWindow={128000} />
91
+
92
+ // Minimal monospace text
93
+ <ContextDisplay.Text modelContextWindow={128000} />
94
+ ```
95
+
96
+ All presets accept `className` for styling overrides and `side` to control tooltip placement (`"top"`, `"bottom"`, `"left"`, `"right"`).
97
+
98
+ ## Composable API
99
+
100
+ For custom visualizations, use the building blocks directly:
101
+
102
+ ```tsx
103
+ import { ContextDisplay } from "@/components/assistant-ui/context-display";
104
+
105
+ <ContextDisplay.Root modelContextWindow={128000}>
106
+ <ContextDisplay.Trigger aria-label="Context usage">
107
+ <MyCustomGauge />
108
+ </ContextDisplay.Trigger>
109
+ <ContextDisplay.Content side="top" />
110
+ </ContextDisplay.Root>
111
+ ```
112
+
113
+ | Component | Description |
114
+ |-----------|-------------|
115
+ | `Root` | Uses provided `usage` when supplied, otherwise fetches token usage internally; provides shared context and wraps children in a tooltip |
116
+ | `Trigger` | Button that opens the tooltip on hover |
117
+ | `Content` | Tooltip popover with the token breakdown (Usage %, Input, Cached, Output, Reasoning, Total) |
118
+
119
+ ## API Reference
120
+
121
+ ### Preset Props
122
+
123
+ All preset variants (`Ring`, `Bar`, `Text`) share the same props:
124
+
125
+ | Prop | Type | Default | Description |
126
+ |------|------|---------|-------------|
127
+ | `modelContextWindow` | `number` | — | Maximum token limit of the current model (required) |
128
+ | `className` | `string` | — | Additional class names on the trigger button |
129
+ | `side` | `"top" \| "bottom" \| "left" \| "right"` | `"top"` | Tooltip placement |
130
+ | `usage` | `ThreadTokenUsage` | — | Optional externally-provided usage data (skips internal usage fetch when provided) |
131
+
132
+ ### Color Thresholds
133
+
134
+ Ring and Bar share the same severity colors:
135
+
136
+ | Level | Threshold | Ring | Bar |
137
+ |-------|-----------|------|-----|
138
+ | Low | `< 65%` | `stroke-emerald-500` | `bg-emerald-500` |
139
+ | Warning | `65% – 85%` | `stroke-amber-500` | `bg-amber-500` |
140
+ | Critical | `> 85%` | `stroke-red-500` | `bg-red-500` |
141
+
142
+ Text displays numeric values only — no severity color.
143
+
144
+ ## Related
145
+
146
+ - [Message Timing](/docs/ui/message-timing) — Streaming performance stats (TTFT, tok/s)
147
+ - [Thread](/docs/ui/thread) — The thread component where ContextDisplay is typically placed
@@ -29,11 +29,12 @@ import { File } from "@/components/assistant-ui/file";
29
29
  const AssistantMessage: FC = () => {
30
30
  return (
31
31
  <MessagePrimitive.Root className="...">
32
- <MessagePrimitive.Parts
33
- components={{
34
- File,
32
+ <MessagePrimitive.Parts>
33
+ {({ part }) => {
34
+ if (part.type === "file") return <File {...part} />;
35
+ return null;
35
36
  }}
36
- />
37
+ </MessagePrimitive.Parts>
37
38
  </MessagePrimitive.Root>
38
39
  );
39
40
  };
@@ -29,11 +29,12 @@ import { Image } from "@/components/assistant-ui/image";
29
29
  const AssistantMessage: FC = () => {
30
30
  return (
31
31
  <MessagePrimitive.Root className="...">
32
- <MessagePrimitive.Parts
33
- components={{
34
- Image,
32
+ <MessagePrimitive.Parts>
33
+ {({ part }) => {
34
+ if (part.type === "image") return <Image {...part} />;
35
+ return null;
35
36
  }}
36
- />
37
+ </MessagePrimitive.Parts>
37
38
  </MessagePrimitive.Root>
38
39
  );
39
40
  };
@@ -50,7 +50,9 @@ const AssistantMessage: FC = () => {
50
50
  return (
51
51
  <MessagePrimitive.Root className="...">
52
52
  <div className="...">
53
- <MessagePrimitive.Parts components={{ Text: MarkdownText }} />
53
+ <MessagePrimitive.Parts>
54
+ {({ part }) => part.type === "text" ? <MarkdownText /> : null}
55
+ </MessagePrimitive.Parts>
54
56
  </div>
55
57
  <AssistantActionBar />
56
58
 
@@ -33,11 +33,11 @@ const ComposerAction: FC = () => {
33
33
  <div className="flex items-center gap-1">
34
34
  <ModelSelector
35
35
  models={[
36
- { id: "gpt-5-nano", name: "GPT-5 Nano", description: "Fast and efficient" },
37
- { id: "gpt-5-mini", name: "GPT-5 Mini", description: "Balanced performance" },
38
- { id: "gpt-5", name: "GPT-5", description: "Most capable" },
36
+ { id: "gpt-4o-mini", name: "GPT-4o Mini", description: "Fast and efficient" },
37
+ { id: "gpt-4o", name: "GPT-4o", description: "Balanced performance" },
38
+ { id: "o3", name: "o3", description: "Most capable" },
39
39
  ]}
40
- defaultValue="gpt-5-mini"
40
+ defaultValue="gpt-4o-mini"
41
41
  size="sm"
42
42
  />
43
43
  </div>
@@ -58,7 +58,7 @@ export async function POST(req: Request) {
58
58
 
59
59
  const result = streamText({
60
60
  model: openai(config?.modelName ?? "gpt-4o"),
61
- messages: convertToModelMessages(messages),
61
+ messages: await convertToModelMessages(messages),
62
62
  });
63
63
 
64
64
  return result.toUIMessageStreamResponse();
@@ -101,8 +101,8 @@ Each model in the `models` array supports:
101
101
  ```tsx
102
102
  const models = [
103
103
  {
104
- id: "gpt-5", // Sent to backend as config.modelName
105
- name: "GPT-5", // Display name in trigger and items
104
+ id: "gpt-4o", // Sent to backend as config.modelName
105
+ name: "GPT-4o", // Display name in trigger and items
106
106
  description: "Most capable", // Optional subtitle in items only
107
107
  icon: <SparklesIcon />, // Optional icon (any ReactNode)
108
108
  },
@@ -113,7 +113,7 @@ const models = [
113
113
 
114
114
  The default `ModelSelector` export automatically registers the selected model with assistant-ui's `ModelContext` system. When a user selects a model:
115
115
 
116
- 1. The component calls `api.modelContext().register()` with `config.modelName`
116
+ 1. The component calls `aui.modelContext().register()` with `config.modelName`
117
117
  2. The `AssistantChatTransport` includes `config` in the request body
118
118
  3. Your API route reads `config.modelName` to determine which model to use
119
119