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

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 (62) hide show
  1. package/.docs/organized/code-examples/waterfall.md +4 -4
  2. package/.docs/organized/code-examples/with-a2a.md +5 -5
  3. package/.docs/organized/code-examples/with-ag-ui.md +6 -6
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +7 -7
  5. package/.docs/organized/code-examples/with-artifacts.md +7 -7
  6. package/.docs/organized/code-examples/with-assistant-transport.md +5 -5
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +7 -7
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +8 -8
  9. package/.docs/organized/code-examples/with-cloud.md +7 -7
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +511 -0
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +10 -10
  13. package/.docs/organized/code-examples/with-expo.md +18 -18
  14. package/.docs/organized/code-examples/with-external-store.md +5 -5
  15. package/.docs/organized/code-examples/with-ffmpeg.md +220 -66
  16. package/.docs/organized/code-examples/with-google-adk.md +6 -6
  17. package/.docs/organized/code-examples/with-heat-graph.md +4 -4
  18. package/.docs/organized/code-examples/with-interactables.md +836 -0
  19. package/.docs/organized/code-examples/with-langgraph.md +6 -6
  20. package/.docs/organized/code-examples/with-livekit.md +591 -0
  21. package/.docs/organized/code-examples/with-parent-id-grouping.md +6 -6
  22. package/.docs/organized/code-examples/with-react-hook-form.md +8 -8
  23. package/.docs/organized/code-examples/with-react-ink.md +3 -3
  24. package/.docs/organized/code-examples/with-react-router.md +11 -11
  25. package/.docs/organized/code-examples/with-store.md +11 -6
  26. package/.docs/organized/code-examples/with-tanstack.md +8 -8
  27. package/.docs/organized/code-examples/with-tap-runtime.md +8 -8
  28. package/.docs/raw/blog/2026-03-launch-week/index.mdx +31 -0
  29. package/.docs/raw/docs/(docs)/cli.mdx +60 -0
  30. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +9 -1
  31. package/.docs/raw/docs/(docs)/guides/attachments.mdx +65 -4
  32. package/.docs/raw/docs/(docs)/guides/interactables.mdx +354 -0
  33. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +3 -3
  34. package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +1 -0
  35. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +29 -0
  36. package/.docs/raw/docs/(docs)/guides/voice.mdx +333 -0
  37. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +128 -0
  38. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +23 -0
  39. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +6 -0
  40. package/.docs/raw/docs/cloud/ai-sdk.mdx +81 -1
  41. package/.docs/raw/docs/ink/primitives.mdx +141 -0
  42. package/.docs/raw/docs/primitives/action-bar.mdx +351 -0
  43. package/.docs/raw/docs/primitives/assistant-modal.mdx +215 -0
  44. package/.docs/raw/docs/primitives/attachment.mdx +216 -0
  45. package/.docs/raw/docs/primitives/branch-picker.mdx +221 -0
  46. package/.docs/raw/docs/primitives/chain-of-thought.mdx +311 -0
  47. package/.docs/raw/docs/primitives/composer.mdx +526 -0
  48. package/.docs/raw/docs/primitives/error.mdx +141 -0
  49. package/.docs/raw/docs/primitives/index.mdx +98 -0
  50. package/.docs/raw/docs/primitives/message.mdx +524 -0
  51. package/.docs/raw/docs/primitives/selection-toolbar.mdx +165 -0
  52. package/.docs/raw/docs/primitives/suggestion.mdx +242 -0
  53. package/.docs/raw/docs/primitives/thread-list.mdx +404 -0
  54. package/.docs/raw/docs/primitives/thread.mdx +482 -0
  55. package/.docs/raw/docs/runtimes/a2a/index.mdx +4 -0
  56. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +2 -2
  57. package/.docs/raw/docs/runtimes/assistant-transport.mdx +6 -2
  58. package/.docs/raw/docs/ui/context-display.mdx +2 -2
  59. package/.docs/raw/docs/ui/mention.mdx +168 -0
  60. package/.docs/raw/docs/ui/model-selector.mdx +1 -1
  61. package/.docs/raw/docs/ui/voice.mdx +172 -0
  62. package/package.json +3 -4
