Skip to content

Core Concepts ​

A2UI is more than just a renderer; it's a protocol for safe, deterministic, and streaming UI generation from AI agents.

The Problem ​

When building Generative UI, you often face a dilemma:

  1. Raw HTML: Asking the LLM to write HTML/JSX is flexible but unsafe (XSS risks) and often broken (hallucinated classes/tags).
  2. Hardcoded Widgets: Manually mapping JSON to components is tedious and hard to maintain.

The A2UI Solution ​

A2UI sits in the middle: "The Bridge".

1. Safety & Determinism ​

Instead of code, the AI generates a strict JSON schema. The a2ui-renderer validates this schema against your actual React components. If the AI "hallucinates" a prop that doesn't exist, the renderer catches it safely.

2. Streaming (The "Magic") ​

The A2UI protocol is designed to be streamed. React components can render partially as the JSON arrives.

  • Token 1: { "type": "Card", "loading": true } -> Renders a Skeleton Card.
  • Token 10: { "type": "Card", "title": "Weather" ... } -> Updates title.
  • Token 50: { ... "children": [ ... ] } -> Renders children.

This "stream-to-UI" capability makes the AI feel instantaneous.

Architecture ​

Architecture Diagram

  1. Scanner: Reads your source code -> Generates catalog.json (Tools for AI).
  2. AI Agent: Receives User Prompt + catalog.json -> Generates A2UI JSON Stream.
  3. Renderer: Receives JSON Stream -> Renders React Components.