# A2UI: Building Native Interfaces for AI Agents

A chat response is a limited interface for operational work. An assistant can describe an incident, but acknowledging it, changing its severity, and inspecting related logs require structured controls with a reliable connection to application state. Generating another paragraph does not provide that connection.

[A2UI](https://a2ui.org/) gives an agent a way to describe an interface that the host application renders using its own components. **The agent proposes a structured view; the application retains responsibility for rendering, data access, and authorized actions.** That separation makes it possible to serve the same interaction through a web application and a native mobile client without asking a model to invent a new application on every turn.

<iframe class="aspect-video h-auto" width="100%" height="315" src="https://www.youtube.com/embed/qFAbevIeJN0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

## A declarative interface between agent and application

In the catalog-based A2UI path, the agent sends structured messages describing components and their data. The client interprets those messages and constructs an interface using implementations it already knows. A card in the protocol becomes a real card in the application, with the application's styling, accessibility behavior, and event handling.

This creates a useful boundary around generated content. A model does not need to send arbitrary HTML and JavaScript to display a form or a status card. It describes a view through an agreed vocabulary. The host decides which vocabulary is available and how each component behaves.

![A structured surface message describes components for a native client rather than sending a complete web page](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/b4327678-a6fe-4119-276f-f95eec8b1b00/lg1x =1920x1080)

That boundary also changes the developer's job. Instead of treating every response as opaque text, the application handles a protocol with a schema, component identifiers, state updates, and actions. The model becomes one producer of structured application state rather than the owner of an unrestricted browser environment.

It is still important to treat model output as untrusted input. Declarative components do not automatically make every string, image URL, or action safe. The client must validate messages, restrict supported components, and apply its ordinary rules for external resources and user content. Server-side authorization remains necessary even when a button was produced by a trusted renderer.

## A shared catalog keeps clients consistent

A catalog defines the available components and their properties. The basic catalog includes familiar building blocks such as text, images, rows, columns, lists, cards, buttons, text fields, and choice controls. A model can combine them into an interface while remaining within a defined set of capabilities.

![The basic component catalog provides the vocabulary that both the agent and renderer understand](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/892fcfbd-a8c0-4613-6eb1-f293b76f9a00/lg2x =1920x1080)

The catalog is a contract between three parties: the agent that generates a description, the server that validates or expands it, and the client that renders it. A component name that exists only in the prompt is not enough. Each supported client needs an implementation with compatible properties and behavior.

This is particularly relevant across platforms. A React application and a SwiftUI application can render the same logical surface while using different native controls. Shared semantics do not require pixel-identical output. The useful consistency is that the same field has the same meaning, the same action reaches the same backend operation, and the same state update produces a coherent result.

Catalog versioning makes that consistency explicit. If a server emits a component or message shape from a newer protocol version than a client supports, rendering can fail even though the transport works. A deployment therefore needs a tested combination of protocol, catalog, and renderer versions. Package names alone are insufficient evidence of compatibility.

Custom catalogs can narrow the agent's choices further. An incident-management application may prefer a reviewed incident card over a free-form assembly of dozens of generic elements. That reduces the amount of structure the model must produce and keeps operational behavior inside application code.

## Surfaces and data have separate lifecycles

A surface is a region of interface managed through the protocol. Its component structure describes what appears, while a data model supplies values that can change. Separating those concerns allows an application to update a status or list without regenerating an entire layout.

Version 1.0 brings surface creation into a consolidated message and supports function calls between the agent and renderer. The [project repository](https://github.com/a2ui-project/a2ui) tracks the protocol and implementations; integrations should use the matching schema rather than assuming examples from older versions remain interchangeable.

![A surface message and bidirectional function calls connect the Python agent to the application](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/bbd1c9b1-4410-4fc2-5138-c1e33cc49400/md2x =1920x1080)

The separation is useful for live data. A new incident can arrive after the agent has already returned a view. The backend can update the data associated with that view, and the client can render the change without another language-model request. The surface remains interactive even when the model is idle.

That does not mean every update should bypass the agent. A request to investigate a new failure may require reasoning and tool use. A severity value changing from one known state to another often does not. Routing these two kinds of work differently avoids paying for a model round trip just to keep ordinary application state current.

There is also a concurrency issue. A model response and a server event may arrive close together. The application needs clear ownership of the canonical state so that an older generated description does not overwrite a more recent acknowledgment. This is an application-state problem, even when A2UI supplies the message structure used to express updates.

## The SDKs connect generation to rendering

On the server, the agent integration supplies the model with the catalog and expected output format, then processes the result into protocol messages. In the Python example, a request processor receives the basic catalog and an Express-format factory. Its prompt snippet describes the structure the model should produce.

![The Python agent setup connects a catalog and Express output format to the request processor](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/35db7cf5-f274-43cd-26dd-8ee356d6b700/public =1920x1080)

The client receives those messages over a transport such as Server-Sent Events, or SSE, or a WebSocket connection. SSE is a server-to-client event stream; it is useful for delivering incremental changes without requiring a fresh request for every update. The protocol description and the transport are separate concerns.

The React example uses a message processor and a surface component. The SwiftUI example registers the corresponding basic catalog implementation and processes incoming messages into native views. These are two renderer implementations connected to the same server behavior.

![React and SwiftUI clients process the same protocol while rendering through their own UI systems](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/0ce77436-413b-439b-5d42-8d53e5d97d00/md1x =1920x1080)

The practical value is a reusable application contract. The server can select an incident card, request user input, or update state without hard-coding an HTML fragment that only a browser can understand. Each client still controls navigation, typography, accessibility, and platform-specific interaction.

The trade-off is implementation responsibility. A protocol does not supply every platform feature your product needs. Keyboard interaction, focus, screen-reader labels, loading states, and error handling still need attention in the renderer and application. A native appearance is useful only if native interaction works reliably too.

## An incident interface can update without another model call

A controlled incident example connects a Python agent to a React browser client, a SwiftUI phone client, and a Better Stack backend. The incident is explicitly synthetic, with illustrative error-rate, latency, and affected-user values. Its purpose is to show the data path rather than diagnose an actual production outage.

When a backend event creates the incident, the server expands an incident-card representation and pushes the resulting interface to the clients. That update does not require asking the model to restate the same operational facts.

![A server event pushes the incident card to the clients without an additional model request](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/0d711b1d-8ed7-4f3f-1439-6db3daf4a600/public =1920x1080)

This is a more precise architecture than calling every dynamic screen an AI-generated application. Some transitions are ordinary software behavior: receive an event, fetch a record, construct a known view, and deliver state. The agent adds value when deciding which view or investigation is relevant, while deterministic application code handles repeatable updates.

The same distinction applies to a live log panel. A model might choose to display relevant logs, but individual arriving lines can flow from the backend to a reviewed component. Making every line pass through a model would introduce avoidable latency, cost, and data exposure.

A production integration also needs reconnection behavior. A phone can lose connectivity while the browser continues receiving events. Restoring the connection should recover current backend state rather than assume that every incremental update arrived. Persistent operational truth belongs in the backend, not solely in a client's last rendered card.

## Buttons must lead to authorized backend actions

The incident card includes actions such as acknowledging an incident and changing severity. A client interaction becomes an event or function call, the server applies the corresponding backend operation, and the resulting state is delivered to the relevant clients.

![An acknowledgment and severity update propagate between the rendered card and the incident backend](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/002893d5-52f2-4b60-cdd8-b91c04212900/md1x =1920x1080)

The renderer's ability to display **Acknowledge** does not grant permission to acknowledge any incident. The server must validate the authenticated user, incident identity, and allowed operation. The model's output is a proposed interaction, not an authorization decision.

This becomes particularly important when action arguments include identifiers. A surface may display one record while a malicious or stale message attempts to act on another. Server-side checks should bind the operation to the user's actual access and validate its parameters independently of whatever text accompanied the card.

Reliable actions also need failure states. If a backend rejects an operation, an optimistic visual update should not remain as if the action succeeded. Duplicate clicks and reconnects need careful handling so that the interface communicates the final recorded state rather than the number of times a client attempted a request.

A2UI can structure these interactions, but the guarantees come from the surrounding application design. Audit logs, idempotent operations, explicit errors, and authoritative state remain necessary for an operational interface.

## Macros reduce repeated layout generation

A recurring card does not need to be described from low-level components every time. [A2UI macros](https://a2ui.org/guides/macros/) let server code expand a compact model-selected representation into a complete component structure. The model chooses a useful abstraction, and deterministic code assembles the detailed view.

The incident example expands approximately 170 characters of Express representation into about 5,910 characters of A2UI JSON. The roughly 35-fold difference describes character counts for that one representation. It is not a measured 35-fold reduction in tokens, end-to-end request cost, or total application traffic.

![A compact macro expression expands on the server into a much larger component description](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/d00aa7cf-38ed-4124-85b0-9b7554925e00/lg1x =1920x1080)

The saving is still meaningful. A model no longer has to reproduce every nested row, label, and property in a recurring pattern. The server implementation can keep formatting and action wiring consistent, while the catalog limits which abstractions are available.

Macros also provide a useful data boundary. The model can select an incident by identifier, and server code can fetch the relevant metrics or logs while constructing the view. In that design, detailed records can flow directly to the renderer instead of being included in the model's context.

![Server-side macro implementations fetch the data used to construct the selected incident and log views](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/41a353f0-0bf9-4cac-41fd-af09d6376c00/lg1x =1920x1080)

This is a property of the chosen architecture, not automatic privacy supplied by the protocol. Identifiers, titles, prompts, tool results, and conversation history may still reach the model. A careful data-flow review must account for all of those paths rather than only the component payload.

Macros also concentrate responsibility in server code. A macro that queries too broadly, exposes an unrestricted URL, or invokes a privileged operation can undermine the intended boundary. Reviewed parameters and explicit access checks matter as much as the compact output format.

## Final thoughts

A2UI gives agents a structured way to participate in application interfaces while letting clients retain native rendering. Catalogs define the available components, surface updates carry changing state, and macros move repetitive layout construction into deterministic server code.

**The strongest design uses the model for selection and reasoning while ordinary application code owns data and actions.** That division can reduce unnecessary generation and support coherent web and mobile experiences. It also makes the remaining responsibilities clear: version compatibility, validation, authorization, reconnection, and accessible renderer behavior all remain part of building a reliable product.