@@ -0,0 +1,482 @@
1
+ ---
2
+ title: Thread
3
+ description: Build custom scrollable message containers with auto-scroll, empty states, and message rendering.
4
+ ---
5
+
6
+ import { ThreadPrimitiveSample } from "@/components/docs/samples/thread-primitive";
7
+ import { ThreadPrimitive as ThreadPrimitiveDocs } from "@/generated/primitiveDocs";
8
+
9
+ The Thread primitive is the scrollable message container, and the backbone of any chat interface. It handles viewport management, auto-scrolling, empty states, message rendering, and suggestions. You provide the layout and styling.
10
+
11
+ <Tabs items={["Preview", "Code"]}>
12
+ <Tab>
13
+ <ThreadPrimitiveSample />
14
+ </Tab>
15
+ <Tab>
16
+ ```tsx
17
+ import {
18
+ AuiIf,
19
+ ComposerPrimitive,
20
+ ThreadPrimitive,
21
+ MessagePrimitive,
22
+ } from "@assistant-ui/react";
23
+ import { ArrowUpIcon } from "lucide-react";
24
+
25
+ function MinimalThread() {
26
+ return (
27
+ <ThreadPrimitive.Root className="flex h-full flex-col">
28
+ <ThreadPrimitive.Viewport className="flex flex-1 flex-col gap-3 overflow-y-auto p-3">
29
+ <AuiIf condition={(s) => s.thread.isEmpty}>
30
+ <p>Welcome! Ask a question to get started.</p>
31
+ </AuiIf>
32
+
33
+ <ThreadPrimitive.Messages>
34
+ {({ message }) => {
35
+ if (message.role === "user") return <UserMessage />;
36
+ return <AssistantMessage />;
37
+ }}
38
+ </ThreadPrimitive.Messages>
39
+
40
+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0 pt-2">
41
+ <ComposerPrimitive.Root className="flex w-full flex-col rounded-3xl border bg-muted">
42
+ <ComposerPrimitive.Input
43
+ placeholder="Ask anything..."
44
+ className="min-h-10 w-full resize-none bg-transparent px-5 pt-3.5 pb-2.5 text-sm focus:outline-none"
45
+ rows={1}
46
+ />
47
+ <div className="flex items-center justify-end px-2.5 pb-2.5">
48
+ <ComposerPrimitive.Send className="flex size-8 items-center justify-center rounded-full bg-primary text-primary-foreground disabled:opacity-30">
49
+ <ArrowUpIcon className="size-4" />
50
+ </ComposerPrimitive.Send>
51
+ </div>
52
+ </ComposerPrimitive.Root>
53
+ </ThreadPrimitive.ViewportFooter>
54
+ </ThreadPrimitive.Viewport>
55
+ </ThreadPrimitive.Root>
56
+ );
57
+ }
58
+
59
+ function UserMessage() {
60
+ return (
61
+ <MessagePrimitive.Root className="flex justify-end">
62
+ <div className="max-w-[80%] rounded-2xl bg-primary px-4 py-2.5 text-sm text-primary-foreground">
63
+ <MessagePrimitive.Parts />
64
+ </div>
65
+ </MessagePrimitive.Root>
66
+ );
67
+ }
68
+
69
+ function AssistantMessage() {
70
+ return (
71
+ <MessagePrimitive.Root className="flex justify-start">
72
+ <div className="max-w-[80%] rounded-2xl bg-muted px-4 py-2.5 text-sm">
73
+ <MessagePrimitive.Parts />
74
+ </div>
75
+ </MessagePrimitive.Root>
76
+ );
77
+ }
78
+ ```
79
+ </Tab>
80
+ </Tabs>
81
+
82
+ ## Quick Start
83
+
84
+ Minimal example:
85
+
86
+ ```tsx
87
+ import { ThreadPrimitive } from "@assistant-ui/react";
88
+
89
+ <ThreadPrimitive.Root>
90
+ <ThreadPrimitive.Viewport>
91
+ <ThreadPrimitive.Messages>
92
+ {() => <MyMessage />}
93
+ </ThreadPrimitive.Messages>
94
+ </ThreadPrimitive.Viewport>
95
+ </ThreadPrimitive.Root>
96
+ ```
97
+
98
+ `Root` renders a `<div>`, `Viewport` renders a scrollable `<div>`, and `Messages` iterates over the thread's messages. Add your own styles and components; the primitive handles the rest.
99
+
100
+ <Callout type="info">
101
+ Runtime setup: primitives require runtime context. Wrap your UI in `AssistantRuntimeProvider` with a runtime (for example `useLocalRuntime(...)`). See [Pick a Runtime](/docs/runtimes/pick-a-runtime).
102
+ </Callout>
103
+
104
+ ## Core Concepts
105
+
106
+ ### Viewport & Auto-Scroll
107
+
108
+ `Viewport` is the scrollable container. It auto-scrolls to the bottom as new content streams in, but only if the user hasn't scrolled up manually. Set `autoScroll={false}` to disable this entirely.
109
+
110
+ ```tsx
111
+ <ThreadPrimitive.Viewport autoScroll={true}>
112
+ {/* messages */}
113
+ </ThreadPrimitive.Viewport>
114
+ ```
115
+
116
+ ### Turn Anchor
117
+
118
+ By default, new messages appear at the bottom and scroll down. With `turnAnchor="top"`, the user's message anchors to the top of the viewport. This creates the modern reading experience where you see the question at the top and the response flowing below it.
119
+
120
+ ```tsx
121
+ <ThreadPrimitive.Viewport turnAnchor="top">
122
+ {/* messages */}
123
+ </ThreadPrimitive.Viewport>
124
+ ```
125
+
126
+ This is what the shadcn Thread component uses by default. For scroll anchoring to work correctly, `ViewportSlack` is needed on the last assistant message to provide enough min-height for the user message to anchor at the top. This is included automatically in the shadcn component.
127
+
128
+ ### Viewport Scroll Options
129
+
130
+ `ThreadPrimitive.Viewport` has three event-specific scroll controls:
131
+
132
+ - `scrollToBottomOnRunStart` (default `true`): scrolls when `thread.runStart` fires
133
+ - `scrollToBottomOnInitialize` (default `true`): scrolls when `thread.initialize` fires
134
+ - `scrollToBottomOnThreadSwitch` (default `true`): scrolls when `threadListItem.switchedTo` fires
135
+
136
+ These work alongside `autoScroll`. If `autoScroll` is omitted, it defaults to `true` for `turnAnchor="bottom"` and `false` for `turnAnchor="top"`.
137
+
138
+ ```tsx
139
+ <ThreadPrimitive.Viewport
140
+ turnAnchor="top"
141
+ autoScroll={false}
142
+ scrollToBottomOnRunStart={true}
143
+ scrollToBottomOnInitialize={false}
144
+ scrollToBottomOnThreadSwitch={true}
145
+ >
146
+ <ThreadPrimitive.Messages>
147
+ {({ message }) => {
148
+ if (message.role === "user") return <UserMessage />;
149
+ return <AssistantMessage />;
150
+ }}
151
+ </ThreadPrimitive.Messages>
152
+ </ThreadPrimitive.Viewport>
153
+ ```
154
+
155
+ ### ViewportFooter
156
+
157
+ `ViewportFooter` sticks to the bottom of the viewport and registers its height so the auto-scroll system accounts for it. This is where you place your composer:
158
+
159
+ ```tsx
160
+ <ThreadPrimitive.Viewport>
161
+ <ThreadPrimitive.Messages>
162
+ {() => <MyMessage />}
163
+ </ThreadPrimitive.Messages>
164
+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0">
165
+ <MyComposer />
166
+ </ThreadPrimitive.ViewportFooter>
167
+ </ThreadPrimitive.Viewport>
168
+ ```
169
+
170
+ ### Empty State
171
+
172
+ <Callout type="warn">
173
+ `ThreadPrimitive.Empty` is deprecated. Use [`AuiIf`](/docs/api-reference/primitives/assistant-if) instead.
174
+ </Callout>
175
+
176
+ ```tsx
177
+ <AuiIf condition={(s) => s.thread.isEmpty}>
178
+ <div className="flex flex-col items-center gap-2 text-center">
179
+ <h2>Welcome!</h2>
180
+ <p>How can I help you today?</p>
181
+ </div>
182
+ </AuiIf>
183
+ ```
184
+
185
+ ### Messages Iterator
186
+
187
+ `Messages` now prefers a children render function. It gives you the current message state so you can branch inline:
188
+
189
+ ```tsx
190
+ <ThreadPrimitive.Messages>
191
+ {({ message }) => {
192
+ if (message.composer.isEditing) return <MyEditComposer />;
193
+ if (message.role === "user") return <MyUserMessage />;
194
+ return <MyAssistantMessage />;
195
+ }}
196
+ </ThreadPrimitive.Messages>
197
+ ```
198
+
199
+ `components` is deprecated. Use the `children` render function instead.
200
+
201
+ ### Suggestions Iterator
202
+
203
+ `Suggestions` follows the same pattern. Prefer the children render function when rendering custom suggestion UIs:
204
+
205
+ ```tsx
206
+ <ThreadPrimitive.Suggestions>
207
+ {() => <MySuggestionButton />}
208
+ </ThreadPrimitive.Suggestions>
209
+ ```
210
+
211
+ ## Parts
212
+
213
+ ### Root
214
+
215
+ Top-level container for a thread layout. Renders a `<div>` element unless `asChild` is set.
216
+
217
+ ```tsx
218
+ <ThreadPrimitive.Root className="flex h-full flex-col">
219
+ <ThreadPrimitive.Viewport>
220
+ <ThreadPrimitive.Messages>
221
+ {() => <MyMessage />}
222
+ </ThreadPrimitive.Messages>
223
+ </ThreadPrimitive.Viewport>
224
+ </ThreadPrimitive.Root>
225
+ ```
226
+
227
+ ### Viewport
228
+
229
+ The scrollable area with auto-scroll behavior. Renders a `<div>` element unless `asChild` is set.
230
+
231
+ ```tsx
232
+ <ThreadPrimitive.Viewport
233
+ turnAnchor="top"
234
+ autoScroll={false}
235
+ scrollToBottomOnRunStart={true}
236
+ >
237
+ <ThreadPrimitive.Messages>
238
+ {({ message }) => {
239
+ if (message.role === "user") return <UserMessage />;
240
+ return <AssistantMessage />;
241
+ }}
242
+ </ThreadPrimitive.Messages>
243
+ </ThreadPrimitive.Viewport>
244
+ ```
245
+
246
+ <PrimitivesTypeTable type="ThreadPrimitiveViewportProps" parameters={ThreadPrimitiveDocs.Viewport.props.filter(p => p.name !== "asChild")} />
247
+
248
+ ### ViewportFooter
249
+
250
+ Footer container that registers its height with the viewport scroll system. Renders a `<div>` element unless `asChild` is set.
251
+
252
+ ```tsx
253
+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0 pt-2">
254
+ <ComposerPrimitive.Root>...</ComposerPrimitive.Root>
255
+ </ThreadPrimitive.ViewportFooter>
256
+ ```
257
+
258
+ ### ViewportProvider
259
+
260
+ Provides viewport context without rendering a scrollable element. Use this when you have a custom scroll container.
261
+
262
+ ```tsx
263
+ <ThreadPrimitive.ViewportProvider>
264
+ <div className="flex-1 overflow-y-auto">
265
+ <ThreadPrimitive.Messages>
266
+ {() => <MyMessage />}
267
+ </ThreadPrimitive.Messages>
268
+ <ThreadPrimitive.ViewportFooter>
269
+ <MyComposer />
270
+ </ThreadPrimitive.ViewportFooter>
271
+ </div>
272
+ </ThreadPrimitive.ViewportProvider>
273
+ ```
274
+
275
+ ### ViewportSlack
276
+
277
+ Adds min-height for scroll anchoring with `turnAnchor="top"`. It wraps its child element via `Slot` and does not render a DOM element of its own.
278
+
279
+ ```tsx
280
+ <MessagePrimitive.Root>
281
+ <MessagePrimitive.Parts />
282
+ <ThreadPrimitive.ViewportSlack>
283
+ <div className="min-h-[40vh]" />
284
+ </ThreadPrimitive.ViewportSlack>
285
+ </MessagePrimitive.Root>
286
+ ```
287
+
288
+ Props: `fillClampThreshold` and `fillClampOffset` control how the slack height is calculated. `children` is required.
289
+
290
+ ### Messages
291
+
292
+ Renders a component for each message in the thread, resolved by role and edit state.
293
+
294
+ ```tsx
295
+ <ThreadPrimitive.Messages>
296
+ {({ message }) => {
297
+ if (message.composer.isEditing) return <MyEditComposer />;
298
+ if (message.role === "user") return <MyUserMessage />;
299
+ return <MyAssistantMessage />;
300
+ }}
301
+ </ThreadPrimitive.Messages>
302
+ ```
303
+
304
+ <PrimitivesTypeTable type="ThreadPrimitiveMessagesProps" parameters={ThreadPrimitiveDocs.Messages.props} />
305
+
306
+ ### MessageByIndex
307
+
308
+ Renders a single message at a specific index in the thread.
309
+
310
+ ```tsx
311
+ <ThreadPrimitive.MessageByIndex
312
+ index={0}
313
+ components={{ Message: MyMessage }}
314
+ />
315
+ ```
316
+
317
+ <PrimitivesTypeTable type="ThreadPrimitiveMessageByIndexProps" parameters={ThreadPrimitiveDocs.MessageByIndex.props} />
318
+
319
+ ### ScrollToBottom
320
+
321
+ Scrolls the viewport to the bottom. Automatically disabled when already at the bottom. Renders a `<button>` element unless `asChild` is set.
322
+
323
+ ```tsx
324
+ <ThreadPrimitive.ScrollToBottom className="rounded-full bg-background p-2 shadow-md">
325
+ <ArrowDownIcon />
326
+ </ThreadPrimitive.ScrollToBottom>
327
+ ```
328
+
329
+ <PrimitivesTypeTable type="ThreadPrimitiveScrollToBottomProps" parameters={ThreadPrimitiveDocs.ScrollToBottom.props.filter(p => p.name !== "asChild")} />
330
+
331
+ ### Suggestions
332
+
333
+ Renders suggestion prompts via a component.
334
+
335
+ ```tsx
336
+ <ThreadPrimitive.Suggestions>
337
+ {({ suggestion }) => <MySuggestionButton prompt={suggestion.prompt} />}
338
+ </ThreadPrimitive.Suggestions>
339
+ ```
340
+
341
+ <PrimitivesTypeTable type="ThreadPrimitiveSuggestionsProps" parameters={ThreadPrimitiveDocs.Suggestions.props} />
342
+
343
+ ### SuggestionByIndex
344
+
345
+ Renders a single suggestion at a specific index.
346
+
347
+ ```tsx
348
+ <ThreadPrimitive.SuggestionByIndex
349
+ index={0}
350
+ components={{ Suggestion: MySuggestion }}
351
+ />
352
+ ```
353
+
354
+ <PrimitivesTypeTable type="ThreadPrimitiveSuggestionByIndexProps" parameters={ThreadPrimitiveDocs.SuggestionByIndex.props} />
355
+
356
+ ### Suggestion
357
+
358
+ Self-contained suggestion button. Renders a `<button>` element unless `asChild` is set. *(Legacy -- prefer `Suggestions` iterator.)*
359
+
360
+ ```tsx
361
+ <ThreadPrimitive.Suggestion prompt="Write a blog post" send />
362
+ ```
363
+
364
+ <PrimitivesTypeTable type="ThreadPrimitiveSuggestionProps" parameters={ThreadPrimitiveDocs.Suggestion.props.filter(p => p.name !== "asChild")} />
365
+
366
+ ### Empty
367
+
368
+ <Callout type="warn">
369
+ Deprecated. Use [`AuiIf`](/docs/api-reference/primitives/assistant-if) with `s.thread.isEmpty` instead.
370
+ </Callout>
371
+
372
+ Legacy helper that only renders its children when the thread is empty.
373
+
374
+ ```tsx
375
+ <ThreadPrimitive.Empty>
376
+ <div className="text-center text-muted-foreground">
377
+ No messages yet.
378
+ </div>
379
+ </ThreadPrimitive.Empty>
380
+ ```
381
+
382
+ ### If (deprecated)
383
+
384
+ <Callout type="warn">
385
+ Deprecated. Use [`AuiIf`](/docs/api-reference/primitives/assistant-if) instead.
386
+ </Callout>
387
+
388
+ ```tsx
389
+ // Before (deprecated)
390
+ <ThreadPrimitive.If empty>...</ThreadPrimitive.If>
391
+ <ThreadPrimitive.If running>...</ThreadPrimitive.If>
392
+ <ThreadPrimitive.If disabled>...</ThreadPrimitive.If>
393
+
394
+ // After
395
+ <AuiIf condition={(s) => s.thread.isEmpty}>...</AuiIf>
396
+ <AuiIf condition={(s) => s.thread.isRunning}>...</AuiIf>
397
+ <AuiIf condition={(s) => s.thread.isDisabled}>...</AuiIf>
398
+ ```
399
+
400
+ ## Patterns
401
+
402
+ ### Welcome Screen with Suggestions
403
+
404
+ ```tsx
405
+ <AuiIf condition={(s) => s.thread.isEmpty}>
406
+ <div className="flex flex-col items-center gap-4 text-center">
407
+ <h2>What can I help with?</h2>
408
+ <div className="grid grid-cols-2 gap-2">
409
+ <ThreadPrimitive.Suggestions>
410
+ {() => <MySuggestionButton />}
411
+ </ThreadPrimitive.Suggestions>
412
+ </div>
413
+ </div>
414
+ </AuiIf>
415
+ ```
416
+
417
+ ### Scroll-to-Bottom Button
418
+
419
+ ```tsx
420
+ <ThreadPrimitive.ScrollToBottom className="fixed bottom-24 right-4 rounded-full bg-background p-2 shadow-md">
421
+ <ArrowDownIcon />
422
+ </ThreadPrimitive.ScrollToBottom>
423
+ ```
424
+
425
+ The button is automatically disabled when the viewport is already scrolled to the bottom.
426
+
427
+ ### Turn Anchor Top Layout
428
+
429
+ ```tsx
430
+ <ThreadPrimitive.Root className="flex h-full flex-col">
431
+ <ThreadPrimitive.Viewport turnAnchor="top" className="flex-1 overflow-y-auto">
432
+ <ThreadPrimitive.Messages>
433
+ {({ message }) => {
434
+ if (message.role === "user") return <UserMessage />;
435
+ return <AssistantMessage />;
436
+ }}
437
+ </ThreadPrimitive.Messages>
438
+ <ThreadPrimitive.ViewportFooter className="sticky bottom-0">
439
+ <MyComposer />
440
+ </ThreadPrimitive.ViewportFooter>
441
+ </ThreadPrimitive.Viewport>
442
+ </ThreadPrimitive.Root>
443
+ ```
444
+
445
+ ### Custom Message Components
446
+
447
+ ```tsx
448
+ <ThreadPrimitive.Messages>
449
+ {({ message }) => {
450
+ if (message.role === "user") {
451
+ return (
452
+ <MessagePrimitive.Root>
453
+ <div className="ml-auto rounded-xl bg-blue-500 p-3 text-white">
454
+ <MessagePrimitive.Parts />
455
+ </div>
456
+ </MessagePrimitive.Root>
457
+ );
458
+ }
459
+
460
+ return (
461
+ <MessagePrimitive.Root>
462
+ <div className="rounded-xl bg-gray-100 p-3">
463
+ <MessagePrimitive.Parts />
464
+ </div>
465
+ </MessagePrimitive.Root>
466
+ );
467
+ }}
468
+ </ThreadPrimitive.Messages>
469
+ ```
470
+
471
+ ## Relationship to Components
472
+
473
+ The [Thread](/docs/ui/thread) component is a full chat interface built from these primitives with Tailwind styling. Start there for a default implementation. Reach for `ThreadPrimitive` when you need a custom layout, different scroll behavior, or a non-standard thread structure.
474
+
475
+ ## API Reference
476
+
477
+ For full prop details on every part, see the [ThreadPrimitive API Reference](/docs/api-reference/primitives/thread).
478
+
479
+ Related:
480
+ - [MessagePrimitive API Reference](/docs/api-reference/primitives/message)
481
+ - [ComposerPrimitive API Reference](/docs/api-reference/primitives/composer)
482
+ - [ThreadListPrimitive API Reference](/docs/api-reference/primitives/thread-list)
@@ -97,6 +97,7 @@ const runtime = useA2ARuntime({ client });
97
97
  | Option | Type | Description |
