What We Learned Using A2UI for a Dynamic Analytics Dashboard
What we learned building a dynamic analytics dashboard with A2UI: letting the AI design the layout while the server owns every number, plus 8 real caveats.
After every performance test run, everyone wanted a different dashboard — engineers wanted run-to-run diffs, managers wanted a short summary, and no fixed set of charts ever fit. So we tried letting users ask for a report in plain words and used A2UI to let an AI compose the layout on the fly. It worked surprisingly well, once we learned to keep the AI away from our real numbers and worked through eight rough edges along the way.
The Short Version
- Structured UI, not prose: A2UI lets an AI agent describe an interface as JSON messages instead of returning raw text or HTML.
- Strict guardrails: You give the model a small, pre-approved catalog of components. Your frontend draws them with its own native code.
- The golden rule: Keep the AI away from your real data. The model chooses the layout only. Your server reads the metrics, attaches them, and binds every chart before the browser renders anything.
- Young ecosystem: The protocol is clean, but the packages are still maturing. We hit version conflicts, validation retries, and SSR limits — each with a practical fix.
What Is A2UI?
A2UI (“Agent to UI”) is an open protocol that lets an AI agent compose a user interface by streaming structured JSON messages to a client application.
Instead of replying with a paragraph of text, the model emits a sequence of small UI instructions: cards, metric tiles, tables, and charts. The flow has three steps:
- The agent sends a stream of typed JSON messages.
- Your application validates and reads those messages.
- Your frontend renders them using its own native components.
The agent never emits HTML, CSS, or JavaScript. It can only request components that your app already knows how to draw. That safety boundary was the main reason we picked it.
Five Terms to Know
You only need five concepts to work with A2UI:
| Term | Meaning |
|---|---|
| Surface | The area of your screen where the AI-composed interface renders |
| Catalog | The shared list of components the agent is allowed to use |
| Component | A single UI building block, such as a card, text block, or chart |
| Data model | The values displayed by components, kept separate from the layout |
| Renderer | The frontend code that turns protocol messages into real UI elements |
A component payload is intentionally flat. Rather than nesting deep JSON trees, each component references its children by id:
{
"version": "1.0",
"updateComponents": {
"surfaceId": "report",
"components": [
{ "id": "root", "component": "Card", "child": "title" },
{ "id": "title", "component": "Text", "text": "Latency Summary" }
]
}
}
Every surface must include one component with the id root.
Why We Chose A2UI
Once we decided to let users describe the report they want in plain words, we weighed four ways to build it:
- Free-form HTML from the AI: Unsafe by default, hard to sanitize, and almost impossible to keep aligned with a consistent design system.
- A custom JSON schema and renderer: Viable, but we would own the spec, the validator, the prompt helpers, and the frontend glue forever.
- OpenUI: Uses a compact streaming DSL built for fast web rendering, while we wanted strict JSON schema validation and an explicit split between layout and data on the server. (We didn’t test OpenUI in practice, so we won’t review it here.)
- A2UI: A standard message format, an SDK validator, prompt helpers, and ready-made renderers.
Both OpenUI and A2UI look like solid options. Our deciding factor was control. We wanted a fixed, closed list of components that matched a consistent design system, with a model that could only arrange those pieces. A2UI’s catalog model mapped directly to that constraint.
That choice came with a real cost. A2UI is young, and wiring it into a production codebase took more engineering effort than the quickstart suggests. Most of the caveats below are the price of adopting an early protocol. We still think it was worth it, but it is not free.
How We Wired It Together
The official A2UI quickstart walks through a small trip planner where an agent builds a travel UI rendered on web and mobile. The quickstart itself notes that the sample is for learning, not production.
We took the same building blocks and added a strict server-side boundary between the AI and our metrics:

