Skip to content

Commit 9c93ef3

Browse files
committed
docs(a2ui): recommend injectA2UITool in shared snippet, drop it from fixed-schema
Most framework integrations don't ship their own A2UI rendering tool, so the shared snippet now guides users to inject `render_a2ui` via `a2ui: { injectA2UITool: true }`. The LangGraph fixed-schema guide returns A2UI operations directly from a Python tool, so the middleware auto-detects them and tool injection is unnecessary — switched to `a2ui: {}` there with a note.
1 parent 8182470 commit 9c93ef3

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

docs/content/docs/integrations/langgraph/generative-ui/a2ui/fixed-schema.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,12 @@ agent = create_agent(
111111
<Step>
112112
### Configure the runtime (TypeScript)
113113

114-
Enable A2UI in your CopilotRuntime:
114+
Enable A2UI in your CopilotRuntime. The middleware auto-detects A2UI operations in any tool result, so no tool injection is needed here — the agent's `search_flights` tool returns them directly.
115115

116116
```typescript title="app/api/copilotkit/route.ts"
117117
const runtime = new CopilotRuntime({
118118
agents: { default: myAgent },
119-
a2ui: {
120-
injectA2UITool: true,
121-
},
119+
a2ui: {},
122120
});
123121
```
124122
</Step>

docs/snippets/shared/generative-ui/a2ui.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,20 @@ A2UI specifications can be rendered on web, mobile, or any other platform, makin
4444

4545
### Backend
4646

47-
Enable A2UI in `CopilotRuntime` by passing `a2ui: true`:
47+
Enable A2UI in `CopilotRuntime` and inject a rendering tool (`render_a2ui`) into your agent so it can produce A2UI surfaces:
4848

4949
```ts title="app/api/copilotkit/route.ts"
5050
import { CopilotRuntime } from "@copilotkit/runtime";
5151

5252
const runtime = new CopilotRuntime({
5353
agents: { default: myAgent },
54-
a2ui: true,
54+
a2ui: {
55+
injectA2UITool: true,
56+
},
5557
});
5658
```
5759

58-
This automatically applies `A2UIMiddleware` to all registered agents. Pass an object instead of `true` to customise behaviour — for example, to scope it to specific agents: `a2ui: { agents: ["my-agent"] }`.
60+
This applies `A2UIMiddleware` to all registered agents and adds `render_a2ui` to the agent's tool list, along with usage guidelines so the LLM knows how to call it. Scope to specific agents with `a2ui: { injectA2UITool: true, agents: ["my-agent"] }`.
5961

6062
Once configured, any A2UI output returned from your agent will automatically be rendered in the chat interface — no additional frontend code required.
6163

0 commit comments

Comments
 (0)