98
98
  | --- | --- | --- |
99
99
  | `baseUrl` | `string` | Base URL of the A2A server |
100
+ | `basePath` | `string` | Optional path prefix for API endpoints (e.g. `"/v1"`). Does not affect agent card discovery |
100
101
  | `headers` | `Record<string, string>` or `() => Record<string, string>` | Static or dynamic headers (e.g. for auth tokens) |
101
102
  | `tenant` | `string` | Tenant ID for multi-tenant servers (prepended to URL paths) |
102
103
  | `extensions` | `string[]` | Extension URIs to negotiate via `A2A-Extensions` header |
@@ -124,7 +125,10 @@ const runtime = useA2ARuntime({ client });
124
125
  | --- | --- | --- |
125
126
  | `client` | `A2AClient` | Pre-built A2A client instance (provide this OR `baseUrl`) |
126
127
  | `baseUrl` | `string` | A2A server URL (creates a client automatically) |
128
+ | `basePath` | `string` | Path prefix for API endpoints (e.g. `"/v1"`). Only used with `baseUrl` |
129
+ | `tenant` | `string` | Tenant ID for multi-tenant servers. Only used with `baseUrl` |
127
130
  | `headers` | see above | Headers for the auto-created client |
131
+ | `extensions` | `string[]` | Extension URIs to negotiate. Only used with `baseUrl` |
128
132
  | `contextId` | `string` | Initial context ID for the conversation |