- Closed Catalog: We defined a small catalog containing only our allowed report components.
- Server-Side Generation & Validation: The server asks the model for a report layout and validates the response with the A2UI SDK.
- Data Binding & Native Rendering: The server attaches real performance metrics to each chart, and the browser renders the surface using our existing chart components.
Our existing pages and chart libraries stayed untouched. A2UI sits as a thin composition layer on top.
Eight Things We Hit, and How We Fixed Them
1. Keep the Catalog Small and Closed
A2UI ships with a basic catalog of 18 general-purpose components — buttons, text inputs, images, and more. We skipped it entirely.
Instead, we defined our own catalog with only report primitives: a section container, a text block, a key metric tile, and a handful of chart types. The model cannot invent a button or an external link because those components do not exist in our catalog. A smaller catalog shrinks the failure surface and keeps the model aligned with a consistent design system.
2. Never Let the AI Write Your Data
By default, the A2UI SDK allows the agent to populate values directly inside the data model.
For an analytics dashboard, that is a non-starter. An LLM will happily invent a plausible-looking p95 latency number.
Our fix enforces a three-part boundary:
- Strip data fields from the prompt catalog: The schema shown to the AI exposes zero data properties.
- Drop any data the model sends anyway: The server deletes any data payload the model tries to smuggle in.
- Bind real metrics on the server: The server maps each chart component directly to verified query results before sending the payload to the browser.
This is the single most important rule in our architecture. The AI never sees a chart’s underlying numbers and never carries them. It only says, “place a latency chart here.” The server decides what that chart displays.
3. Guard Numbers Inside Commentary Text
Charts were safe, but the model still writes short narrative blocks like “latency spiked during the second phase.” Left unchecked, it will slip made-up numbers into those sentences.
We solved this with server-resolved placeholders. The model writes tokens such as {fact:p95_latency}, and the server swaps them for real values from the test run. If any prose block contains a bare number, the server rejects the response.
Our first version was too strict and triggered false alarms. It flagged a run ID and innocent phrases like “batches 4 and 8.” We tuned the pattern check until legitimate references passed while fabricated metrics stayed blocked.
4. Expect Small Schema Mistakes — Plan One Retry
In early testing, most model responses passed validation on the first attempt, though not all. A typical failure was an orphan component left disconnected from root.
The A2UI SDK caught these cleanly and returned a clear diagnostic error. When validation fails, we pass that exact error message back to the model and ask it to repair the JSON. In our tests, a single retry was enough to recover almost every malformed layout.
5. Isolate Package Version Conflicts
This was our biggest time sink.
- The A2UI packages depended on an older major version of
zod, while our application already ran on the newer major version. - Forcing our newer version via overrides broke A2UI on import.
- Letting the older version’s types leak across the codebase made TypeScript type-checking crawl, spiked memory usage, and even crashed our build.
The fix was strict containment: we installed the older zod under a package alias and imported that alias inside one isolated file only. A lint rule forbids importing the alias anywhere else in the repository. Both versions now coexist without slowing down the compiler.
6. Wrap Young Packages Behind a Thin Boundary
The A2UI protocol specification is at version 1.0, while the implementation packages we used were still at 0.x.
To protect the rest of the app from churn:
- We pinned exact package versions instead of using caret ranges.
- We upgrade all A2UI packages together as a single unit.
- We confined all A2UI integration code to two small files — one on the server and one in the browser.
If a 0.x update introduces a breaking API change, we fix two files and move on.
7. Load the Surface as Client-Only
In React, A2UI renders through browser custom elements that rely on client-side DOM registration. That rules out server-side rendering (SSR) for the report surface.
We load the dashboard surface as a client-only component. Because our reports generate dynamically after a user submits a prompt, skipping SSR had zero impact on initial page load or SEO. If you need AI-generated layouts to be pre-rendered at request time, factor this constraint in early.
8. Design Saved Reports for Catalog Evolution
Users save generated dashboards and come back to them weeks later. Meanwhile, our component catalog and metric identifiers keep evolving.
To keep saved layouts from breaking silently, we follow three rules:
- Append-only data IDs: Add new metric identifiers freely, but never rename or delete existing ones.
- Keep old catalog versions registered: The renderer continues to recognize prior catalog revisions.
- Version every saved report: Store the exact catalog version alongside the saved JSON layout.
Six Tips Before You Try A2UI
If you are considering A2UI for a similar workflow, a few habits will save you hours:
- Run the quickstart first. Trace how messages move from agent to renderer before designing your own schema.
- Design the catalog before writing prompts. Your catalog is the real guardrail.
- Check protocol version parity. Many community renderers still target older protocol drafts — verify compatibility before committing.
- Always validate on the server. Never pass raw model output straight to a browser renderer.
- Keep real data out of the model’s hands. Separate layout composition from data retrieval.
- Pin and isolate your packages. Wrap
0.xdependencies behind thin adapters and upgrade them together.
Final Thoughts
A2UI gave us a clean contract between the AI and our application. The model chooses how to tell the story. Our code draws the interface and guarantees every fact on screen.
The ecosystem is still early, and the packaging requires defensive engineering. For a safe, dynamic analytics dashboard that respects a consistent design system, it proved to be a strong fit.
If you are building dynamic interfaces with A2UI — or took a different path with OpenUI or a custom schema — I would love to hear how it held up in production.
References: A2UI Quickstart and the A2UI Protocol Site.