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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/.docs/organized/code-examples/waterfall.md +15 -7
  2. package/.docs/organized/code-examples/with-a2a.md +9 -21
  3. package/.docs/organized/code-examples/with-ag-ui.md +11 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +10 -10
  5. package/.docs/organized/code-examples/with-artifacts.md +12 -10
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -12
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +83 -54
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +14 -11
  9. package/.docs/organized/code-examples/with-cloud.md +9 -10
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +61 -16
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +17 -12
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +13 -13
  13. package/.docs/organized/code-examples/with-expo.md +25 -21
  14. package/.docs/organized/code-examples/with-external-store.md +8 -8
  15. package/.docs/organized/code-examples/with-ffmpeg.md +17 -12
  16. package/.docs/organized/code-examples/with-generative-ui.md +9 -9
  17. package/.docs/organized/code-examples/with-google-adk.md +8 -8
  18. package/.docs/organized/code-examples/with-heat-graph.md +5 -5
  19. package/.docs/organized/code-examples/with-interactables.md +10 -25
  20. package/.docs/organized/code-examples/with-langchain.md +437 -0
  21. package/.docs/organized/code-examples/with-langgraph.md +16 -16
  22. package/.docs/organized/code-examples/with-livekit.md +18 -13
  23. package/.docs/organized/code-examples/with-opencode.md +105 -62
  24. package/.docs/organized/code-examples/with-parent-id-grouping.md +10 -10
  25. package/.docs/organized/code-examples/with-react-hook-form.md +220 -148
  26. package/.docs/organized/code-examples/with-react-ink.md +2 -2
  27. package/.docs/organized/code-examples/with-react-router.md +12 -12
  28. package/.docs/organized/code-examples/with-store.md +8 -5
  29. package/.docs/organized/code-examples/with-tanstack.md +10 -10
  30. package/.docs/organized/code-examples/with-tap-runtime.md +10 -6
  31. package/.docs/raw/docs/(docs)/cli.mdx +2 -1
  32. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  33. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  34. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  35. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  36. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  38. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  39. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/index.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/installation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/rtl.mdx +80 -0
  43. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +34 -0
  44. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +41 -0
  45. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +26 -0
  46. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +34 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +31 -0
  48. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +26 -0
  50. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +72 -0
  51. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +41 -0
  52. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +48 -0
  53. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +30 -0
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +23 -0
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +21 -0
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +7 -0
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +149 -40
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +65 -0
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +2 -0
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +50 -6
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +15 -0
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +36 -1
  63. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +38 -0
  64. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +9 -0
  65. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +144 -6
  66. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +231 -3
  67. package/.docs/raw/docs/cloud/ai-sdk.mdx +221 -3
  68. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  69. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +41 -36
  70. package/.docs/raw/docs/guides/branching.mdx +76 -0
  71. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  72. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +50 -22
  73. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +2 -0
  74. package/.docs/raw/docs/guides/editing.mdx +102 -0
  75. package/.docs/raw/docs/guides/index.mdx +103 -0
  76. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +49 -0
  77. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +51 -8
  78. package/.docs/raw/docs/guides/mentions.mdx +520 -0
  79. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +8 -2
  80. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +64 -4
  81. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +10 -17
  82. package/.docs/raw/docs/guides/slash-commands.mdx +361 -0
  83. package/.docs/raw/docs/guides/speech.mdx +156 -0
  84. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +21 -83
  85. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +108 -36
  86. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +131 -35
  87. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +39 -0
  88. package/.docs/raw/docs/ink/index.mdx +1 -3
  89. package/.docs/raw/docs/ink/migration.mdx +1 -3
  90. package/.docs/raw/docs/ink/primitives.mdx +37 -1
  91. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  92. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  93. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  94. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  95. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  96. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  97. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  98. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  99. package/.docs/raw/docs/integrations/gateways/index.mdx +157 -0
  100. package/.docs/raw/docs/integrations/index.mdx +173 -0
  101. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  102. package/.docs/raw/docs/integrations/observability/langfuse.mdx +156 -0
  103. package/.docs/raw/docs/integrations/observability/langsmith.mdx +146 -0
  104. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  105. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  106. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  107. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  108. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  109. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  110. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  111. package/.docs/raw/docs/primitives/composer.mdx +96 -63
  112. package/.docs/raw/docs/primitives/error.mdx +1 -0
  113. package/.docs/raw/docs/primitives/index.mdx +2 -1
  114. package/.docs/raw/docs/primitives/message.mdx +68 -5
  115. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  116. package/.docs/raw/docs/primitives/suggestion.mdx +1 -0
  117. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  118. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  119. package/.docs/raw/docs/react-native/index.mdx +1 -3
  120. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  121. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  122. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  123. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  124. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  125. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  126. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +123 -0
  127. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  128. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +71 -131
  129. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +69 -63
  130. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +365 -101
  131. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  132. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  133. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  134. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  135. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  136. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +323 -0
  137. package/.docs/raw/docs/runtimes/custom/external-store.mdx +253 -1236
  138. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  139. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  140. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  141. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  142. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  143. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  144. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  145. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  146. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  147. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  148. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  149. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  150. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  151. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  152. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  153. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  154. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  155. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  156. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  157. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +74 -198
  158. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  159. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  160. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  161. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  162. package/.docs/raw/docs/ui/badge.mdx +1 -0
  163. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +200 -0
  164. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  165. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  166. package/.docs/raw/docs/ui/directive-text.mdx +114 -0
  167. package/.docs/raw/docs/ui/file.mdx +1 -0
  168. package/.docs/raw/docs/ui/image.mdx +1 -0
  169. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  170. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  171. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  172. package/.docs/raw/docs/ui/model-selector.mdx +1 -0
  173. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  174. package/.docs/raw/docs/ui/quote.mdx +1 -0
  175. package/.docs/raw/docs/ui/reasoning.mdx +69 -32
  176. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  177. package/.docs/raw/docs/ui/select.mdx +1 -0
  178. package/.docs/raw/docs/ui/sources.mdx +1 -0
  179. package/.docs/raw/docs/ui/streamdown.mdx +1 -0
  180. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  181. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  182. package/.docs/raw/docs/ui/thread-list.mdx +17 -0
  183. package/.docs/raw/docs/ui/thread.mdx +56 -1
  184. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  185. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  186. package/.docs/raw/docs/ui/voice.mdx +1 -0
  187. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  188. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  189. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  190. package/dist/utils/logger.js +1 -1
  191. package/dist/utils/logger.js.map +1 -1
  192. package/package.json +4 -4
  193. package/src/tools/tests/path-traversal.test.ts +1 -1
  194. package/src/utils/logger.ts +1 -1
  195. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  196. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  197. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  198. package/.docs/raw/docs/(docs)/guides/mentions.mdx +0 -406
  199. package/.docs/raw/docs/(docs)/guides/slash-commands.mdx +0 -275
  200. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  201. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  202. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  203. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -268
  204. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  205. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  206. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  207. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  208. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -607
  209. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  210. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  211. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  212. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  213. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
  214. package/.docs/raw/docs/ui/mention.mdx +0 -168