129
133
  | `configuration` | `A2ASendMessageConfiguration` | Default send message configuration |
130
134
  | `onError` | `(error: Error) => void` | Error callback |
@@ -111,9 +111,9 @@ Use `messageMetadata` in your Next.js route to attach `usage` from `finish` and
111
111
  import { streamText, convertToModelMessages } from "ai";
112
112
  import { frontendTools } from "@assistant-ui/react-ai-sdk";
113
113
  export async function POST(req: Request) {
114
- const { messages, tools, modelName } = await req.json();
114
+ const { messages, tools, config } = await req.json();
115
115
  const result = streamText({
116
- model: getModel(modelName),
116
+ model: getModel(config?.modelName),
117
117
  messages: await convertToModelMessages(messages),
118
118
  tools: frontendTools(tools),
119
119
  });
@@ -72,11 +72,15 @@ The backend endpoint receives POST requests with the following payload:
72
72
  tools?: Record<string, ToolJSONSchema>, // Tool definitions keyed by tool name
73
73
  threadId: string | null, // The current thread/conversation identifier (null for new threads)
74
74
  parentId?: string | null, // The parent message ID (included when editing or branching)
75
- // ...callSettings (maxTokens, temperature, topP, presencePenalty, frequencyPenalty, seed)
76
- // ...config (apiKey, baseUrl, modelName)
75
+ callSettings?: { maxTokens, temperature, topP, presencePenalty, frequencyPenalty, seed },
76
+ config?: { apiKey, baseUrl, modelName },
77
77
  }
78
78
  ```
79
79
 
80
+ <Callout type="warn">
81
+ **Migrating from top-level fields:** `callSettings` and `config` fields were previously spread at the top level of the request body (e.g. `body.modelName` instead of `body.config.modelName`). Both formats are currently sent for backward compatibility, but the top-level fields are deprecated and will be removed in a future version. Update your backend to read from the nested objects.
82
+ </Callout>
83
+
80
84
  The backend endpoint returns a stream of state snapshots using the `assistant-stream` library ([npm](https://www.npmjs.com/package/assistant-stream) / [PyPI](https://pypi.org/project/assistant-stream/)).
81
85
 
82
86
  ### Handling Commands
@@ -33,9 +33,9 @@ Use `messageMetadata` in your Next.js route to attach `usage` from `finish` and
33
33
  import { streamText, convertToModelMessages } from "ai";
34
34
 
35
35
  export async function POST(req: Request) {
36
- const { messages, modelName } = await req.json();
36
+ const { messages, config } = await req.json();
37
37
  const result = streamText({
38
- model: getModel(modelName),
38
+ model: getModel(config?.modelName),
39
39
  messages: await convertToModelMessages(messages),
40
40
  });
41
41
  return result.toUIMessageStreamResponse({