A2UI (Agent-to-User Interface)
PraisonAI supports the A2UI Protocol for generating rich, interactive user interfaces from AI agents using declarative JSON.Overview
A2UI is Google’s open standard that allows agents to “speak UI” by sending declarative JSON describing UI components, which clients then render natively. Key Features:- Declarative JSON - Agents send UI descriptions, not executable code
- Security First - Only pre-approved components from a catalog can be rendered
- LLM-Friendly - Flat list of components with IDs, easy for LLMs to generate
- Framework-Agnostic - Same JSON works on Web, Flutter, React, etc.
- Incrementally Updateable - Agents can update UI progressively
Quick Start
Using A2UIAgent Wrapper
Using Surface Builder
Using Templates
Components
Display Components
| Component | Description |
|---|---|
TextComponent | Text display with usage hints (h1, h2, body, caption) |
ImageComponent | Image display with fit and usage hints |
IconComponent | Icon display |
Layout Components
| Component | Description |
|---|---|
RowComponent | Horizontal layout |
ColumnComponent | Vertical layout |
CardComponent | Card container |
ListComponent | List with template support |
Input Components
| Component | Description |
|---|---|
ButtonComponent | Button with action |
TextFieldComponent | Text input field |
CheckBoxComponent | Checkbox input |
SliderComponent | Slider input |
DateTimeInputComponent | Date/time picker |
Data Binding
UsePathBinding to reference values in the data model:
Actions
Define button actions with context:A2A Integration
A2UI works alongside the A2A (Agent-to-Agent) protocol:Message Types
A2UI uses four message types:| Message | Description |
|---|---|
CreateSurfaceMessage | Create a new UI surface |
UpdateComponentsMessage | Update surface components |
UpdateDataModelMessage | Update the data model |
DeleteSurfaceMessage | Delete a surface |
API Reference
A2UIAgent
render_text(text, title=None)- Render text responserender_list(title, items, ...)- Render list of itemsrender_form(title, fields, ...)- Render formchat(message)- Send message to agentto_messages()- Get A2UI messagesto_json()- Get JSON stringto_a2a_part()- Get A2A DataPart
Surface
add(component)- Add a componentset_data(key, value)- Set data model valuetext(id, text, ...)- Add text componentimage(id, url, ...)- Add image componentbutton(id, child, ...)- Add button componentcard(id, child, ...)- Add card componentrow(id, children, ...)- Add row layoutcolumn(id, children, ...)- Add column layoutlist(id, children, ...)- Add list componenttext_field(id, label, ...)- Add text fieldto_messages()- Generate A2UI messagesto_json()- Generate JSON string
Related
- A2A Protocol - Agent-to-Agent communication
- AG-UI Protocol - CopilotKit integration
- Workflows - Multi-agent workflows

