@assistant-ui/mcp-docs-server 0.1.18 → 0.1.19
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.
- package/.docs/organized/code-examples/with-ag-ui.md +375 -85
- package/.docs/organized/code-examples/{with-ai-sdk-v5.md → with-ai-sdk-v6.md} +386 -94
- package/.docs/organized/code-examples/with-assistant-transport.md +374 -84
- package/.docs/organized/code-examples/with-cloud.md +405 -100
- package/.docs/organized/code-examples/with-custom-thread-list.md +412 -105
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +2241 -0
- package/.docs/organized/code-examples/with-external-store.md +374 -83
- package/.docs/organized/code-examples/with-ffmpeg.md +377 -87
- package/.docs/organized/code-examples/with-langgraph.md +403 -98
- package/.docs/organized/code-examples/with-parent-id-grouping.md +374 -83
- package/.docs/organized/code-examples/with-react-hook-form.md +379 -89
- package/.docs/organized/code-examples/with-react-router.md +2167 -0
- package/.docs/organized/code-examples/with-store.md +5 -5
- package/.docs/organized/code-examples/with-tanstack.md +10 -10
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +0 -2
- package/.docs/raw/docs/{about-assistantui.mdx → (docs)/about-assistantui.mdx} +2 -1
- package/.docs/raw/docs/{architecture.mdx → (docs)/architecture.mdx} +3 -2
- package/.docs/raw/docs/{cli.mdx → (docs)/cli.mdx} +1 -19
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-readable.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool-ui.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/model-context.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/motivation.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/{devtools.mdx → (docs)/devtools.mdx} +4 -4
- package/.docs/raw/docs/{guides/Attachments.mdx → (docs)/guides/attachments.mdx} +4 -5
- package/.docs/raw/docs/{guides/Branching.mdx → (docs)/guides/branching.mdx} +2 -1
- package/.docs/raw/docs/{guides → (docs)/guides}/context-api.mdx +1 -0
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +370 -0
- package/.docs/raw/docs/{guides/Editing.mdx → (docs)/guides/editing.mdx} +1 -0
- package/.docs/raw/docs/{guides/Latex.mdx → (docs)/guides/latex.mdx} +1 -2
- package/.docs/raw/docs/{guides/Speech.mdx → (docs)/guides/speech.mdx} +9 -10
- package/.docs/raw/docs/{guides/ToolUI.mdx → (docs)/guides/tool-ui.mdx} +15 -14
- package/.docs/raw/docs/{guides/Tools.mdx → (docs)/guides/tools.mdx} +10 -7
- package/.docs/raw/docs/{getting-started.mdx → (docs)/index.mdx} +17 -22
- package/.docs/raw/docs/{mcp-docs-server.mdx → (docs)/mcp-docs-server.mdx} +1 -2
- package/.docs/raw/docs/{api-reference/context-providers/AssistantRuntimeProvider.mdx → (reference)/api-reference/context-providers/assistant-runtime-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/context-providers/TextMessagePartProvider.mdx → (reference)/api-reference/context-providers/text-message-part-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-data-stream.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-hook-form.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/vercel-ai-sdk.mdx +2 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/overview.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +327 -0
- package/.docs/raw/docs/{api-reference/primitives/ActionBar.mdx → (reference)/api-reference/primitives/action-bar.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/AssistantIf.mdx → (reference)/api-reference/primitives/assistant-if.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/AssistantModal.mdx → (reference)/api-reference/primitives/assistant-modal.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/Attachment.mdx → (reference)/api-reference/primitives/attachment.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/primitives/BranchPicker.mdx → (reference)/api-reference/primitives/branch-picker.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Composer.mdx → (reference)/api-reference/primitives/composer.mdx} +101 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/primitives/composition.mdx +1 -0
- package/.docs/raw/docs/{api-reference/primitives/Error.mdx → (reference)/api-reference/primitives/error.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/MessagePart.mdx → (reference)/api-reference/primitives/message-part.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/Message.mdx → (reference)/api-reference/primitives/message.mdx} +2 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +221 -0
- package/.docs/raw/docs/{api-reference/primitives/ThreadListItem.mdx → (reference)/api-reference/primitives/thread-list-item.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/ThreadList.mdx → (reference)/api-reference/primitives/thread-list.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Thread.mdx → (reference)/api-reference/primitives/thread.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AssistantRuntime.mdx → (reference)/api-reference/runtimes/assistant-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AttachmentRuntime.mdx → (reference)/api-reference/runtimes/attachment-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ComposerRuntime.mdx → (reference)/api-reference/runtimes/composer-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/MessagePartRuntime.mdx → (reference)/api-reference/runtimes/message-part-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/MessageRuntime.mdx → (reference)/api-reference/runtimes/message-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListItemRuntime.mdx → (reference)/api-reference/runtimes/thread-list-item-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListRuntime.mdx → (reference)/api-reference/runtimes/thread-list-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadRuntime.mdx → (reference)/api-reference/runtimes/thread-runtime.mdx} +3 -5
- package/.docs/raw/docs/{legacy/styled/AssistantModal.mdx → (reference)/legacy/styled/assistant-modal.mdx} +2 -3
- package/.docs/raw/docs/{legacy/styled/Decomposition.mdx → (reference)/legacy/styled/decomposition.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Markdown.mdx → (reference)/legacy/styled/markdown.mdx} +2 -4
- package/.docs/raw/docs/{legacy/styled/Scrollbar.mdx → (reference)/legacy/styled/scrollbar.mdx} +2 -1
- package/.docs/raw/docs/{legacy/styled/ThreadWidth.mdx → (reference)/legacy/styled/thread-width.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Thread.mdx → (reference)/legacy/styled/thread.mdx} +2 -3
- package/.docs/raw/docs/{migrations → (reference)/migrations}/deprecation-policy.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/react-langgraph-v0-7.mdx +1 -2
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-11.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-12.mdx +1 -0
- package/.docs/raw/docs/{react-compatibility.mdx → (reference)/react-compatibility.mdx} +2 -3
- package/.docs/raw/docs/cloud/authorization.mdx +1 -0
- package/.docs/raw/docs/cloud/overview.mdx +1 -0
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +5 -7
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +9 -8
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +2 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +7 -6
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +2 -3
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
- package/.docs/raw/docs/runtimes/custom/local.mdx +12 -8
- package/.docs/raw/docs/runtimes/data-stream.mdx +32 -4
- package/.docs/raw/docs/runtimes/helicone.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +2 -2
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +4 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +1 -0
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +3 -4
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +2 -4
- package/.docs/raw/docs/ui/assistant-modal.mdx +163 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +90 -0
- package/.docs/raw/docs/ui/attachment.mdx +227 -0
- package/.docs/raw/docs/ui/{Markdown.mdx → markdown.mdx} +11 -6
- package/.docs/raw/docs/ui/{Mermaid.mdx → mermaid.mdx} +12 -5
- package/.docs/raw/docs/ui/{PartGrouping.mdx → part-grouping.mdx} +4 -6
- package/.docs/raw/docs/ui/reasoning.mdx +148 -0
- package/.docs/raw/docs/ui/{Scrollbar.mdx → scrollbar.mdx} +9 -1
- package/.docs/raw/docs/ui/sources.mdx +87 -0
- package/.docs/raw/docs/ui/{SyntaxHighlighting.mdx → syntax-highlighting.mdx} +9 -5
- package/.docs/raw/docs/ui/thread-list.mdx +275 -0
- package/.docs/raw/docs/ui/{Thread.mdx → thread.mdx} +5 -6
- package/.docs/raw/docs/ui/tool-fallback.mdx +112 -0
- package/.docs/raw/docs/ui/tool-group.mdx +214 -0
- package/dist/tools/docs.js +1 -1
- package/dist/tools/examples.js +1 -1
- package/dist/tools/examples.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/docs.ts +1 -1
- package/src/tools/examples.ts +1 -1
- package/src/tools/tests/docs.test.ts +18 -16
- package/src/tools/tests/examples.test.ts +5 -5
- package/src/tools/tests/path-traversal.test.ts +3 -3
- package/src/utils/tests/security.test.ts +3 -3
- package/.docs/raw/docs/index.mdx +0 -7
- package/.docs/raw/docs/ui/AssistantModal.mdx +0 -45
- package/.docs/raw/docs/ui/AssistantSidebar.mdx +0 -41
- package/.docs/raw/docs/ui/Attachment.mdx +0 -84
- package/.docs/raw/docs/ui/Reasoning.mdx +0 -152
- package/.docs/raw/docs/ui/ThreadList.mdx +0 -90
- package/.docs/raw/docs/ui/ToolFallback.mdx +0 -63
- package/.docs/raw/docs/ui/ToolGroup.mdx +0 -96
- /package/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Assistant Transport
|
|
3
|
+
description: Stream agent state to the frontend and handle user commands for custom agents.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
6
|
-
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
7
|
-
|
|
8
6
|
If you've built an agent as a Python or TypeScript script and want to add a UI to it, you need to solve two problems: streaming updates to the frontend and integrating with the UI framework. Assistant Transport handles both.
|
|
9
7
|
|
|
10
8
|
Assistant Transport streams your agent's complete state to the frontend in real-time. Unlike traditional approaches that only stream predefined message types (like text or tool calls), it streams your entire agent state—whatever structure your agent uses internally.
|
|
@@ -71,7 +69,8 @@ The backend endpoint receives POST requests with the following payload:
|
|
|
71
69
|
state: T, // The previous state that the frontend has access to
|
|
72
70
|
commands: AssistantTransportCommand[],
|
|
73
71
|
system?: string,
|
|
74
|
-
tools?: ToolDefinition[]
|
|
72
|
+
tools?: ToolDefinition[],
|
|
73
|
+
threadId: string // The current thread/conversation identifier
|
|
75
74
|
}
|
|
76
75
|
```
|
|
77
76
|
|
|
@@ -483,9 +482,11 @@ const runtime = useAssistantTransportRuntime({
|
|
|
483
482
|
"Authorization": `Bearer ${await getAccessToken()}`,
|
|
484
483
|
"X-Request-ID": crypto.randomUUID(),
|
|
485
484
|
}),
|
|
486
|
-
body: {
|
|
485
|
+
body: async () => ({
|
|
487
486
|
customField: "value",
|
|
488
|
-
|
|
487
|
+
requestId: crypto.randomUUID(),
|
|
488
|
+
timestamp: Date.now(),
|
|
489
|
+
}),
|
|
489
490
|
});
|
|
490
491
|
```
|
|
491
492
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Custom Thread List
|
|
3
|
+
description: Plug a custom thread database for multi-thread persistence.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
7
|
-
import { ParametersTable } from "@/components/docs";
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
8
7
|
|
|
9
8
|
## Overview
|
|
10
9
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ExternalStoreRuntime
|
|
3
|
+
description: Bring your own Redux, Zustand, or state manager.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
8
|
-
import { ParametersTable } from "@/components/docs";
|
|
9
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
10
8
|
|
|
11
9
|
## Overview
|
|
12
10
|
|
|
@@ -1618,9 +1616,9 @@ Enable multi-thread support with custom thread management.
|
|
|
1618
1616
|
|
|
1619
1617
|
### Related Runtime APIs
|
|
1620
1618
|
|
|
1621
|
-
- [AssistantRuntime API](/docs/api-reference/runtimes/
|
|
1622
|
-
- [ThreadRuntime API](/docs/api-reference/runtimes/
|
|
1623
|
-
- [Runtime Providers](/docs/api-reference/context-providers/
|
|
1619
|
+
- [AssistantRuntime API](/docs/api-reference/runtimes/assistant-runtime) - Core runtime interface and methods
|
|
1620
|
+
- [ThreadRuntime API](/docs/api-reference/runtimes/thread-runtime) - Thread-specific operations and state management
|
|
1621
|
+
- [Runtime Providers](/docs/api-reference/context-providers/assistant-runtime-provider) - Context providers for runtime integration
|
|
1624
1622
|
|
|
1625
1623
|
## Related Resources
|
|
1626
1624
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LocalRuntime
|
|
3
|
+
description: Quickest path to a working chat. Handles state while you handle the API.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
8
|
-
import { ParametersTable } from "@/components/docs";
|
|
9
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
10
8
|
|
|
11
9
|
## Overview
|
|
12
10
|
|
|
@@ -900,7 +898,7 @@ const OpenAIAdapter: ChatModelAdapter = {
|
|
|
900
898
|
|
|
901
899
|
```tsx
|
|
902
900
|
const CustomAPIAdapter: ChatModelAdapter = {
|
|
903
|
-
async run({ messages, abortSignal }) {
|
|
901
|
+
async run({ messages, abortSignal, unstable_threadId }) {
|
|
904
902
|
const response = await fetch("/api/chat", {
|
|
905
903
|
method: "POST",
|
|
906
904
|
headers: { "Content-Type": "application/json" },
|
|
@@ -909,6 +907,7 @@ const CustomAPIAdapter: ChatModelAdapter = {
|
|
|
909
907
|
role: m.role,
|
|
910
908
|
content: m.content,
|
|
911
909
|
})),
|
|
910
|
+
threadId: unstable_threadId, // Pass thread ID to your backend
|
|
912
911
|
}),
|
|
913
912
|
signal: abortSignal,
|
|
914
913
|
});
|
|
@@ -1124,6 +1123,11 @@ Parameters passed to the `run` function.
|
|
|
1124
1123
|
description: "Additional context including configuration and tools",
|
|
1125
1124
|
required: true,
|
|
1126
1125
|
},
|
|
1126
|
+
{
|
|
1127
|
+
name: "unstable_threadId",
|
|
1128
|
+
type: "string | undefined",
|
|
1129
|
+
description: "The current thread/conversation identifier. Useful for passing to your backend API.",
|
|
1130
|
+
},
|
|
1127
1131
|
]}
|
|
1128
1132
|
/>
|
|
1129
1133
|
|
|
@@ -1253,8 +1257,8 @@ Interface for implementing custom thread list storage.
|
|
|
1253
1257
|
|
|
1254
1258
|
### Related Runtime APIs
|
|
1255
1259
|
|
|
1256
|
-
- [AssistantRuntime API](/docs/api-reference/runtimes/
|
|
1257
|
-
- [ThreadRuntime API](/docs/api-reference/runtimes/
|
|
1260
|
+
- [AssistantRuntime API](/docs/api-reference/runtimes/assistant-runtime) - Core runtime interface and methods
|
|
1261
|
+
- [ThreadRuntime API](/docs/api-reference/runtimes/thread-runtime) - Thread-specific operations and state management
|
|
1258
1262
|
|
|
1259
1263
|
## Related Resources
|
|
1260
1264
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Data Stream Protocol
|
|
3
|
+
description: Integration with data stream protocol endpoints for streaming AI responses.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
7
|
|
|
9
8
|
The `@assistant-ui/react-data-stream` package provides integration with data stream protocol endpoints, enabling streaming AI responses with tool support and state management.
|
|
10
9
|
|
|
@@ -63,7 +62,7 @@ Your backend endpoint should accept POST requests and return data stream respons
|
|
|
63
62
|
import { createAssistantStreamResponse } from "assistant-stream";
|
|
64
63
|
|
|
65
64
|
export async function POST(request: Request) {
|
|
66
|
-
const { messages, tools, system } = await request.json();
|
|
65
|
+
const { messages, tools, system, threadId } = await request.json();
|
|
67
66
|
|
|
68
67
|
return createAssistantStreamResponse(async (controller) => {
|
|
69
68
|
// Process the request with your AI provider
|
|
@@ -81,6 +80,12 @@ export async function POST(request: Request) {
|
|
|
81
80
|
}
|
|
82
81
|
```
|
|
83
82
|
|
|
83
|
+
The request body includes:
|
|
84
|
+
- `messages` - The conversation history
|
|
85
|
+
- `tools` - Available tool definitions
|
|
86
|
+
- `system` - System prompt (if configured)
|
|
87
|
+
- `threadId` - The current thread/conversation identifier
|
|
88
|
+
|
|
84
89
|
</Step>
|
|
85
90
|
|
|
86
91
|
</Steps>
|
|
@@ -114,6 +119,22 @@ const runtime = useDataStreamRuntime({
|
|
|
114
119
|
});
|
|
115
120
|
```
|
|
116
121
|
|
|
122
|
+
### Dynamic Body
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
const runtime = useDataStreamRuntime({
|
|
126
|
+
api: "/api/chat",
|
|
127
|
+
headers: async () => ({
|
|
128
|
+
"Authorization": `Bearer ${await getAuthToken()}`,
|
|
129
|
+
}),
|
|
130
|
+
body: async () => ({
|
|
131
|
+
requestId: crypto.randomUUID(),
|
|
132
|
+
timestamp: Date.now(),
|
|
133
|
+
signature: await computeSignature(),
|
|
134
|
+
}),
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
117
138
|
### Event Callbacks
|
|
118
139
|
|
|
119
140
|
```tsx
|
|
@@ -136,6 +157,13 @@ const runtime = useDataStreamRuntime({
|
|
|
136
157
|
|
|
137
158
|
## Tool Integration
|
|
138
159
|
|
|
160
|
+
<Callout type="warn">
|
|
161
|
+
Human-in-the-loop tools (using `human()` for tool interrupts) are not supported
|
|
162
|
+
in the data stream runtime. If you need human approval workflows or interactive
|
|
163
|
+
tool UIs, consider using [LocalRuntime](/docs/runtimes/custom/local) or
|
|
164
|
+
[Assistant Cloud](/docs/cloud/overview) instead.
|
|
165
|
+
</Callout>
|
|
166
|
+
|
|
139
167
|
### Frontend Tools
|
|
140
168
|
|
|
141
169
|
Use the `frontendTools` helper to serialize client-side tools:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Helicone
|
|
3
|
+
description: Configure Helicone proxy for OpenAI API logging and monitoring.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
Helicone acts as a proxy for your OpenAI API calls, enabling detailed logging and monitoring. To integrate, update your API base URL and add the Helicone-Auth header.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Getting Started
|
|
3
|
+
description: Connect to LangGraph Cloud API for agent workflows with streaming.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
## Requirements
|
|
@@ -10,7 +11,6 @@ The state of the graph you are using must have a `messages` key with a list of L
|
|
|
10
11
|
|
|
11
12
|
## New project from template
|
|
12
13
|
|
|
13
|
-
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
14
14
|
|
|
15
15
|
<Steps>
|
|
16
16
|
<Step>
|
|
@@ -36,7 +36,7 @@ NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id
|
|
|
36
36
|
</Step>
|
|
37
37
|
</Steps>
|
|
38
38
|
|
|
39
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
39
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
40
40
|
|
|
41
41
|
## Installation in existing React project
|
|
42
42
|
|
|
@@ -266,7 +266,7 @@ NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id
|
|
|
266
266
|
|
|
267
267
|
### Setup UI components
|
|
268
268
|
|
|
269
|
-
Follow the [UI Components](/docs/ui/
|
|
269
|
+
Follow the [UI Components](/docs/ui/thread) guide to setup the UI components.
|
|
270
270
|
|
|
271
271
|
</Step>
|
|
272
272
|
</Steps>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Part 3: Approval UI"
|
|
3
|
+
description: Add human-in-the-loop approval for tool calls.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
## Background: LangGraph implementation details
|
|
6
7
|
|
|
7
8
|
import Image from "next/image";
|
|
8
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
9
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
9
10
|
import approval from "./images/stockbroker-langgraph.png";
|
|
10
11
|
|
|
11
12
|
<Image
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: LangChain LangServe
|
|
3
|
+
description: Connect to LangServe endpoints via Vercel AI SDK integration.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
<Callout type="warning">
|
|
@@ -12,8 +13,7 @@ Integration with a LangServe server via Vercel AI SDK.
|
|
|
12
13
|
|
|
13
14
|
## Getting Started
|
|
14
15
|
|
|
15
|
-
import {
|
|
16
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
16
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
17
17
|
|
|
18
18
|
<Steps>
|
|
19
19
|
<Step>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Full-Stack Integration
|
|
3
|
+
description: Integrate Mastra directly into Next.js API routes.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
7
|
|
|
9
8
|
Integrate Mastra directly into your Next.js application's API routes. This approach keeps your backend and frontend code within the same project.
|
|
10
9
|
|
|
@@ -28,7 +27,7 @@ This command installs necessary dependencies and creates basic configuration fil
|
|
|
28
27
|
<Callout title="Need Help?">
|
|
29
28
|
For detailed setup instructions, including adding API keys, basic
|
|
30
29
|
configuration, and manual setup steps, please refer to the main [Getting
|
|
31
|
-
Started guide](/docs
|
|
30
|
+
Started guide](/docs).
|
|
32
31
|
</Callout>
|
|
33
32
|
|
|
34
33
|
</Step>
|
|
@@ -138,7 +137,7 @@ This code creates a new Mastra `Agent` named `chef-agent`.
|
|
|
138
137
|
- `instructions`: Defines the agent's persona and primary goal.
|
|
139
138
|
- `model`: Specifies the language model the agent will use (in this case, OpenAI's GPT-4o Mini via Mastra's model router).
|
|
140
139
|
|
|
141
|
-
Make sure you have set up your OpenAI API key as described in the [Getting Started guide](/docs
|
|
140
|
+
Make sure you have set up your OpenAI API key as described in the [Getting Started guide](/docs).
|
|
142
141
|
|
|
143
142
|
</Step>
|
|
144
143
|
<Step>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Overview
|
|
3
|
+
description: TypeScript agent framework for AI applications with tools and workflows.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
Mastra is an open-source TypeScript agent framework designed to provide the essential primitives for building AI applications. It enables developers to create AI agents with memory and tool-calling capabilities, implement deterministic LLM workflows, and leverage RAG for knowledge integration. With features like model routing, workflow graphs, and automated evals, Mastra provides a complete toolkit for developing, testing, and deploying AI applications.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Separate Server Integration
|
|
3
|
+
description: Run Mastra as a standalone server connected to your frontend.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
|
-
import { InstallCommand } from "@/components/docs/install-command";
|
|
6
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
7
|
|
|
9
8
|
Run Mastra as a standalone server and connect your Next.js frontend (using assistant-ui) to its API endpoints. This approach separates your AI backend from your frontend application, allowing for independent development and scaling.
|
|
10
9
|
|
|
@@ -153,7 +152,7 @@ This command installs the necessary assistant-ui dependencies and sets up basic
|
|
|
153
152
|
<Callout title="Need Help?">
|
|
154
153
|
For detailed setup instructions for assistant-ui, including manual setup
|
|
155
154
|
steps, please refer to the main [Getting Started
|
|
156
|
-
guide](/docs
|
|
155
|
+
guide](/docs).
|
|
157
156
|
</Callout>
|
|
158
157
|
|
|
159
158
|
In the next step, we will configure this frontend to communicate with the separate Mastra server instead of using the default API route.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Picking a Runtime
|
|
3
|
+
description: Which runtime fits your backend? Decision guide for common setups.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
import { Card, Cards } from "fumadocs-ui/components/card";
|
|
6
|
-
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
|
-
|
|
8
6
|
Choosing the right runtime is crucial for your assistant-ui implementation. This guide helps you navigate the options based on your specific needs.
|
|
9
7
|
|
|
10
8
|
## Quick Decision Tree
|
|
@@ -187,7 +185,7 @@ const runtime = useExternalStoreRuntime({
|
|
|
187
185
|
|
|
188
186
|
Explore our implementation examples:
|
|
189
187
|
|
|
190
|
-
- **[AI SDK Example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-ai-sdk)** - Vercel AI SDK with `useChatRuntime`
|
|
188
|
+
- **[AI SDK v6 Example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-ai-sdk-v6)** - Vercel AI SDK with `useChatRuntime`
|
|
191
189
|
- **[External Store Example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-external-store)** - `ExternalStoreRuntime` with custom state
|
|
192
190
|
- **[Assistant Cloud Example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-cloud)** - Multi-thread with cloud persistence
|
|
193
191
|
- **[LangGraph Example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-langgraph)** - Agent workflows
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AssistantModal
|
|
3
|
+
description: Floating chat bubble for support widgets and help desks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
|
+
import { AssistantModalSample } from "@/components/docs/samples/assistant-modal";
|
|
9
|
+
|
|
10
|
+
A floating chat modal built on Radix UI Popover. Ideal for support widgets, help desks, and embedded assistants.
|
|
11
|
+
|
|
12
|
+
<AssistantModalSample />
|
|
13
|
+
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
<Steps>
|
|
17
|
+
<Step>
|
|
18
|
+
|
|
19
|
+
### Add `assistant-modal`
|
|
20
|
+
|
|
21
|
+
<InstallCommand shadcn={["assistant-modal"]} />
|
|
22
|
+
|
|
23
|
+
This adds `/components/assistant-ui/assistant-modal.tsx` to your project, which you can adjust as needed.
|
|
24
|
+
|
|
25
|
+
</Step>
|
|
26
|
+
<Step>
|
|
27
|
+
|
|
28
|
+
### Use in your application
|
|
29
|
+
|
|
30
|
+
```tsx title="/app/page.tsx" {1,6}
|
|
31
|
+
import { AssistantModal } from "@/components/assistant-ui/assistant-modal";
|
|
32
|
+
|
|
33
|
+
export default function Home() {
|
|
34
|
+
return (
|
|
35
|
+
<div className="h-full">
|
|
36
|
+
<AssistantModal />
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</Step>
|
|
43
|
+
</Steps>
|
|
44
|
+
|
|
45
|
+
## Anatomy
|
|
46
|
+
|
|
47
|
+
The AssistantModal component is built with the following primitives:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { AssistantModalPrimitive } from "@assistant-ui/react";
|
|
51
|
+
|
|
52
|
+
<AssistantModalPrimitive.Root>
|
|
53
|
+
<AssistantModalPrimitive.Anchor />
|
|
54
|
+
<AssistantModalPrimitive.Trigger />
|
|
55
|
+
<AssistantModalPrimitive.Content>
|
|
56
|
+
{/* Thread component goes here */}
|
|
57
|
+
</AssistantModalPrimitive.Content>
|
|
58
|
+
</AssistantModalPrimitive.Root>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## API Reference
|
|
62
|
+
|
|
63
|
+
### Root
|
|
64
|
+
|
|
65
|
+
Contains all parts of the modal. Based on Radix UI Popover.
|
|
66
|
+
|
|
67
|
+
<ParametersTable
|
|
68
|
+
type="AssistantModalPrimitiveRootProps"
|
|
69
|
+
parameters={[
|
|
70
|
+
{
|
|
71
|
+
name: "defaultOpen",
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description: "The initial open state when uncontrolled.",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "open",
|
|
77
|
+
type: "boolean",
|
|
78
|
+
description: "The controlled open state.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "onOpenChange",
|
|
82
|
+
type: "(open: boolean) => void",
|
|
83
|
+
description: "Callback when the open state changes.",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "unstable_openOnRunStart",
|
|
87
|
+
type: "boolean",
|
|
88
|
+
description: "Automatically open the modal when the assistant starts running.",
|
|
89
|
+
},
|
|
90
|
+
]}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
### Trigger
|
|
94
|
+
|
|
95
|
+
A button that toggles the modal open/closed state.
|
|
96
|
+
|
|
97
|
+
<ParametersTable
|
|
98
|
+
type="AssistantModalPrimitiveTriggerProps"
|
|
99
|
+
parameters={[
|
|
100
|
+
{
|
|
101
|
+
name: "asChild",
|
|
102
|
+
type: "boolean",
|
|
103
|
+
default: "false",
|
|
104
|
+
description: "Merge props with child element instead of rendering a wrapper button.",
|
|
105
|
+
},
|
|
106
|
+
]}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
This primitive renders a `<button>` element unless `asChild` is set.
|
|
110
|
+
|
|
111
|
+
### Content
|
|
112
|
+
|
|
113
|
+
The popover content container that holds the chat interface.
|
|
114
|
+
|
|
115
|
+
<ParametersTable
|
|
116
|
+
type="AssistantModalPrimitiveContentProps"
|
|
117
|
+
parameters={[
|
|
118
|
+
{
|
|
119
|
+
name: "side",
|
|
120
|
+
type: "'top' | 'right' | 'bottom' | 'left'",
|
|
121
|
+
default: "'top'",
|
|
122
|
+
description: "The preferred side of the anchor to render against.",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "align",
|
|
126
|
+
type: "'start' | 'center' | 'end'",
|
|
127
|
+
default: "'end'",
|
|
128
|
+
description: "The preferred alignment against the anchor.",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "dissmissOnInteractOutside",
|
|
132
|
+
type: "boolean",
|
|
133
|
+
description: "Whether to close the modal when clicking outside.",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "asChild",
|
|
137
|
+
type: "boolean",
|
|
138
|
+
default: "false",
|
|
139
|
+
description: "Merge props with child element instead of rendering a wrapper div.",
|
|
140
|
+
},
|
|
141
|
+
]}
|
|
142
|
+
/>
|
|
143
|
+
|
|
144
|
+
### Anchor
|
|
145
|
+
|
|
146
|
+
An optional anchor element to position the modal relative to.
|
|
147
|
+
|
|
148
|
+
<ParametersTable
|
|
149
|
+
type="AssistantModalPrimitiveAnchorProps"
|
|
150
|
+
parameters={[
|
|
151
|
+
{
|
|
152
|
+
name: "asChild",
|
|
153
|
+
type: "boolean",
|
|
154
|
+
default: "false",
|
|
155
|
+
description: "Merge props with child element instead of rendering a wrapper div.",
|
|
156
|
+
},
|
|
157
|
+
]}
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
## Related Components
|
|
161
|
+
|
|
162
|
+
- [Thread](/docs/ui/thread) - The main chat interface used inside the modal
|
|
163
|
+
- [AssistantSidebar](/docs/ui/assistant-sidebar) - Alternative layout for side panel chat
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AssistantSidebar
|
|
3
|
+
description: Side panel chat for co-pilot experiences and inline assistance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
|
|
7
|
+
import { InstallCommand } from "@/components/docs/fumadocs/install/install-command";
|
|
8
|
+
import { AssistantSidebarSample } from "@/components/docs/samples/assistant-sidebar";
|
|
9
|
+
|
|
10
|
+
A resizable side panel layout with your main content on the left and a Thread chat interface on the right. Ideal for co-pilot experiences and inline assistance.
|
|
11
|
+
|
|
12
|
+
<AssistantSidebarSample />
|
|
13
|
+
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
<Steps>
|
|
17
|
+
<Step>
|
|
18
|
+
|
|
19
|
+
### Add `assistant-sidebar`
|
|
20
|
+
|
|
21
|
+
<InstallCommand shadcn={["assistant-sidebar"]} />
|
|
22
|
+
|
|
23
|
+
This adds `/components/assistant-ui/assistant-sidebar.tsx` to your project, which you can adjust as needed.
|
|
24
|
+
|
|
25
|
+
</Step>
|
|
26
|
+
<Step>
|
|
27
|
+
|
|
28
|
+
### Use in your application
|
|
29
|
+
|
|
30
|
+
```tsx title="/app/page.tsx" {1,6}
|
|
31
|
+
import { AssistantSidebar } from "@/components/assistant-ui/assistant-sidebar";
|
|
32
|
+
|
|
33
|
+
export default function Home() {
|
|
34
|
+
return (
|
|
35
|
+
<div className="h-full">
|
|
36
|
+
<AssistantSidebar>{/* your app */}</AssistantSidebar>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</Step>
|
|
43
|
+
</Steps>
|
|
44
|
+
|
|
45
|
+
## API Reference
|
|
46
|
+
|
|
47
|
+
### AssistantSidebar
|
|
48
|
+
|
|
49
|
+
A layout component that creates a resizable two-panel interface.
|
|
50
|
+
|
|
51
|
+
<ParametersTable
|
|
52
|
+
type="AssistantSidebarProps"
|
|
53
|
+
parameters={[
|
|
54
|
+
{
|
|
55
|
+
name: "children",
|
|
56
|
+
type: "ReactNode",
|
|
57
|
+
description: "Content to display in the left panel (your main application).",
|
|
58
|
+
},
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
The component uses `ResizablePanelGroup` from shadcn/ui internally, creating:
|
|
63
|
+
- **Left panel**: Your application content (passed as `children`)
|
|
64
|
+
- **Right panel**: The Thread chat interface (rendered automatically)
|
|
65
|
+
- **Resize handle**: Draggable divider between panels
|
|
66
|
+
|
|
67
|
+
## Customization
|
|
68
|
+
|
|
69
|
+
Since this component is copied to your project at `/components/assistant-ui/assistant-sidebar.tsx`, you can customize:
|
|
70
|
+
|
|
71
|
+
- Panel default sizes and min/max constraints
|
|
72
|
+
- Resize handle styling
|
|
73
|
+
- Thread component configuration
|
|
74
|
+
|
|
75
|
+
```tsx title="/components/assistant-ui/assistant-sidebar.tsx"
|
|
76
|
+
<ResizablePanelGroup direction="horizontal">
|
|
77
|
+
<ResizablePanel defaultSize={60} minSize={30}>
|
|
78
|
+
{children}
|
|
79
|
+
</ResizablePanel>
|
|
80
|
+
<ResizableHandle withHandle />
|
|
81
|
+
<ResizablePanel defaultSize={40} minSize={20}>
|
|
82
|
+
<Thread />
|
|
83
|
+
</ResizablePanel>
|
|
84
|
+
</ResizablePanelGroup>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Related Components
|
|
88
|
+
|
|
89
|
+
- [Thread](/docs/ui/thread) - The chat interface displayed in the sidebar
|
|
90
|
+
- [AssistantModal](/docs/ui/assistant-modal) - Alternative floating modal layout
|