A2UI
A2UI is an open protocol for agents to generate rich, interactive user interfaces. Instead of returning plain text, agents produce structured JSON that client-side renderers transform into UI components — cards, forms, buttons, images, and more. A2UI is transport-agnostic and works over both A2A and AG-UI. See the A2UI documentation for the full protocol specification.
A2UIAgent#
AG2 supports A2UI through A2UIAgent, a specialized agent that handles prompt engineering with A2UI schema instructions, response parsing, optional schema validation with automatic retry, and integration with A2A and AG-UI serving.
A2A Integration#
A2UIAgent integrates with the A2A protocol through A2aAgentServer. When wrapped in A2aAgentServer, the agent is auto-detected and the server automatically:
- Uses
A2UIAgentExecutorto split responses into text + A2UI DataParts - Declares the A2UI version support in the agent card
- Handles extension negotiation — clients that don't request A2UI get text-only responses
Clients connect via A2A JSON-RPC and request the A2UI extension through the A2A protocol's extension negotiation. The response contains standard A2A parts: - TextPart: The conversational text - DataPart: A2UI operations with MIME type application/json+a2ui
On the client side, Flutter's genui_a2a package provides a native A2UI renderer that connects to the A2A server and renders surfaces automatically.
Further Reading#
See the full A2UIAgent reference for details on configuration, validation, actions, custom catalogs, and AG-UI integration.