AG-UI + A2UI Integration Skill
Overview
Use this skill to add A2UI rendering to an AG-UI application. Treat AG-UI as
the transport and agent integration layer, @ag-ui/a2ui-middleware as the
server-side bridge that detects and paints A2UI operations, and A2UI as the UI
payload format that the client renderer displays.
This is a developer-facing skill artifact. It is meant to be loaded by coding
agents and used against a real app or repo, not published as a docs page.
When to Use
- Adding A2UI rendering to an existing AG-UI app.
- Creating an AG-UI quickstart that should display A2UI surfaces.
- Connecting any AG-UI-supported framework or custom AG-UI agent to an
A2UI-capable frontend.
- Adding or extending an A2UI component catalog.
- Debugging why an A2UI surface does not render or why a user action does not
flow back to the agent.
When NOT to Use
- For AG-UI protocol event semantics only, use the AG-UI protocol skill or
protocol docs.
- For A2UI renderer internals outside an AG-UI app, use the A2UI renderer
docs or renderer-specific skills.
- For generic CopilotKit frontend work without A2UI, use CopilotKit-specific
setup and React skills.
Workflow
- Inspect the app shape: framework adapter, AG-UI agent endpoint, runtime
host, frontend shell, and any existing A2UI renderer/catalog.
- Decide the A2UI mode before editing code:
- Fixed schema: backend tools return an
a2ui_operations envelope with
createSurface, updateComponents, and updateDataModel.
- Dynamic schema: a framework A2UI tool (
generate_a2ui) delegates to a
sub-agent that streams render_a2ui args through A2UIMiddleware.
- Select framework-specific wiring from
references/framework-adapters.md, or use that reference to find the
closest AG-UI integration pattern. Preserve the app's existing agent
architecture.
- Wire server middleware/runtime and client renderer using
references/a2ui-runtime-and-renderer.md. Avoid double-applying
A2UIMiddleware; use either runtime-level A2UI config or per-agent
agent.use(new A2UIMiddleware(...)) for a given agent.
- Register a catalog on the client. With CopilotKit >= 1.61.2, forwarding it to
the provider (
a2ui={{ catalog }}) auto-enables A2UI and auto-derives
defaultCatalogId from the catalog's id. Only when you are not forwarding a
catalog, ensure the middleware or adapter sets a defaultCatalogId matching
the renderer-registered catalog.
- Verify the streaming path with
references/verification.md: AG-UI stream,
a2ui-surface activity snapshots or a2ui_operations, rendered A2UI
surface, and a user interaction flowing back through AG-UI.
AG-UI Framework Support
This skill is not limited to the framework examples below. For any target
framework, first check the AG-UI repository's integrations/ directory, the
AG-UI docs, the framework adapter's A2UI files, and the current CLI source. If
AG-UI supports the framework, use that integration's documented package,
endpoint helper, A2UI tool factory, or scaffold path. If there is no framework
A2UI adapter, implement the custom AG-UI agent path, return a2ui_operations
from backend tools for fixed layouts, and keep the middleware/client wiring the
same.
Common AG-UI CLI Flags
Use the CLI flags that exist in sdks/typescript/packages/cli/src/index.ts.
The table is a quick reference for known scaffold paths, not the full AG-UI
support matrix. Do not invent flags.
| Framework |
CLI flag |
| ADK |
--adk |
| LangGraph Python |
--langgraph-py |
| LangGraph JavaScript |
--langgraph-js |
| CrewAI Flows |
--crewai-flows |
| Mastra |
--mastra |
| Pydantic AI |
--pydantic-ai |
| LlamaIndex |
--llamaindex |
| Agno |
--agno |
| AG2 |
--ag2 |
Strands has AG-UI integration packages and examples, but no Strands CLI flag
is present in the current AG-UI CLI source. Use the Strands integration docs
instead of guessing a scaffold command.
Key Rules
- Keep the integration AG-UI-first for every supported framework. CopilotKit is
a common runtime/renderer path for web apps, but AG-UI owns the middleware,
framework adapters, and wire events.
- Enable A2UI on both sides:
A2UIMiddleware or runtime A2UI config on the
server, and an A2UI-capable renderer/catalog on the client.
- For dynamic schema, prefer the framework adapter's A2UI tool factory or
auto-injection path. The model should call
generate_a2ui; the sub-agent
should stream render_a2ui args so the middleware can progressively paint.
- For fixed schema, return an
a2ui_operations envelope from backend tools
rather than asking the model to invent component trees.
- Emit
createSurface once per surfaceId; use update operations for later
changes.
- Do not let the model invent catalog ids. When the client forwards a catalog to
the provider (CopilotKit >= 1.61.2), its
catalogId is derived automatically;
otherwise the host/middleware/adapter should stamp a defaultCatalogId that
matches the client-registered catalog.
- Preserve AG-UI run boundaries and error events. Do not swallow server or
stream errors.
- Verify with a real browser or client run when possible. A static typecheck is
not enough for streaming UI work.
References
references/framework-adapters.md - framework-specific AG-UI adapter
patterns.
references/a2ui-runtime-and-renderer.md - server/client A2UI wiring and
catalog patterns.
references/verification.md - checks to confirm the integration works.
sources.md - source files and docs used by this skill.
1---2name: ag-ui-a2ui-integration3description: Use when adding A2UI rendering to any AG-UI-supported framework or custom AG-UI application, scaffolding an AG-UI app that should render A2UI, adapting an AG-UI integration to emit A2UI surfaces, or wiring the AG-UI A2UI middleware/toolkit with a compatible renderer.4---5
6# AG-UI + A2UI Integration Skill
7
8## Overview
9
10Use this skill to add A2UI rendering to an AG-UI application. Treat AG-UI as
11the transport and agent integration layer, `@ag-ui/a2ui-middleware` as the
12server-side bridge that detects and paints A2UI operations, and A2UI as the UI
13payload format that the client renderer displays.
14
15This is a developer-facing skill artifact. It is meant to be loaded by coding
16agents and used against a real app or repo, not published as a docs page.
17
18## When to Use
19
20- Adding A2UI rendering to an existing AG-UI app.
21- Creating an AG-UI quickstart that should display A2UI surfaces.
22- Connecting any AG-UI-supported framework or custom AG-UI agent to an
23 A2UI-capable frontend.
24- Adding or extending an A2UI component catalog.
25- Debugging why an A2UI surface does not render or why a user action does not
26 flow back to the agent.
27
28## When NOT to Use
29
30- For AG-UI protocol event semantics only, use the AG-UI protocol skill or
31 protocol docs.
32- For A2UI renderer internals outside an AG-UI app, use the A2UI renderer
33 docs or renderer-specific skills.
34- For generic CopilotKit frontend work without A2UI, use CopilotKit-specific
35 setup and React skills.
36
37## Workflow
38
391. Inspect the app shape: framework adapter, AG-UI agent endpoint, runtime
40 host, frontend shell, and any existing A2UI renderer/catalog.
412. Decide the A2UI mode before editing code:
42 - Fixed schema: backend tools return an `a2ui_operations` envelope with
43 `createSurface`, `updateComponents`, and `updateDataModel`.
44 - Dynamic schema: a framework A2UI tool (`generate_a2ui`) delegates to a
45 sub-agent that streams `render_a2ui` args through `A2UIMiddleware`.
463. Select framework-specific wiring from
47 `references/framework-adapters.md`, or use that reference to find the
48 closest AG-UI integration pattern. Preserve the app's existing agent
49 architecture.
504. Wire server middleware/runtime and client renderer using
51 `references/a2ui-runtime-and-renderer.md`. Avoid double-applying
52 `A2UIMiddleware`; use either runtime-level A2UI config or per-agent
53 `agent.use(new A2UIMiddleware(...))` for a given agent.
545. Register a catalog on the client. With CopilotKit >= 1.61.2, forwarding it to
55 the provider (`a2ui={{ catalog }}`) auto-enables A2UI and auto-derives
56 `defaultCatalogId` from the catalog's id. Only when you are not forwarding a
57 catalog, ensure the middleware or adapter sets a `defaultCatalogId` matching
58 the renderer-registered catalog.
596. Verify the streaming path with `references/verification.md`: AG-UI stream,
60 `a2ui-surface` activity snapshots or `a2ui_operations`, rendered A2UI
61 surface, and a user interaction flowing back through AG-UI.
62
63## AG-UI Framework Support
64
65This skill is not limited to the framework examples below. For any target
66framework, first check the AG-UI repository's `integrations/` directory, the
67AG-UI docs, the framework adapter's A2UI files, and the current CLI source. If
68AG-UI supports the framework, use that integration's documented package,
69endpoint helper, A2UI tool factory, or scaffold path. If there is no framework
70A2UI adapter, implement the custom AG-UI agent path, return `a2ui_operations`
71from backend tools for fixed layouts, and keep the middleware/client wiring the
72same.
73
74## Common AG-UI CLI Flags
75
76Use the CLI flags that exist in `sdks/typescript/packages/cli/src/index.ts`.
77The table is a quick reference for known scaffold paths, not the full AG-UI
78support matrix. Do not invent flags.
79
80| Framework | CLI flag |
81| -------------------- | ---------------- |
82| ADK | `--adk` |
83| LangGraph Python | `--langgraph-py` |
84| LangGraph JavaScript | `--langgraph-js` |
85| CrewAI Flows | `--crewai-flows` |
86| Mastra | `--mastra` |
87| Pydantic AI | `--pydantic-ai` |
88| LlamaIndex | `--llamaindex` |
89| Agno | `--agno` |
90| AG2 | `--ag2` |
91
92Strands has AG-UI integration packages and examples, but no Strands CLI flag
93is present in the current AG-UI CLI source. Use the Strands integration docs
94instead of guessing a scaffold command.
95
96## Key Rules
97
98- Keep the integration AG-UI-first for every supported framework. CopilotKit is
99 a common runtime/renderer path for web apps, but AG-UI owns the middleware,
100 framework adapters, and wire events.
101- Enable A2UI on both sides: `A2UIMiddleware` or runtime A2UI config on the
102 server, and an A2UI-capable renderer/catalog on the client.
103- For dynamic schema, prefer the framework adapter's A2UI tool factory or
104 auto-injection path. The model should call `generate_a2ui`; the sub-agent
105 should stream `render_a2ui` args so the middleware can progressively paint.
106- For fixed schema, return an `a2ui_operations` envelope from backend tools
107 rather than asking the model to invent component trees.
108- Emit `createSurface` once per `surfaceId`; use update operations for later
109 changes.
110- Do not let the model invent catalog ids. When the client forwards a catalog to
111 the provider (CopilotKit >= 1.61.2), its `catalogId` is derived automatically;
112 otherwise the host/middleware/adapter should stamp a `defaultCatalogId` that
113 matches the client-registered catalog.
114- Preserve AG-UI run boundaries and error events. Do not swallow server or
115 stream errors.
116- Verify with a real browser or client run when possible. A static typecheck is
117 not enough for streaming UI work.
118
119## References
120
121- `references/framework-adapters.md` - framework-specific AG-UI adapter
122 patterns.
123- `references/a2ui-runtime-and-renderer.md` - server/client A2UI wiring and
124 catalog patterns.
125- `references/verification.md` - checks to confirm the integration works.
126- `sources.md` - source files and docs used by this skill.