A2UI — Agent to UI
A2UI lets the Agent describe UI structure through declarative JSON. The frontend renders it as native React components inline in the chat area. When users interact with components (e.g., clicking buttons), events are dispatched back to the Agent for follow-up processing.How It Works
Basic Usage
The Agent calls therender_ui tool with a components array:
a2ui field. When StageGroup detects this field, it renders the A2UIRenderer component.
Component Catalog
Layout Components
Row
Arranges children horizontally.Column
Arranges children vertically.Card
Container with title and border.Content Components
Text
Text display with Markdown support.Image
Image display.Divider
Horizontal separator.Badge
Label/badge.List
List display.Table
Table display.Interactive Components
Button
Clickable button that triggers an Action callback.Profy Business Components
ExpertCard
Expert information card.CreditDisplay
Credit balance display.PlanBadge
Subscription plan badge.StatusIndicator
Status indicator.PricingTable
Pricing comparison table.ProgressBar
Progress bar.Action Handling
When a user clicks a Button with anaction prop, the frontend dispatches the event to the Agent:
Examples
Plan Comparison
Status Dashboard
Action Confirmation
Best Practices
- Prefer A2UI over Inline Visualization when displaying structured data (tables, lists, status) — A2UI components are more consistent and performant
- Keep component trees shallow — no more than 3 levels of nesting
- Use snake_case for action names — e.g.,
confirm_delete,select_plan, making them easy for the Agent to parse - Use payload for context — Button’s
payloadfield carries additional data the Agent needs, avoiding positional inference - Group with Cards — logically related components belong in the same Card for visual coherence
- Choose Inline Visualization when you need freeform drawing/Canvas/WebGL — A2UI only supports predefined components

