What is A2UI?
A2UI (Agent-to-UI) is a declarative specification for generative UI that uses JSON schemas to describe structured UI components. Instead of hand-building React components for every use case, agents emit JSON specifications that your frontend interprets and renders. This approach provides:- Balanced flexibility - Wide vocabulary without custom components
- Multi-platform support - Same spec renders on web, mobile, desktop
- Scalability - Handle diverse use cases without linear codebase growth
- Clean separation - Logic and presentation stay decoupled
How A2UI Works
- Agent emits A2UI JSON - Your backend sends structured JSON following the A2UI specification
- AG-UI streams it - The A2UI messages flow through AG-UI protocol as
ActivityMessageobjects - Frontend renders it - CopilotKit’s A2UI renderer interprets the spec and displays components
Quick Start
Step 1: Install Dependencies
Step 2: Configure Frontend
Create an A2UI message renderer and pass it to CopilotKit:app/page.tsx
Step 3: Define Your Theme
The theme controls how A2UI components render:app/theme.ts
Full Theme Example
See the complete theme configuration in the A2A starter template
Step 4: Configure Your Agent
Your agent needs to emit A2UI JSON specifications. Here’s an example showing a restaurant list:agent/prompt_builder.py
A2UI Component Library
A2UI provides a rich vocabulary of components:Layout Components
Column
Vertical stack of child components
Row
Horizontal arrangement of components
List
Repeated items from data binding
Display Components
Text
Display text with styling hints
Image
Display images with URLs
Card
Container with styling
Interactive Components
Button
Clickable button with actions
TextField
Text input field
Complete Example: Restaurant Finder
Let’s build a complete restaurant finder with A2UI:The Result
When the agent responds, users see:- A heading “Top Restaurants”
- Cards for each restaurant showing:
- Restaurant image
- Name and rating
- Details and link
- “Book Now” button
The A2UI Specification
Using the A2UI Composer
Instead of writing JSON by hand, use the A2UI Composer to visually design components:A2UI Composer
Visual tool for generating A2UI specifications - just design your UI and copy the JSON
- Drag and drop components
- Configure properties visually
- Preview the result
- Copy the generated JSON
Actions and Interactivity
A2UI buttons can trigger actions that flow back to your agent:Comparison with Other Approaches
| Feature | A2UI | Static AG-UI | Open-ended MCP |
|---|---|---|---|
| Setup | Medium | Medium | Low |
| Flexibility | Medium | Low | High |
| Type Safety | Schema-level | Full (Zod) | None |
| Cross-platform | Excellent | React-only | Web-only |
| Visual consistency | Good | Excellent | Variable |
| LLM learnability | Good | Medium | Low |
When to Use A2UI
Best For:
- Multi-platform applications (web, mobile, desktop)
- Diverse use cases without building custom components for each
- Cleaner separation between logic and presentation
- Balanced flexibility and structure
Not Ideal For:
- Pixel-perfect brand-critical features (use Static AG-UI)
- Rapid prototyping with arbitrary HTML (use MCP Apps)
- Highly custom interactions not in the A2UI vocabulary
Best Practices
1. Provide Clear Component IDs
2. Use Data Binding for Dynamic Content
3. Structure for Reusability
Next Steps
A2UI Composer
Visual tool for designing A2UI components
A2UI Specification
Full A2UI specification and documentation
A2A Starter Template
Complete example with A2UI configured
Static AG-UI
Compare with React component approach
