π This is a fork of google/A2UI with a complete Android Jetpack Compose Renderer implementation.
A2UI-Android is a powerful, production-ready Android rendering engine for the A2UI Protocol that enables your Android apps to dynamically render beautiful, interactive user interfaces generated by AI agents.
Imagine your AI assistant being able to create rich, native Android UIs on-the-fly instead of just text responses - forms with validation, data dashboards, interactive cards, and more. That's what A2UI-Android makes possible!
| π€ AI-Powered UIs | π Secure by Design | β‘ High Performance |
|---|---|---|
| Let AI agents generate native Android interfaces dynamically | Declarative JSON format - no arbitrary code execution | Optimized with rememberSaveable, lazy rendering, and smart recomposition |
| π¨ Fully Customizable | βΏ Accessible | π± Wide Compatibility |
|---|---|---|
| Dynamic themes, colors, dark mode, custom components | WCAG A compliant with full TalkBack support | Android 5.0+ (API 21) - covers 99%+ of devices |
- 20+ Ready-to-Use Components: Text, Button, TextField, Card, List, Modal, Tabs, Slider, DatePicker, and more
- Smart Data Binding: Two-way binding with path expressions (
/user/profile/name) - Built-in Validation: Email, URL, phone, regex, length, required fields - all out of the box
- Real-time Updates: WebSocket and SSE transport for live UI updates from agents
- State Persistence: Survives configuration changes, process death, and screen rotations
- Beautiful Animations: Smooth transitions and modal animations built-in
- Comprehensive Testing: 49+ unit tests with 100% core functionality coverage
Text β’ Button β’ TextField β’ CheckBox β’ Switch β’ Slider
ChoicePicker β’ Dropdown β’ Card β’ Row β’ Column β’ List
Tabs β’ Modal β’ Image β’ Icon β’ Divider β’ Spacer
ProgressBar β’ DateTimeInput β’ Video β’ AudioPlayer β’ Surface
@Composable
fun A2UIScreen() {
val renderer = rememberA2UIRenderer()
// Process A2UI message
renderer.processMessage("""
{
"version": "v0.10",
"createSurface": {
"surfaceId": "hello",
"catalogId": "https://a2ui.org/catalog.json"
}
}
""")
// Render UI
A2UISurface(surfaceId = "hello")
}Add the compose module to your project:
// settings.gradle.kts
include(":android_compose")
// build.gradle.kts
dependencies {
implementation(project(":android_compose"))
}See android_compose/README.md for complete documentation including:
- Architecture overview
- Component reference
- Theme customization
- Network integration
- Error handling
- Testing guide
A2UI is an open standard and set of libraries that allows agents to "speak UI." Agents send a declarative JSON format describing the intent of the UI. The client application then renders this using its own native component library.
- Security First: Declarative data format, not executable code
- LLM-Friendly: Flat component list, easy for LLMs to generate incrementally
- Framework-Agnostic: Same JSON payload renders on multiple platforms
- Flexibility: Open registry pattern for custom components
| Platform | Status | Location |
|---|---|---|
| Android (Compose) | β Complete | android_compose/ |
| Web (Lit) | β Available | renderers/lit/ |
| Flutter | β Available | GenUI SDK |
| React | π Planned | - |
| iOS (SwiftUI) | π Planned | - |
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β A2UI Agent ββββββΆβ Transport ββββββΆβ Renderer β
β (Backend) β β WebSocket/SSE β β (Compose) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β
β JSON Message β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β { β
β "version": "v0.10", β
β "createSurface": { "surfaceId": "main", ... }, β
β "updateComponents": { "components": [...] } β
β } β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Android Studio Hedgehog (2023.1.1) or later
- Android SDK 21+ (Android 5.0 Lollipop)
- Kotlin 1.9.22
- JDK 17
-
Clone the repository:
git clone https://github.com/lmee/A2UI-Android.git cd A2UI-Android -
Open in Android Studio:
- Open Android Studio
- Select "Open an existing project"
- Navigate to the cloned directory
-
Run the app:
- Select a device or emulator
- Click "Run" or press
Shift+F10
For the original web-based demo:
# Set API key
export GEMINI_API_KEY="your_gemini_api_key"
# Run Agent
cd samples/agent/adk/restaurant_finder
uv run .
# Run Client (new terminal)
cd renderers/web_core && npm install && npm run build
cd ../lit && npm install && npm run build
cd ../../samples/client/lit/shell && npm install && npm run devA2UI/
βββ android_compose/ # π Android Compose Renderer
β βββ src/main/java/org/a2ui/compose/
β β βββ data/ # Data model & processing
β β βββ rendering/ # Core renderer & components
β β βββ transport/ # Network layer (WebSocket/SSE)
β β βββ theme/ # Theme customization
β β βββ error/ # Error handling
β β βββ example/ # Demo application
β βββ src/test/ # Unit tests (49 tests)
β βββ build.gradle.kts # Build configuration
β βββ README.md # Full documentation
βββ renderers/
β βββ web_core/ # Web core library
β βββ lit/ # Lit renderer
βββ samples/
β βββ agent/ # Agent examples
β βββ client/ # Client examples
βββ docs/ # Documentation
βββ specification/ # A2UI specification
// Define UI via JSON
val message = """
{
"version": "v0.10",
"updateComponents": {
"surfaceId": "form",
"components": [
{
"id": "email_field",
"component": "TextField",
"label": "Email",
"value": { "path": "/form/email" },
"required": true,
"checks": [
{ "call": "email", "message": "Invalid email format" }
]
},
{
"id": "submit_btn",
"component": "Button",
"text": "Submit",
"action": { "event": { "name": "submit_form" } }
}
]
}
}
"""val themeConfig = A2UIThemeConfig(
primaryColor = "#6200EE",
secondaryColor = "#03DAC6",
darkMode = false
)
A2UITheme(config = themeConfig) {
A2UISurface(surfaceId = "main")
}Note: A2UI is currently in v0.10 (Public Preview). The specification and implementations are functional but are still evolving.
- Android Compose Renderer (Complete)
- React Renderer
- iOS SwiftUI Renderer
- REST Transport Support
- Additional Agent Frameworks (Genkit, LangGraph)
A2UI is an Apache 2.0 licensed project. We welcome contributions!
See CONTRIBUTING.md for details.
# Clone and setup
git clone https://github.com/lmee/A2UI-Android.git
cd A2UI-Android
# Run tests
./gradlew :android_compose:test
# Build
./gradlew :android_compose:buildThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Android Compose Renderer: android_compose/README.md
- A2UI Specification: specification/
- GenUI SDK (Flutter): https://github.com/flutter/genui
- CopilotKit Widget Builder: https://go.copilotkit.ai/A2UI-widget-builder
Maintained by the A2UI Community
