@assistant-ui/mcp-docs-server 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/code-examples/waterfall.md +1 -1
- package/.docs/organized/code-examples/with-a2a.md +2 -2
- package/.docs/organized/code-examples/with-ag-ui.md +3 -3
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +5 -5
- package/.docs/organized/code-examples/with-artifacts.md +5 -5
- package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
- package/.docs/organized/code-examples/with-chain-of-thought.md +79 -50
- package/.docs/organized/code-examples/with-cloud-standalone.md +4 -4
- package/.docs/organized/code-examples/with-cloud.md +4 -4
- package/.docs/organized/code-examples/with-custom-thread-list.md +56 -11
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +7 -7
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +7 -7
- package/.docs/organized/code-examples/with-expo.md +16 -16
- package/.docs/organized/code-examples/with-external-store.md +2 -2
- package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
- package/.docs/organized/code-examples/with-generative-ui.md +5 -5
- package/.docs/organized/code-examples/with-google-adk.md +4 -4
- package/.docs/organized/code-examples/with-heat-graph.md +1 -1
- package/.docs/organized/code-examples/with-interactables.md +5 -5
- package/.docs/organized/code-examples/with-langchain.md +3 -3
- package/.docs/organized/code-examples/with-langgraph.md +3 -3
- package/.docs/organized/code-examples/with-livekit.md +8 -8
- package/.docs/organized/code-examples/with-opencode.md +99 -54
- package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
- package/.docs/organized/code-examples/with-react-hook-form.md +5 -5
- package/.docs/organized/code-examples/with-react-ink.md +1 -1
- package/.docs/organized/code-examples/with-react-router.md +8 -8
- package/.docs/organized/code-examples/with-store.md +1 -1
- package/.docs/organized/code-examples/with-tanstack.md +5 -5
- package/.docs/organized/code-examples/with-tap-runtime.md +2 -2
- package/.docs/raw/docs/(docs)/cli.mdx +2 -1
- package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
- package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
- package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
- package/.docs/raw/docs/(docs)/index.mdx +1 -0
- package/.docs/raw/docs/(docs)/installation.mdx +1 -0
- package/.docs/raw/docs/(docs)/rtl.mdx +1 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +34 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +41 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +26 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +34 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +31 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +26 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +72 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +41 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +48 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +30 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +23 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +21 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +7 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +65 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +50 -6
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +15 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +36 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +38 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +5 -0
- package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +144 -6
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +230 -2
- package/.docs/raw/docs/cloud/ai-sdk.mdx +221 -3
- package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
- package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +41 -36
- package/.docs/raw/docs/guides/branching.mdx +76 -0
- package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +50 -22
- package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +2 -0
- package/.docs/raw/docs/guides/editing.mdx +102 -0
- package/.docs/raw/docs/guides/index.mdx +103 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +49 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +51 -8
- package/.docs/raw/docs/{(docs)/guides → guides}/mentions.mdx +61 -86
- package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +8 -2
- package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +64 -4
- package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +10 -17
- package/.docs/raw/docs/{(docs)/guides → guides}/slash-commands.mdx +103 -37
- package/.docs/raw/docs/guides/speech.mdx +156 -0
- package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +21 -83
- package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +108 -36
- package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +131 -35
- package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +39 -0
- package/.docs/raw/docs/ink/index.mdx +1 -3
- package/.docs/raw/docs/ink/migration.mdx +1 -3
- package/.docs/raw/docs/ink/primitives.mdx +37 -1
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
- package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
- package/.docs/raw/docs/integrations/gateways/index.mdx +157 -0
- package/.docs/raw/docs/integrations/index.mdx +173 -0
- package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +156 -0
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +146 -0
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
- package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
- package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
- package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
- package/.docs/raw/docs/primitives/attachment.mdx +1 -0
- package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
- package/.docs/raw/docs/primitives/composer.mdx +2 -1
- package/.docs/raw/docs/primitives/error.mdx +1 -0
- package/.docs/raw/docs/primitives/index.mdx +2 -1
- package/.docs/raw/docs/primitives/message.mdx +68 -5
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
- package/.docs/raw/docs/primitives/suggestion.mdx +1 -0
- package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
- package/.docs/raw/docs/primitives/thread.mdx +16 -13
- package/.docs/raw/docs/react-native/index.mdx +1 -3
- package/.docs/raw/docs/react-native/migration.mdx +1 -3
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
- package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
- package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +123 -0
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +71 -131
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +69 -63
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +330 -123
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +323 -0
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +253 -1236
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
- package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
- package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
- package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
- package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
- package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
- package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
- package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +71 -203
- package/.docs/raw/docs/ui/accordion.mdx +1 -0
- package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
- package/.docs/raw/docs/ui/attachment.mdx +1 -0
- package/.docs/raw/docs/ui/badge.mdx +1 -0
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +1 -0
- package/.docs/raw/docs/ui/context-display.mdx +1 -0
- package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
- package/.docs/raw/docs/ui/directive-text.mdx +1 -0
- package/.docs/raw/docs/ui/file.mdx +1 -0
- package/.docs/raw/docs/ui/image.mdx +1 -0
- package/.docs/raw/docs/ui/markdown.mdx +2 -14
- package/.docs/raw/docs/ui/mermaid.mdx +1 -0
- package/.docs/raw/docs/ui/message-timing.mdx +3 -2
- package/.docs/raw/docs/ui/model-selector.mdx +1 -0
- package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
- package/.docs/raw/docs/ui/quote.mdx +1 -0
- package/.docs/raw/docs/ui/reasoning.mdx +66 -33
- package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
- package/.docs/raw/docs/ui/select.mdx +1 -0
- package/.docs/raw/docs/ui/sources.mdx +1 -0
- package/.docs/raw/docs/ui/streamdown.mdx +1 -0
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
- package/.docs/raw/docs/ui/tabs.mdx +1 -0
- package/.docs/raw/docs/ui/thread-list.mdx +17 -0
- package/.docs/raw/docs/ui/thread.mdx +56 -1
- package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
- package/.docs/raw/docs/ui/tool-group.mdx +39 -11
- package/.docs/raw/docs/ui/voice.mdx +1 -0
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
- package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
- package/package.json +3 -3
- package/src/tools/tests/path-traversal.test.ts +1 -1
- package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
- package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
- package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
- package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -314
- package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
- package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
- package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
- package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
- package/.docs/raw/docs/runtimes/langchain/comparison.mdx +0 -60
- package/.docs/raw/docs/runtimes/langchain/index.mdx +0 -210
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -699
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
- package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: Connect to any A2A v1.0 protocol-compliant agent server.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`@assistant-ui/react-a2a` is a runtime adapter for the [A2A (Agent-to-Agent) v1.0 protocol](https://github.com/a2aproject/A2A). Use it when your backend speaks A2A; the adapter handles the wire protocol so you can focus on the UI.
|
|
7
|
+
|
|
8
|
+
## When to use it
|
|
9
|
+
|
|
10
|
+
Pick the A2A runtime when:
|
|
11
|
+
|
|
12
|
+
- You have an A2A v1.0 compatible agent server, or you are building one and want a reference client.
|
|
13
|
+
- You want streaming task state, artifacts, and the protocol's full state machine surfaced in the UI.
|
|
14
|
+
- You need multi-tenant or extension-aware A2A clients.
|
|
15
|
+
|
|
16
|
+
If your backend is not A2A-compliant, see [picking a runtime](/docs/runtimes/pick-a-runtime) for alternatives.
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
`@assistant-ui/react-a2a` is layered on `ExternalStoreRuntime` (see [architecture](/docs/runtimes/concepts/architecture)). Features that ship as runtime adapters (attachments, speech, feedback, history, threads) work the same way they do everywhere else; see [adapters](/docs/runtimes/concepts/adapters).
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
|
|
24
|
+
- An A2A v1.0 compatible agent server.
|
|
25
|
+
- React 18 or 19.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
<PlatformTabs>
|
|
30
|
+
<Tab value="React">
|
|
31
|
+
|
|
32
|
+
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-a2a"]} />
|
|
33
|
+
|
|
34
|
+
</Tab>
|
|
35
|
+
<Tab value="React Native">
|
|
36
|
+
|
|
37
|
+
<InstallCommand expo={["@assistant-ui/react-native", "@assistant-ui/react-a2a"]} />
|
|
38
|
+
|
|
39
|
+
</Tab>
|
|
40
|
+
<Tab value="React Ink">
|
|
41
|
+
|
|
42
|
+
<InstallCommand npm={["@assistant-ui/react-ink", "@assistant-ui/react-a2a", "ink", "react"]} />
|
|
43
|
+
|
|
44
|
+
</Tab>
|
|
45
|
+
</PlatformTabs>
|
|
46
|
+
|
|
47
|
+
## Next
|
|
48
|
+
|
|
49
|
+
<Cards>
|
|
50
|
+
<Card
|
|
51
|
+
title="Quickstart"
|
|
52
|
+
description="Minimal runtime setup with a Thread component."
|
|
53
|
+
href="/docs/runtimes/a2a/quickstart"
|
|
54
|
+
/>
|
|
55
|
+
<Card
|
|
56
|
+
title="Client and hooks"
|
|
57
|
+
description="A2AClient, useA2ARuntime options, hooks reference, task states, artifacts."
|
|
58
|
+
href="/docs/runtimes/a2a/client-and-hooks"
|
|
59
|
+
/>
|
|
60
|
+
</Cards>
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Quickstart
|
|
3
|
+
description: Minimal runtime and Thread setup against an A2A server.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Three steps to a working chat against an A2A server. Assumes you have already installed the package and have an A2A v1.0 server reachable; if not, start at [overview](/docs/runtimes/a2a).
|
|
7
|
+
|
|
8
|
+
<Steps>
|
|
9
|
+
<Step>
|
|
10
|
+
|
|
11
|
+
### Wire up the runtime provider
|
|
12
|
+
|
|
13
|
+
<PlatformTabs>
|
|
14
|
+
<Tab value="React">
|
|
15
|
+
|
|
16
|
+
```tsx title="app/MyRuntimeProvider.tsx"
|
|
17
|
+
"use client";
|
|
18
|
+
|
|
19
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
20
|
+
import { useA2ARuntime } from "@assistant-ui/react-a2a";
|
|
21
|
+
|
|
22
|
+
export function MyRuntimeProvider({
|
|
23
|
+
children,
|
|
24
|
+
}: {
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
}) {
|
|
27
|
+
const runtime = useA2ARuntime({
|
|
28
|
+
baseUrl: "http://localhost:9999",
|
|
29
|
+
});
|
|
30
|
+
return (
|
|
31
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
32
|
+
{children}
|
|
33
|
+
</AssistantRuntimeProvider>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
</Tab>
|
|
39
|
+
<Tab value="React Native">
|
|
40
|
+
|
|
41
|
+
```tsx title="runtime/MyRuntimeProvider.tsx"
|
|
42
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react-native";
|
|
43
|
+
import { useA2ARuntime } from "@assistant-ui/react-a2a";
|
|
44
|
+
|
|
45
|
+
export function MyRuntimeProvider({
|
|
46
|
+
children,
|
|
47
|
+
}: {
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
}) {
|
|
50
|
+
const runtime = useA2ARuntime({
|
|
51
|
+
baseUrl: "http://localhost:9999",
|
|
52
|
+
});
|
|
53
|
+
return (
|
|
54
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
55
|
+
{children}
|
|
56
|
+
</AssistantRuntimeProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</Tab>
|
|
62
|
+
<Tab value="React Ink">
|
|
63
|
+
|
|
64
|
+
```tsx title="runtime/MyRuntimeProvider.tsx"
|
|
65
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react-ink";
|
|
66
|
+
import { useA2ARuntime } from "@assistant-ui/react-a2a";
|
|
67
|
+
|
|
68
|
+
export function MyRuntimeProvider({
|
|
69
|
+
children,
|
|
70
|
+
}: {
|
|
71
|
+
children: React.ReactNode;
|
|
72
|
+
}) {
|
|
73
|
+
const runtime = useA2ARuntime({
|
|
74
|
+
baseUrl: "http://localhost:9999",
|
|
75
|
+
});
|
|
76
|
+
return (
|
|
77
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
78
|
+
{children}
|
|
79
|
+
</AssistantRuntimeProvider>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
</Tab>
|
|
85
|
+
</PlatformTabs>
|
|
86
|
+
|
|
87
|
+
</Step>
|
|
88
|
+
<Step>
|
|
89
|
+
|
|
90
|
+
### Render the Thread
|
|
91
|
+
|
|
92
|
+
<PlatformTabs>
|
|
93
|
+
<Tab value="React">
|
|
94
|
+
|
|
95
|
+
```tsx title="app/page.tsx"
|
|
96
|
+
import { Thread } from "@/components/assistant-ui/thread";
|
|
97
|
+
import { MyRuntimeProvider } from "./MyRuntimeProvider";
|
|
98
|
+
|
|
99
|
+
export default function Page() {
|
|
100
|
+
return (
|
|
101
|
+
<MyRuntimeProvider>
|
|
102
|
+
<Thread />
|
|
103
|
+
</MyRuntimeProvider>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
</Tab>
|
|
109
|
+
<Tab value="React Native">
|
|
110
|
+
|
|
111
|
+
```tsx title="app/index.tsx"
|
|
112
|
+
import { View } from "react-native";
|
|
113
|
+
import { Thread } from "@/components/assistant-ui/thread";
|
|
114
|
+
import { MyRuntimeProvider } from "@/runtime/MyRuntimeProvider";
|
|
115
|
+
|
|
116
|
+
export default function Page() {
|
|
117
|
+
return (
|
|
118
|
+
<MyRuntimeProvider>
|
|
119
|
+
<View style={{ flex: 1 }}>
|
|
120
|
+
<Thread />
|
|
121
|
+
</View>
|
|
122
|
+
</MyRuntimeProvider>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
</Tab>
|
|
128
|
+
<Tab value="React Ink">
|
|
129
|
+
|
|
130
|
+
```tsx title="app.tsx"
|
|
131
|
+
import { Box } from "ink";
|
|
132
|
+
import { Thread } from "./components/thread.js";
|
|
133
|
+
import { MyRuntimeProvider } from "./runtime/MyRuntimeProvider.js";
|
|
134
|
+
|
|
135
|
+
export function App() {
|
|
136
|
+
return (
|
|
137
|
+
<MyRuntimeProvider>
|
|
138
|
+
<Box flexDirection="column">
|
|
139
|
+
<Thread />
|
|
140
|
+
</Box>
|
|
141
|
+
</MyRuntimeProvider>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
</Tab>
|
|
147
|
+
</PlatformTabs>
|
|
148
|
+
|
|
149
|
+
</Step>
|
|
150
|
+
<Step>
|
|
151
|
+
|
|
152
|
+
### Set up UI components
|
|
153
|
+
|
|
154
|
+
<PlatformTabs>
|
|
155
|
+
<Tab value="React">
|
|
156
|
+
|
|
157
|
+
Follow the [UI Components guide](/docs/ui/thread) to wire up the Thread, composer, and supporting primitives.
|
|
158
|
+
|
|
159
|
+
</Tab>
|
|
160
|
+
<Tab value="React Native">
|
|
161
|
+
|
|
162
|
+
Follow the [React Native setup](/docs/react-native) to add a native Thread, composer, and supporting primitives.
|
|
163
|
+
|
|
164
|
+
</Tab>
|
|
165
|
+
<Tab value="React Ink">
|
|
166
|
+
|
|
167
|
+
Follow the [Ink setup](/docs/ink) to add a terminal Thread, composer, and supporting primitives.
|
|
168
|
+
|
|
169
|
+
</Tab>
|
|
170
|
+
</PlatformTabs>
|
|
171
|
+
|
|
172
|
+
</Step>
|
|
173
|
+
</Steps>
|
|
174
|
+
|
|
175
|
+
Once your A2A server is reachable, the runtime negotiates streaming vs non-streaming based on the agent card's `capabilities.streaming` flag and starts forwarding messages.
|
|
176
|
+
|
|
177
|
+
## Auth and headers
|
|
178
|
+
|
|
179
|
+
Pass static or dynamic headers when your server expects auth:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
const runtime = useA2ARuntime({
|
|
183
|
+
baseUrl: "http://localhost:9999",
|
|
184
|
+
headers: async () => ({
|
|
185
|
+
Authorization: `Bearer ${await getAccessToken()}`,
|
|
186
|
+
}),
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Adding adapters
|
|
191
|
+
|
|
192
|
+
Attachments, speech, feedback, history, and a custom thread list are all supported via the standard adapter slots. See [adapters](/docs/runtimes/concepts/adapters) for the contracts; pass them on `useA2ARuntime`:
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
const runtime = useA2ARuntime({
|
|
196
|
+
baseUrl: "http://localhost:9999",
|
|
197
|
+
adapters: { attachments, history, speech, feedback },
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
For multi-thread, see [threads](/docs/runtimes/concepts/threads) and pass `adapters.threadList`.
|
|
202
|
+
|
|
203
|
+
## Next
|
|
204
|
+
|
|
205
|
+
<Cards>
|
|
206
|
+
<Card
|
|
207
|
+
title="Client and hooks"
|
|
208
|
+
description="A2AClient, useA2ARuntime options, hooks reference, task states, artifacts."
|
|
209
|
+
href="/docs/runtimes/a2a/client-and-hooks"
|
|
210
|
+
/>
|
|
211
|
+
<Card
|
|
212
|
+
title="Pick a runtime"
|
|
213
|
+
description="Compare A2A to other runtime options."
|
|
214
|
+
href="/docs/runtimes/pick-a-runtime"
|
|
215
|
+
/>
|
|
216
|
+
</Cards>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: Connect to AG-UI (Agent-User Interaction) protocol agents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`@assistant-ui/react-ag-ui` is a runtime adapter for the [AG-UI (Agent-User Interaction) protocol](https://github.com/ag-ui-protocol/ag-ui). It lets your assistant-ui frontend speak to any AG-UI-compliant agent server, including CopilotKit-based backends.
|
|
7
|
+
|
|
8
|
+
## When to use it
|
|
9
|
+
|
|
10
|
+
Pick the AG-UI runtime when:
|
|
11
|
+
|
|
12
|
+
- Your backend implements the AG-UI protocol (e.g. CopilotKit agents, custom AG-UI servers).
|
|
13
|
+
- You want streaming text, thinking events, reasoning events, tool calls, and state snapshots in one protocol.
|
|
14
|
+
- You need agent-side state synchronization via `STATE_SNAPSHOT` and `STATE_DELTA` events.
|
|
15
|
+
|
|
16
|
+
If your backend is not AG-UI-compliant, see [picking a runtime](/docs/runtimes/pick-a-runtime) for alternatives.
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
`@assistant-ui/react-ag-ui` is layered on `ExternalStoreRuntime` (see [architecture](/docs/runtimes/concepts/architecture)). The runtime owns AG-UI event parsing and message reconstruction; you provide an `HttpAgent` from `@ag-ui/client` and the adapter handles the wire protocol.
|
|
21
|
+
|
|
22
|
+
Shared adapters (attachments, speech, dictation, feedback, history) work the same way described in [adapters](/docs/runtimes/concepts/adapters).
|
|
23
|
+
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- An AG-UI-compatible agent server.
|
|
27
|
+
- React 18 or 19.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
<PlatformTabs>
|
|
32
|
+
<Tab value="React">
|
|
33
|
+
|
|
34
|
+
<InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ag-ui", "@ag-ui/client"]} />
|
|
35
|
+
|
|
36
|
+
</Tab>
|
|
37
|
+
<Tab value="React Native">
|
|
38
|
+
|
|
39
|
+
<InstallCommand expo={["@assistant-ui/react-native", "@assistant-ui/react-ag-ui", "@ag-ui/client"]} />
|
|
40
|
+
|
|
41
|
+
</Tab>
|
|
42
|
+
<Tab value="React Ink">
|
|
43
|
+
|
|
44
|
+
<InstallCommand npm={["@assistant-ui/react-ink", "@assistant-ui/react-ag-ui", "@ag-ui/client", "ink", "react"]} />
|
|
45
|
+
|
|
46
|
+
</Tab>
|
|
47
|
+
</PlatformTabs>
|
|
48
|
+
|
|
49
|
+
## Example
|
|
50
|
+
|
|
51
|
+
[`examples/with-ag-ui`](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-ag-ui) shows a complete reference implementation. Or scaffold one directly:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npx assistant-ui@latest create my-app -e with-ag-ui
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Next
|
|
58
|
+
|
|
59
|
+
<Cards>
|
|
60
|
+
<Card
|
|
61
|
+
title="Quickstart"
|
|
62
|
+
description="Minimal HttpAgent + useAgUiRuntime setup."
|
|
63
|
+
href="/docs/runtimes/ag-ui/quickstart"
|
|
64
|
+
/>
|
|
65
|
+
<Card
|
|
66
|
+
title="Runtime options"
|
|
67
|
+
description="useAgUiRuntime options, adapters, events, thread list."
|
|
68
|
+
href="/docs/runtimes/ag-ui/runtime-options"
|
|
69
|
+
/>
|
|
70
|
+
</Cards>
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Quickstart
|
|
3
|
+
description: Minimal HttpAgent + useAgUiRuntime setup against an AG-UI server.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Three steps to a working chat against an AG-UI agent. Assumes you have already installed the package and have an AG-UI server reachable; if not, start at [overview](/docs/runtimes/ag-ui).
|
|
7
|
+
|
|
8
|
+
<Steps>
|
|
9
|
+
<Step>
|
|
10
|
+
|
|
11
|
+
### Wire up the runtime provider
|
|
12
|
+
|
|
13
|
+
Create an `HttpAgent` pointing at your AG-UI endpoint and pass it to `useAgUiRuntime`:
|
|
14
|
+
|
|
15
|
+
<PlatformTabs>
|
|
16
|
+
<Tab value="React">
|
|
17
|
+
|
|
18
|
+
```tsx title="app/MyRuntimeProvider.tsx"
|
|
19
|
+
"use client";
|
|
20
|
+
|
|
21
|
+
import { useMemo } from "react";
|
|
22
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
|
23
|
+
import { useAgUiRuntime } from "@assistant-ui/react-ag-ui";
|
|
24
|
+
import { HttpAgent } from "@ag-ui/client";
|
|
25
|
+
|
|
26
|
+
export function MyRuntimeProvider({
|
|
27
|
+
children,
|
|
28
|
+
}: {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}) {
|
|
31
|
+
const agent = useMemo(
|
|
32
|
+
() =>
|
|
33
|
+
new HttpAgent({
|
|
34
|
+
url: "http://localhost:8000/agent",
|
|
35
|
+
}),
|
|
36
|
+
[],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const runtime = useAgUiRuntime({ agent });
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
43
|
+
{children}
|
|
44
|
+
</AssistantRuntimeProvider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
</Tab>
|
|
50
|
+
<Tab value="React Native">
|
|
51
|
+
|
|
52
|
+
```tsx title="runtime/MyRuntimeProvider.tsx"
|
|
53
|
+
import { useMemo } from "react";
|
|
54
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react-native";
|
|
55
|
+
import { useAgUiRuntime } from "@assistant-ui/react-ag-ui";
|
|
56
|
+
import { HttpAgent } from "@ag-ui/client";
|
|
57
|
+
|
|
58
|
+
export function MyRuntimeProvider({
|
|
59
|
+
children,
|
|
60
|
+
}: {
|
|
61
|
+
children: React.ReactNode;
|
|
62
|
+
}) {
|
|
63
|
+
const agent = useMemo(
|
|
64
|
+
() =>
|
|
65
|
+
new HttpAgent({
|
|
66
|
+
url: "http://localhost:8000/agent",
|
|
67
|
+
}),
|
|
68
|
+
[],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const runtime = useAgUiRuntime({ agent });
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
75
|
+
{children}
|
|
76
|
+
</AssistantRuntimeProvider>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
</Tab>
|
|
82
|
+
<Tab value="React Ink">
|
|
83
|
+
|
|
84
|
+
```tsx title="runtime/MyRuntimeProvider.tsx"
|
|
85
|
+
import { useMemo } from "react";
|
|
86
|
+
import { AssistantRuntimeProvider } from "@assistant-ui/react-ink";
|
|
87
|
+
import { useAgUiRuntime } from "@assistant-ui/react-ag-ui";
|
|
88
|
+
import { HttpAgent } from "@ag-ui/client";
|
|
89
|
+
|
|
90
|
+
export function MyRuntimeProvider({
|
|
91
|
+
children,
|
|
92
|
+
}: {
|
|
93
|
+
children: React.ReactNode;
|
|
94
|
+
}) {
|
|
95
|
+
const agent = useMemo(
|
|
96
|
+
() =>
|
|
97
|
+
new HttpAgent({
|
|
98
|
+
url: "http://localhost:8000/agent",
|
|
99
|
+
}),
|
|
100
|
+
[],
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const runtime = useAgUiRuntime({ agent });
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<AssistantRuntimeProvider runtime={runtime}>
|
|
107
|
+
{children}
|
|
108
|
+
</AssistantRuntimeProvider>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
</Tab>
|
|
114
|
+
</PlatformTabs>
|
|
115
|
+
|
|
116
|
+
</Step>
|
|
117
|
+
<Step>
|
|
118
|
+
|
|
119
|
+
### Render the Thread
|
|
120
|
+
|
|
121
|
+
<PlatformTabs>
|
|
122
|
+
<Tab value="React">
|
|
123
|
+
|
|
124
|
+
```tsx title="app/page.tsx"
|
|
125
|
+
import { Thread } from "@/components/assistant-ui/thread";
|
|
126
|
+
import { MyRuntimeProvider } from "./MyRuntimeProvider";
|
|
127
|
+
|
|
128
|
+
export default function Page() {
|
|
129
|
+
return (
|
|
130
|
+
<MyRuntimeProvider>
|
|
131
|
+
<Thread />
|
|
132
|
+
</MyRuntimeProvider>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
</Tab>
|
|
138
|
+
<Tab value="React Native">
|
|
139
|
+
|
|
140
|
+
```tsx title="app/index.tsx"
|
|
141
|
+
import { View } from "react-native";
|
|
142
|
+
import { Thread } from "@/components/assistant-ui/thread";
|
|
143
|
+
import { MyRuntimeProvider } from "@/runtime/MyRuntimeProvider";
|
|
144
|
+
|
|
145
|
+
export default function Page() {
|
|
146
|
+
return (
|
|
147
|
+
<MyRuntimeProvider>
|
|
148
|
+
<View style={{ flex: 1 }}>
|
|
149
|
+
<Thread />
|
|
150
|
+
</View>
|
|
151
|
+
</MyRuntimeProvider>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
</Tab>
|
|
157
|
+
<Tab value="React Ink">
|
|
158
|
+
|
|
159
|
+
```tsx title="app.tsx"
|
|
160
|
+
import { Box } from "ink";
|
|
161
|
+
import { Thread } from "./components/thread.js";
|
|
162
|
+
import { MyRuntimeProvider } from "./runtime/MyRuntimeProvider.js";
|
|
163
|
+
|
|
164
|
+
export function App() {
|
|
165
|
+
return (
|
|
166
|
+
<MyRuntimeProvider>
|
|
167
|
+
<Box flexDirection="column">
|
|
168
|
+
<Thread />
|
|
169
|
+
</Box>
|
|
170
|
+
</MyRuntimeProvider>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
</Tab>
|
|
176
|
+
</PlatformTabs>
|
|
177
|
+
|
|
178
|
+
</Step>
|
|
179
|
+
<Step>
|
|
180
|
+
|
|
181
|
+
### Set up UI components
|
|
182
|
+
|
|
183
|
+
<PlatformTabs>
|
|
184
|
+
<Tab value="React">
|
|
185
|
+
|
|
186
|
+
Follow the [UI Components guide](/docs/ui/thread) to wire up the Thread, composer, and supporting primitives.
|
|
187
|
+
|
|
188
|
+
</Tab>
|
|
189
|
+
<Tab value="React Native">
|
|
190
|
+
|
|
191
|
+
Follow the [React Native setup](/docs/react-native) to add a native Thread, composer, and supporting primitives.
|
|
192
|
+
|
|
193
|
+
</Tab>
|
|
194
|
+
<Tab value="React Ink">
|
|
195
|
+
|
|
196
|
+
Follow the [Ink setup](/docs/ink) to add a terminal Thread, composer, and supporting primitives.
|
|
197
|
+
|
|
198
|
+
</Tab>
|
|
199
|
+
</PlatformTabs>
|
|
200
|
+
|
|
201
|
+
</Step>
|
|
202
|
+
</Steps>
|
|
203
|
+
|
|
204
|
+
Once your AG-UI server is reachable, the runtime parses incoming events (`TEXT_MESSAGE_*`, `TOOL_CALL_*`, `STATE_SNAPSHOT`, etc.) into assistant-ui messages.
|
|
205
|
+
|
|
206
|
+
## Showing thinking and reasoning
|
|
207
|
+
|
|
208
|
+
`showThinking` (default `true`) controls whether `THINKING_*` and `REASONING_*` events render as visible reasoning in the UI:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
const runtime = useAgUiRuntime({
|
|
212
|
+
agent,
|
|
213
|
+
showThinking: false, // hide thinking blocks
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Adding adapters
|
|
218
|
+
|
|
219
|
+
Attachments, speech, dictation, feedback, history, and a custom thread list are supported via the standard adapter slots. See [adapters](/docs/runtimes/concepts/adapters):
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
const runtime = useAgUiRuntime({
|
|
223
|
+
agent,
|
|
224
|
+
adapters: { attachments, history, speech, feedback },
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
For multi-thread, pass `adapters.threadList` (experimental); see [runtime options](/docs/runtimes/ag-ui/runtime-options#thread-list-experimental).
|
|
229
|
+
|
|
230
|
+
## Next
|
|
231
|
+
|
|
232
|
+
<Cards>
|
|
233
|
+
<Card
|
|
234
|
+
title="Runtime options"
|
|
235
|
+
description="useAgUiRuntime options, adapters, events, thread list."
|
|
236
|
+
href="/docs/runtimes/ag-ui/runtime-options"
|
|
237
|
+
/>
|
|
238
|
+
<Card
|
|
239
|
+
title="Pick a runtime"
|
|
240
|
+
description="Compare AG-UI to other runtime options."
|
|
241
|
+
href="/docs/runtimes/pick-a-runtime"
|
|
242
|
+
/>
|
|
243
|
+
</Cards>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Runtime options
|
|
3
|
+
description: useAgUiRuntime options, adapters, supported events, thread list.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { AguiIcon } from "@/components/icons/agui";
|
|
7
|
+
|
|
8
|
+
Reference for the runtime's API surface. Start with [quickstart](/docs/runtimes/ag-ui/quickstart) if you have not already.
|
|
9
|
+
|
|
10
|
+
## useAgUiRuntime options
|
|
11
|
+
|
|
12
|
+
| Option | Type | Description |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| `agent` | `HttpAgent` | An AG-UI client agent (from `@ag-ui/client`). Required. |
|
|
15
|
+
| `logger` | `Partial<Logger>` | Optional logger overrides. The runtime logs event-parser warnings and run lifecycle events. |
|
|
16
|
+
| `showThinking` | `boolean` | Whether to render `THINKING_*` and `REASONING_*` events as visible reasoning. Defaults to `true`. |
|
|
17
|
+
| `onError` | `(e: Error) => void` | Error callback fired on `RUN_ERROR` events and protocol errors. |
|
|
18
|
+
| `onCancel` | `() => void` | Cancellation callback fired when the user cancels a run. |
|
|
19
|
+
| `adapters` | `UseAgUiRuntimeAdapters` | Standard adapter slots (see below). |
|
|
20
|
+
|
|
21
|
+
## Adapter slots
|
|
22
|
+
|
|
23
|
+
| Adapter | Slot | Notes |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| Attachments | `adapters.attachments` | See [attachment adapter](/docs/runtimes/concepts/adapters#attachment-adapter). |
|
|
26
|
+
| Speech | `adapters.speech` | Text-to-speech. See [speech adapter](/docs/runtimes/concepts/adapters#speech-adapter). |
|
|
27
|
+
| Dictation | `adapters.dictation` | Speech-to-text input. |
|
|
28
|
+
| Feedback | `adapters.feedback` | Thumbs up / down. See [feedback adapter](/docs/runtimes/concepts/adapters#feedback-adapter). |
|
|
29
|
+
| History | `adapters.history` | Per-thread message persistence. |
|
|
30
|
+
| Thread list | `adapters.threadList` | Multi-thread switching (experimental, see below). |
|
|
31
|
+
|
|
32
|
+
## Thread list (experimental)
|
|
33
|
+
|
|
34
|
+
<Callout type="warn">
|
|
35
|
+
The thread list adapter is currently experimental and may change without notice.
|
|
36
|
+
</Callout>
|
|
37
|
+
|
|
38
|
+
`UseAgUiThreadListAdapter` lets you back the thread list with your own state.
|
|
39
|
+
|
|
40
|
+
| Option | Type | Description |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `threadId` | `string` | The currently active thread ID. |
|
|
43
|
+
| `onSwitchToNewThread` | `() => Promise<void>` | Called when the user creates a new thread. Reset your thread state here. |
|
|
44
|
+
| `onSwitchToThread` | `(threadId: string) => Promise<{ messages, state? }>` | Called when the user switches threads. Return the persisted messages (and optional opaque state). |
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
const runtime = useAgUiRuntime({
|
|
48
|
+
agent,
|
|
49
|
+
adapters: {
|
|
50
|
+
threadList: {
|
|
51
|
+
threadId: currentThreadId,
|
|
52
|
+
onSwitchToNewThread: async () => {
|
|
53
|
+
setCurrentThreadId(await createThread());
|
|
54
|
+
},
|
|
55
|
+
onSwitchToThread: async (id) => {
|
|
56
|
+
const { messages, state } = await loadThread(id);
|
|
57
|
+
setCurrentThreadId(id);
|
|
58
|
+
return { messages, state };
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Supported events
|
|
66
|
+
|
|
67
|
+
The runtime parses the AG-UI event stream and maps each event type to assistant-ui state.
|
|
68
|
+
|
|
69
|
+
| Event | Effect |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `RUN_STARTED` / `RUN_FINISHED` | Toggles thread `isRunning`. |
|
|
72
|
+
| `RUN_CANCELLED` | Marks the in-flight assistant message as cancelled. |
|
|
73
|
+
| `RUN_ERROR` | Marks the message as errored; fires `onError`. |
|
|
74
|
+
| `TEXT_MESSAGE_START` / `_CONTENT` / `_END` | Streams text content into an assistant message. |
|
|
75
|
+
| `TEXT_MESSAGE_CHUNK` | Appends a delta without explicit lifecycle. |
|
|
76
|
+
| `THINKING_START` / `_END` | Wraps reasoning blocks (when `showThinking` is on). |
|
|
77
|
+
| `THINKING_TEXT_MESSAGE_*` | Streams thinking text deltas. |
|
|
78
|
+
| `REASONING_START` / `_MESSAGE_*` / `_END` | Streams structured reasoning per message. |
|
|
79
|
+
| `TOOL_CALL_START` / `_ARGS` / `_END` | Streams tool calls into the current assistant message. |
|
|
80
|
+
| `TOOL_CALL_CHUNK` | Streams tool deltas without explicit lifecycle. |
|
|
81
|
+
| `TOOL_CALL_RESULT` | Attaches a tool result to a tool call. |
|
|
82
|
+
| `STATE_SNAPSHOT` | Replaces the agent's external state. |
|
|
83
|
+
| `STATE_DELTA` | Applies a JSON-patch-style delta to the agent's state. |
|
|
84
|
+
| `MESSAGES_SNAPSHOT` | Replaces the full message list (used for thread restore). |
|
|
85
|
+
| `CUSTOM` | Forwarded to your custom event handling. |
|
|
86
|
+
| `RAW` | Untyped passthrough for unrecognized events. |
|
|
87
|
+
|
|
88
|
+
## Feature support
|
|
89
|
+
|
|
90
|
+
| Feature | Supported |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| Streaming text | Yes |
|
|
93
|
+
| Thinking / reasoning blocks | Yes |
|
|
94
|
+
| Tool calls and results | Yes |
|
|
95
|
+
| Tool result handoff (client-side execution) | Yes |
|
|
96
|
+
| State snapshots and deltas | Yes |
|
|
97
|
+
| Cancellation | Yes |
|
|
98
|
+
| Message editing | Yes |
|
|
99
|
+
| Message reload | Yes |
|
|
100
|
+
| Run resumption | Yes |
|
|
101
|
+
| Multi-thread | Experimental (`adapters.threadList`) |
|
|
102
|
+
| History persistence | Via [history adapter](/docs/runtimes/concepts/adapters#history-adapter) |
|
|
103
|
+
|
|
104
|
+
## Related
|
|
105
|
+
|
|
106
|
+
<Cards>
|
|
107
|
+
<Card
|
|
108
|
+
icon={<AguiIcon width={20} height={20} />}
|
|
109
|
+
title="AG-UI overview"
|
|
110
|
+
description="What AG-UI is and when to pick it."
|
|
111
|
+
href="/docs/runtimes/ag-ui"
|
|
112
|
+
/>
|
|
113
|
+
<Card
|
|
114
|
+
title="Quickstart"
|
|
115
|
+
description="Minimal runtime + Thread setup."
|
|
116
|
+
href="/docs/runtimes/ag-ui/quickstart"
|
|
117
|
+
/>
|
|
118
|
+
<Card
|
|
119
|
+
title="Adapters"
|
|
120
|
+
description="Attachments, speech, feedback, history, thread list."
|
|
121
|
+
href="/docs/runtimes/concepts/adapters"
|
|
122
|
+
/>
|
|
123
|
+
</Cards>
|