Fundamentals
What are AG-UI and A2UI? Generative UI protocols
By the RoutMe team. Last updated .
AG-UI and A2UI are open protocols for agent-driven interfaces. AG-UI is an event-based protocol that standardizes how an AI agent streams messages, tool calls and state to a user-facing app. A2UI is a generative UI specification that lets an agent describe interface components, such as cards and buttons, as data for the app to render.
Three layers, three protocols
The AG-UI documentation describes three agentic protocol layers. MCP covers the agent-to-tools-and-data layer. AG-UI covers agent-to-user interaction. A2UI is a generative UI specification that sits alongside AG-UI: A2UI says what to render, AG-UI carries it to the frontend.
| Protocol | Layer | Job |
|---|---|---|
| MCP | Agent to tools and data | Discover and call tools such as "get order" |
| AG-UI | Agent to user interface | Stream text, tool-call progress and state to the app |
| A2UI | Interface description | Describe components for the app to render |
What AG-UI streams
An agent turn is a sequence of typed events rather than one blob. In RoutMe's chat API, a turn includes a run start, text message start, content and end events, tool call start, arguments, end and result events, a custom event carrying UI, and a run finish. The tool call events are the useful ones for shoppers: the widget can say "checking your order" while a lookup runs, instead of showing a blank spinner. See the RoutMe event stream reference.
What A2UI describes
A2UI payloads are declarative data: a tree of components and the values to put in them. They are not code. The client holds a catalog of components it knows how to draw, and anything outside that catalog is ignored.
In RoutMe's catalog, components include text, image, card, row, column, list, button, text field, product card and order status. The documentation states that components not in the catalog, or fields the catalog does not define, are dropped on the server before reaching the stream, and that one surface carries at most 24 components.
Why a closed catalog matters
If a model could emit arbitrary markup, a mistake or a manipulated prompt could inject something harmful into your page. With a closed catalog, the worst case is a wrong card. Actions are also constrained: in RoutMe, a button click becomes the next turn's input to the assistant rather than a direct change to your data, so the read-only boundary still holds.
What it looks like for a store
- A shopper asks where an order is. The assistant calls a read-only tool and renders an order status card with the order number, status and estimate.
- A shopper describes a jacket. The assistant renders product cards with a price and an action.
- The assistant needs a size. It shows quick replies the shopper can tap.
Each one is clearer than a paragraph, and each is generated from live tool results. See product discovery chat.
Building your own interface
RoutMe offers a prebuilt widget, a React library with a useViveChat hook and an A2UISurface renderer, and a headless client that yields AG-UI events directly. If you build your own, you render the catalog yourself, which is documented at docs.routme.io/chat. A custom components builder is in progress and listed as coming soon.
What to check if you build your own renderer
If you render the catalog yourself, treat every field as untrusted text. Escape it, never inject it as markup, and only link http and https URLs. Handle an unknown component by skipping it rather than failing the whole surface, since catalogs grow over time. Show tool-call events as honest progress text, and give the visitor a way to retry when a run ends in an error. Finally, keep the action path boring: a click should send a named action with a small context object back to the same endpoint a typed message uses, so that the assistant sees one input type and your read-only boundary stays in one place.
Sources
Explore the product: RoutMe for Shopify, solutions and the documentation.