@@ -0,0 +1,396 @@
1
+ ---
2
+ title: Client and hooks
3
+ description: A2AClient, useA2ARuntime options, hooks, task states, artifacts, errors.
4
+ ---
5
+
6
+ import { Network } from "lucide-react";
7
+
8
+ Deep dive on the runtime's API surface. Start with [overview](/docs/runtimes/a2a) and [quickstart](/docs/runtimes/a2a/quickstart) if you have not already.
9
+
10
+ ## A2AClient
11
+
12
+ The built-in `A2AClient` handles all communication with the A2A server: JSON serialization, SSE streaming, ProtoJSON enum normalization, and structured error handling.
13
+
14
+ ```ts
15
+ import { A2AClient } from "@assistant-ui/react-a2a";
16
+
17
+ const client = new A2AClient({
18
+ baseUrl: "https://my-agent.example.com",
19
+ headers: { Authorization: "Bearer <token>" },
20
+ tenant: "my-org",
21
+ extensions: ["urn:a2a:ext:my-extension"],
22
+ });
23
+ ```
24
+
25
+ Pass a pre-built client to `useA2ARuntime`:
26
+
27
+ ```tsx
28
+ const runtime = useA2ARuntime({ client });
29
+ ```
30
+
31
+ ### Client options
32
+
33
+ | Option | Type | Description |
34
+ | --- | --- | --- |
35
+ | `baseUrl` | `string` | Base URL of the A2A server. |
36
+ | `basePath` | `string` | Optional path prefix for API endpoints (e.g. `"/v1"`). Does not affect agent card discovery. |
37
+ | `headers` | `Record<string, string>` or `() => Record<string, string>` | Static or dynamic headers (e.g. for auth tokens). |
38
+ | `tenant` | `string` | Tenant ID for multi-tenant servers (prepended to URL paths). |
39
+ | `extensions` | `string[]` | Extension URIs to negotiate via `A2A-Extensions` header. |
40
+
41
+ ### Client methods
42
+
43
+ | Method | Description |
44
+ | --- | --- |
45
+ | `sendMessage(message, configuration?, metadata?)` | Send a message (non-streaming). |
46
+ | `streamMessage(message, configuration?, metadata?)` | Send a message with SSE streaming. |
47
+ | `getTask(taskId, historyLength?)` | Get a task by ID. |
48
+ | `listTasks(request?)` | List tasks with filtering and pagination. |
49
+ | `cancelTask(taskId, metadata?)` | Cancel an in-progress task. |
50
+ | `subscribeToTask(taskId)` | Subscribe to SSE updates for a task. |
51
+ | `getAgentCard()` | Fetch the agent card from `/.well-known/agent-card.json`. |
52
+ | `getExtendedAgentCard()` | Fetch the extended (authenticated) agent card. |
53
+ | `createTaskPushNotificationConfig(config)` | Create a push notification config. |
54
+ | `getTaskPushNotificationConfig(taskId, configId)` | Get a push notification config. |
55
+ | `listTaskPushNotificationConfigs(taskId)` | List push notification configs. |
56
+ | `deleteTaskPushNotificationConfig(taskId, configId)` | Delete a push notification config. |
57
+
58
+ ## useA2ARuntime options
59
+
60
+ Pass either a pre-built `client` or a `baseUrl` (the runtime creates a client for you). Other options layer on top.
61
+
62
+ | Option | Type | Description |
63
+ | --- | --- | --- |
64
+ | `client` | `A2AClient` | Pre-built A2A client instance (provide this OR `baseUrl`). |
65
+ | `baseUrl` | `string` | A2A server URL (creates a client automatically). |
66
+ | `basePath` | `string` | Path prefix for API endpoints. Only used with `baseUrl`. |
67
+ | `tenant` | `string` | Tenant ID for multi-tenant servers. Only used with `baseUrl`. |
68
+ | `headers` | `Record<string, string>` or `() => Record<string, string>` | Headers for the auto-created client. |
69
+ | `extensions` | `string[]` | Extension URIs to negotiate. Only used with `baseUrl`. |
70
+ | `contextId` | `string` | Initial context ID for the conversation. |
71
+ | `configuration` | `A2ASendMessageConfiguration` | Default send message configuration. |
72
+ | `onError` | `(error: Error) => void` | Error callback. |
73
+ | `onCancel` | `() => void` | Cancellation callback. |
74
+ | `onArtifactComplete` | `(artifact: A2AArtifact) => void` | Fired when an incremental artifact finishes. |
75
+ | `adapters.attachments` | `AttachmentAdapter` | Custom attachment handling. See [adapters](/docs/runtimes/concepts/adapters#attachment-adapter). |
76
+ | `adapters.speech` | `SpeechSynthesisAdapter` | Text-to-speech. See [adapters](/docs/runtimes/concepts/adapters#speech-adapter). |
77
+ | `adapters.feedback` | `FeedbackAdapter` | Feedback collection. See [adapters](/docs/runtimes/concepts/adapters#feedback-adapter). |
78
+ | `adapters.history` | `ThreadHistoryAdapter` | Message persistence. See [adapters](/docs/runtimes/concepts/adapters#history-adapter). |
79
+ | `adapters.threadList` | `UseA2AThreadListAdapter` | Thread switching. See [threads](/docs/runtimes/concepts/threads). |
80
+
81
+ ## Hooks
82
+
83
+ ### Task state
84
+
85
+ `useA2ATask` returns the current A2A task object, including task state and status message.
86
+
87
+ <PlatformTabs>
88
+ <Tab value="React">
89
+
90
+ ```tsx
91
+ import { useA2ATask } from "@assistant-ui/react-a2a";
92
+
93
+ function TaskStatus() {
94
+ const task = useA2ATask();
95
+ if (!task) return null;
96
+ return (
97
+ <div>
98
+ Task {task.id}: {task.status.state}
99
+ </div>
100
+ );
101
+ }
102
+ ```
103
+
104
+ </Tab>
105
+ <Tab value="React Native">
106
+
107
+ ```tsx
108
+ import { useA2ATask } from "@assistant-ui/react-a2a";
109
+ import { Text, View } from "react-native";
110
+
111
+ function TaskStatus() {
112
+ const task = useA2ATask();
113
+ if (!task) return null;
114
+ return (
115
+ <View>
116
+ <Text>
117
+ Task {task.id}: {task.status.state}
118
+ </Text>
119
+ </View>
120
+ );
121
+ }
122
+ ```
123
+
124
+ </Tab>
125
+ <Tab value="React Ink">
126
+
127
+ ```tsx
128
+ import { useA2ATask } from "@assistant-ui/react-a2a";
129
+ import { Text } from "ink";
130
+
131
+ function TaskStatus() {
132
+ const task = useA2ATask();
133
+ if (!task) return null;
134
+ return (
135
+ <Text>
136
+ Task {task.id}: {task.status.state}
137
+ </Text>
138
+ );
139
+ }
140
+ ```
141
+
142
+ </Tab>
143
+ </PlatformTabs>
144
+
145
+ ### Artifacts list
146
+
147
+ `useA2AArtifacts` returns the artifacts generated by the current task.
148
+
149
+ <PlatformTabs>
150
+ <Tab value="React">
151
+
152
+ ```tsx
153
+ import { useA2AArtifacts } from "@assistant-ui/react-a2a";
154
+
155
+ function ArtifactList() {
156
+ const artifacts = useA2AArtifacts();
157
+ return (
158
+ <ul>
159
+ {artifacts.map((artifact) => (
160
+ <li key={artifact.artifactId}>
161
+ {artifact.name}: {artifact.parts.length} parts
162
+ </li>
163
+ ))}
164
+ </ul>
165
+ );
166
+ }
167
+ ```
168
+
169
+ </Tab>
170
+ <Tab value="React Native">
171
+
172
+ ```tsx
173
+ import { useA2AArtifacts } from "@assistant-ui/react-a2a";
174
+ import { Text, View } from "react-native";
175
+
176
+ function ArtifactList() {
177
+ const artifacts = useA2AArtifacts();
178
+ return (
179
+ <View>
180
+ {artifacts.map((artifact) => (
181
+ <Text key={artifact.artifactId}>
182
+ {artifact.name}: {artifact.parts.length} parts
183
+ </Text>
184
+ ))}
185
+ </View>
186
+ );
187
+ }
188
+ ```
189
+
190
+ </Tab>
191
+ <Tab value="React Ink">
192
+
193
+ ```tsx
194
+ import { useA2AArtifacts } from "@assistant-ui/react-a2a";
195
+ import { Box, Text } from "ink";
196
+
197
+ function ArtifactList() {
198
+ const artifacts = useA2AArtifacts();
199
+ return (
200
+ <Box flexDirection="column">
201
+ {artifacts.map((artifact) => (
202
+ <Text key={artifact.artifactId}>
203
+ {artifact.name}: {artifact.parts.length} parts
204
+ </Text>
205
+ ))}
206
+ </Box>
207
+ );
208
+ }
209
+ ```
210
+
211
+ </Tab>
212
+ </PlatformTabs>
213
+
214
+ ### Agent card
215
+
216
+ `useA2AAgentCard` returns the agent card fetched from the server on initialization.
217
+
218
+ <PlatformTabs>
219
+ <Tab value="React">
220
+
221
+ ```tsx
222
+ import { useA2AAgentCard } from "@assistant-ui/react-a2a";
223
+
224
+ function AgentInfo() {
225
+ const card = useA2AAgentCard();
226
+ if (!card) return null;
227
+ return (
228
+ <div>
229
+ <h3>{card.name}</h3>
230
+ <p>{card.description}</p>
231
+ <div>Skills: {card.skills.map((s) => s.name).join(", ")}</div>
232
+ </div>
233
+ );
234
+ }
235
+ ```
236
+
237
+ </Tab>
238
+ <Tab value="React Native">
239
+
240
+ ```tsx
241
+ import { useA2AAgentCard } from "@assistant-ui/react-a2a";
242
+ import { Text, View } from "react-native";
243
+
244
+ function AgentInfo() {
245
+ const card = useA2AAgentCard();
246
+ if (!card) return null;
247
+ return (
248
+ <View>
249
+ <Text>{card.name}</Text>
250
+ <Text>{card.description}</Text>
251
+ <Text>Skills: {card.skills.map((s) => s.name).join(", ")}</Text>
252
+ </View>
253
+ );
254
+ }
255
+ ```
256
+
257
+ </Tab>
258
+ <Tab value="React Ink">
259
+
260
+ ```tsx
261
+ import { useA2AAgentCard } from "@assistant-ui/react-a2a";
262
+ import { Box, Text } from "ink";
263
+
264
+ function AgentInfo() {
265
+ const card = useA2AAgentCard();
266
+ if (!card) return null;
267
+ return (
268
+ <Box flexDirection="column">
269
+ <Text bold>{card.name}</Text>
270
+ <Text>{card.description}</Text>
271
+ <Text>Skills: {card.skills.map((s) => s.name).join(", ")}</Text>
272
+ </Box>
273
+ );
274
+ }
275
+ ```
276
+
277
+ </Tab>
278
+ </PlatformTabs>
279
+
280
+ ## Task states
281
+
282
+ The A2A protocol defines 9 task states. The runtime maps them to assistant-ui message statuses:
283
+
284
+ | A2A task state | Description | Message status |
285
+ | --- | --- | --- |
286
+ | `unspecified` | Unknown or default state. | `running` |
287
+ | `submitted` | Task acknowledged. | `running` |
288
+ | `working` | Task in progress. | `running` |
289
+ | `completed` | Task finished. | `complete` |
290
+ | `failed` | Task errored. | `incomplete (error)` |
291
+ | `canceled` | Task cancelled. | `incomplete (cancelled)` |
292
+ | `rejected` | Agent declined task. | `incomplete (error)` |
293
+ | `input_required` | Agent needs user input. | `requires-action` |
294
+ | `auth_required` | Authentication needed. | `requires-action` |
295
+
296
+ <Callout type="info">
297
+ When a task enters `input_required`, the user can continue the conversation normally. The runtime sends the next message with the same `taskId` to resume the task.
298
+ </Callout>
299
+
300
+ ## Artifacts
301
+
302
+ A2A agents can produce artifacts (files, code, data) alongside their responses. Artifacts are accumulated during streaming and accessible via `useA2AArtifacts`.
303
+
304
+ The runtime supports:
305
+
306
+ - **Incremental artifact streaming** via `append` mode.
307
+ - **Artifact completion notification** via the `onArtifactComplete` callback.
308
+ - **Automatic reset** of artifacts on each new run.
309
+
310
+ ```tsx
311
+ const runtime = useA2ARuntime({
312
+ baseUrl: "http://localhost:9999",
313
+ onArtifactComplete: (artifact) => {
314
+ console.log("Artifact ready:", artifact.name);
315
+ },
316
+ });
317
+ ```
318
+
319
+ ## Streaming vs non-streaming
320
+
321
+ The runtime automatically selects the communication mode based on the agent's capabilities:
322
+
323
+ - If the agent card indicates `capabilities.streaming: true` (or the field is unset), the runtime uses `POST /message:stream` with SSE.
324
+ - If `capabilities.streaming: false`, the runtime falls back to `POST /message:send`.
325
+
326
+ ## Error handling
327
+
328
+ The client throws `A2AError` instances with structured error information following the `google.rpc.Status` format:
329
+
330
+ ```tsx
331
+ import { A2AError } from "@assistant-ui/react-a2a";
332
+
333
+ const runtime = useA2ARuntime({
334
+ baseUrl: "http://localhost:9999",
335
+ onError: (error) => {
336
+ if (error instanceof A2AError) {
337
+ console.log(error.code); // HTTP status code
338
+ console.log(error.status); // e.g. "NOT_FOUND"
339
+ console.log(error.details); // google.rpc.ErrorInfo details
340
+ }
341
+ },
342
+ });
343
+ ```
344
+
345
+ ## Multi-tenancy
346
+
347
+ For multi-tenant A2A servers, pass a `tenant` option:
348
+
349
+ ```ts
350
+ const client = new A2AClient({
351
+ baseUrl: "https://agent.example.com",
352
+ tenant: "my-org",
353
+ });
354
+ ```
355
+
356
+ This prepends `/{tenant}` to all API paths (e.g. `/my-org/message:send`).
357
+
358
+ ## Feature support
359
+
360
+ | Feature | Supported |
361
+ | --- | --- |
362
+ | Streaming (SSE) | Yes |
363
+ | Non-streaming fallback | Yes |
364
+ | All 9 task states | Yes |
365
+ | Artifacts (text, data, file) | Yes |
366
+ | Agent card discovery | Yes |
367
+ | Multi-tenancy | Yes |
368
+ | Structured errors | Yes |
369
+ | Push notifications CRUD | Yes |
370
+ | Extension negotiation | Yes |
371
+ | Task cancellation | Yes |
372
+ | Message editing | Yes |
373
+ | Message reload | Yes |
374
+ | History persistence | Via [history adapter](/docs/runtimes/concepts/adapters#history-adapter) |
375
+ | Thread list management | Via [thread list adapter](/docs/runtimes/concepts/threads) |
376
+
377
+ ## Related
378
+
379
+ <Cards>
380
+ <Card
381
+ icon={<Network width={20} height={20} />}
382
+ title="A2A overview"
383
+ description="What A2A is and when to pick it."
384
+ href="/docs/runtimes/a2a"
385
+ />
386
+ <Card
387
+ title="Quickstart"
388
+ description="Minimal runtime + Thread setup."
389
+ href="/docs/runtimes/a2a/quickstart"
390
+ />
391
+ <Card
392
+ title="Adapters"
393
+ description="Attachments, speech, feedback, history, threads."
394
+ href="/docs/runtimes/concepts/adapters"
395
+ />
396
+ </Cards>
@@ -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>