How It Works
Integrate A2UI with Your Frontend
PraisonAI core emits A2UI via the agent toolsend_a2ui_messages. Your frontend detects the payload and renders with Google A2UI renderers or a custom mapper.
Core SDK documents the contract (
A2UIToolResultProtocol). Detection helpers for rich UI live in PraisonAIUI a2ui_utils as the reference UI implementation — do not expect parsing logic in praisonaiagents core.Prerequisites
Quick Start
Four-step contract
1. Agent with the A2UI tool
2. Tool output shape (integrator contract)
send_a2ui_messages returns:
3. Detect in your UI (minimum)
a2ui_utils.py as a reference — copy or vendor that file in your UI layer.
4. Render and handle user actions
React (Google renderer):Transport options
| Transport | Entry point | A2UI delivery |
|---|---|---|
| Tool result JSON | Your WebSocket/SSE | Parse mime_type on TOOL_CALL_COMPLETED |
| AG-UI | AGUI(agent).get_router() → POST /agui | TOOL_CALL_RESULT (JSON string) + CUSTOM event name: "a2ui" |
| A2A | A2A(agent) → POST /a2a | create_a2ui_part() / is_a2ui_part() |
| PraisonAIUI | aiui run app.py | Reference impl — surfaces, canvas, chat preview |
AG-UI CUSTOM event
When a tool returns A2UI, the AG-UI bridge emits an additive event:TOOL_CALL_RESULT with stringified JSON is unchanged for backward compatibility.
Tiers (pick the simplest)
See Generative UI for the full tier list:| Tier | Use when |
|---|---|
| 0 | Markdown streaming only |
| 1 | Your frontend owns component mapping (output_pydantic) |
| 2 | CopilotKit / AG-UI client |
| 3 | Cross-platform A2UI catalog (this guide) |
Reference implementation
PraisonAIUI example 29 — A2UI canvas demonstrates chat + live surface preview.Best Practices
Choose the right UI tier
Choose the right UI tier
Start at tier 0 (Markdown) and move up only when you need structured or generative surfaces.
Own the component mapping at tier 1
Own the component mapping at tier 1
Map
output_pydantic types to your design system — do not hard-code PraisonAI defaults in production UIs.Test with the reference example
Test with the reference example
Use the PraisonAIUI example 29 canvas to validate message flow before custom frontends.
Keep A2UI payloads small
Keep A2UI payloads small
Stream incremental surface updates instead of resending full component trees each turn.
Related
A2UI Protocol
Core A2UI message contract
Generative UI
UI tiers and integration patterns

