Receber por email
← Voltar para o catálogo

a2ui

Official project site with documentation

185estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add AbsolutelySkilled/AbsolutelySkilled

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/a2ui/svg)](https://www.skillteca.com.br/skills/a2ui)

Skills relacionadas

Ver todas de Documentos →

Alerta por categoria

Receba novas skills de Documentos toda segunda

1 email curto, só com as skills novas de Documentos. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

When this skill is activated, always start your first response with the 🧢 emoji.

A2UI - Agent-to-User Interface Protocol

A2UI is an open-source protocol from Google that enables AI agents to generate rich, interactive user interfaces through declarative JSON rather than executable code. It solves the critical challenge of safely transmitting UI across trust boundaries in multi-agent systems - agents describe UI intent using a flat list of pre-approved components, and clients render them natively across web, mobile, and desktop. The format is optimized for LLM generation with streaming support, incremental updates, and framework-agnostic rendering.

When to use this skill

Trigger this skill when the user:

  • Wants to build an agent that generates A2UI JSON responses
  • Needs to set up a client renderer (Lit, React, Angular, Flutter) for A2UI
  • Is working with A2UI message types (surfaceUpdate, createSurface, etc.)
  • Wants to create or customize an A2UI component catalog
  • Needs to implement data binding between components and a data model
  • Is integrating A2UI with A2A Protocol or AG UI transport
  • Wants to handle client-to-server actions (button clicks, form submissions)
  • Is building custom components or extending the basic catalog

Do NOT trigger this skill for:

  • General UI framework questions unrelated to agent-generated interfaces
  • A2A Protocol questions that don't involve UI rendering

Setup & authentication

Environment variables

GEMINI_API_KEY=your-gemini-api-key

Agent-side installation (Python with Google ADK)

pip install google-adk
adk create my_agent

Client-side installation

# Lit (web components)
npm install @a2ui/web-lib lit @lit-labs/signals

# React
npm install @a2ui/react @a2ui/web-lib

# Angular
npm install @a2ui/angular @a2ui/web-lib

# Flutter
flutter pub add flutter_genui

Quickstart (full demo)

git clone https://github.com/google/a2ui.git
cd a2ui
export GEMINI_API_KEY="your_key"
cd samples/client/lit
npm install
npm run demo:all

Core concepts

Adjacency list model: A2UI uses a flat list of components with ID references instead of nested trees. This is easier for LLMs to generate incrementally and enables progressive rendering. Each component has an id, type, and properties.

Surfaces: A surface is a UI container identified by surfaceId. Components and data models are scoped to surfaces. Multiple surfaces can exist independently. A surface is locked to a catalog for its lifetime.

Data binding: Components connect to application state via JSON Pointer paths (RFC 6901). The data model is separate from UI structure, enabling reactive updates. Input components (TextField, CheckBox) bind bidirectionally.

Catalogs: JSON Schema files defining which components, functions, and themes an agent can use. The Basic Catalog provides standard components. Production apps define custom catalogs matching their design system. Agents can only request pre-approved components from the negotiated catalog.

Two specification versions:

| Version | Status | Key differences | |---------|--------|-----------------| | v0.8 | Stable | surfaceUpdate/dataModelUpdate/beginRendering, nested component syntax, literalString wrappers | | v0.9 | Draft | createSurface/updateComponents/updateDataModel, flat component syntax, direct strings, required catalogId |

Common tasks

Generate a v0.9 A2UI surface with components

Create a surface, add components, set data, in JSONL format (one JSON per line):

{"version": "v0.9", "createSurface": {"surfaceId": "main", "catalogId": "https://a2ui.org/specification/v0_9/basic_catalog.json"}}
{"version": "v0.9", "updateComponents": {"surfaceId": "main", "components": [
  {"id": "header", "component": "Text", "text": "Book Your Table", "variant": "h1"},
  {"id": "date-input", "component": "DateTimeInput", "label": "Select Date", "value": {"path": "/reservation/date"}, "enableDate": true},
  {"id": "submit-btn", "component": "Button", "child": "btn-text", "variant": "primary", "action": {"event": {"name": "confirm_booking"}}}
]}}
{"version": "v0.9", "updateDataModel": {"surfaceId": "main", "path": "/reservation", "value": {"date": "2025-12-15", "time": "19:00", "guests": 2}}}

Generate a v0.8 A2UI surface (legacy)

{"surfaceUpdate": {"surfaceId": "main", "components": [
  {"id": "header", "component": {"Text": {"text": {"literalString": "Book Your Table"}, "usageHint": "h1"}}},
  {"id": "date-picker", "component": {"DateTimeInput": {"label": {"literalString": "Select Date"}, "value": {"path": "/reservation/date"}, "enableDate": true}}},
  {"id": "submit-btn", "component": {"Button": {"child": "submit-text", "action": {"name": "confirm_booking"}}}}
]}}
{"dataModelUpdate": {"surfaceId": "main", "contents": [
  {"key": "reservation", "valueMap": [
    {"key": "date", "valueString": "2025-12-15"},
    {"key": "time", "valueString": "19:00"},
    {"key": "guests", "valueInt": 2}
  ]}
]}}
{"beginRendering": {"surfaceId": "main", "root": "header"}}
v0.8 requires beginRendering before the client renders. v0.9 renders on createSurface.

Handle client-to-server actions

Wire a button to dispatch an event with context from the data model:

{
  "id": "submit-btn",
  "component": "Button",
  "child": "btn-text",
  "action": {
    "event": {
      "name": "submit_reservation",
      "context": {
        "time": {"path": "/reservationTime"},
        "size": {"path": "/partySize"}
      }
    }
  }
}

Add validation checks that auto-disable the button:

{
  "checks": [
    {
      "condition": {"call": "required", "args": {"value": {"path": "/partySize"}}},
      "message": "Party size is required"
    }
  ]
}

Build an agent with Google ADK

from google.adk import Agent
import json
import jsonschema

# Load A2UI schema for validation
with open("a2ui_schema.json") as f:
    a2ui_schema = json.load(f)

AGENT_INSTRUCTION = """You are a restaurant booking agent.
When the user wants to book, generate A2UI JSON after the delimiter ---a2ui_JSON---
Output a JSON list of A2UI messages using the v0.9 format."""

agent = Agent(
    model="gemini-2.5-flash",
    name="booking_agent",
    instruction=AGENT_INSTRUCTION,
)

# Validate generated A2UI before sending
def validate_a2ui(json_string):
    parsed = json.loads(json_string)
    jsonschema.validate(instance=parsed, schema=a2ui_schema)
    return parsed

Use data binding with dynamic lists

Render a list of items from the data model using templates:

{"version": "v0.9", "updateComponents": {"surfaceId": "main", "components": [
  {"id": "product-list", "component": "List", "direction": "vertical",
   "template": {"dataBinding": "/products", "componentId": "product-card"}},
  {"id": "product-card", "component": "Card", "children": ["product-name", "product-price"]},
  {"id": "product-name", "component": "Text", "text": {"path": "/name"}},
  {"id": "product-price", "component": "Text", "text": {"path": "/price"}}
]}}
{"version": "v0.9", "updateDataModel": {"surfaceId": "main", "path": "/products", "value": [
  {"name": "Widget A", "price": "$9.99"},
  {"name": "Widget B", "price": "$14.99"}
]}}
Inside templates, paths are scoped to each array item (e.g., /name refers to the current item's name).

Set up a Lit web renderer

import { A2uiMessageProcessor } from '@a2ui/web_core/data/model-processor';
import { SurfaceModel } from '@a2ui/web_core/v0_9';
import type * as Types from '@a2ui/web_core/types/types';

// Process incoming JSONL stream
const processor = new A2uiMessageProcessor();
processor.onSurface((surfaceModel: SurfaceModel) => {
  // Render the surface using Lit components
  renderSurface(surfaceModel);
});

// Feed messages from transport
function handleMessage(jsonLine: string) {
  processor.processMessage(JSON.parse(jsonLi
Compartilhar X LinkedIn