a2ui README

项目的 README,来自 github.com/a2ui-project/a2ui。合并为一个 markdown 文件:README.md。

A2UI

Build delightful, fast, reliable agentic experiences

A2UI (Agent-to-User Interface) is an open-source generative UI framework, complete with a protocol optimized for streaming dynamic user interfaces at low latency, native renderers for web and mobile frameworks, and agent SDKs in several popular languages. With A2UI, your agents can communicate with your users using natively rendered widgets, in addition to text.

Gallery of A2UI components

Examples of UI compositions that A2UI can express.

Introduction

Large language models (LLMs) and decision models (e.g. Jev) excel at creating text and code and at making fast decisions on top of raw structured data (e.g. JSON). A2UI gives these models a specialized vocabulary for expressing user interfaces.

A2UI expresses UI using data, not code. A schema for the data exchanged between the agent and the renderer enforces strict capability boundaries for the agent, keeping agent-generated experiences safe and aligned with the business requirements of your application. A core library, a native framework adapter, and a catalog of components provide access to native components and form the building blocks that the agent composes into a final user experience, making the result expressive and high-performance.

When to use A2UI

Use A2UI when any of the following apply to your application:

A2UI core philosophy

We develop A2UI under the guidance of the following core principles:

Architecture

A2UI's architecture is made of multiple layers spanning the full stack that connects the agent to the application:

  1. Inference: An agent (typically backed by a language or a decision model) instructed by an A2UI skill (created using an A2UI Agent SDK) generates the description of UI and data using an appropriate inference format (e.g. A2UI Express, or a decision tree).
  2. Transport: An A2UI Agent SDK, embedded in a larger agent architecture, parses and validates the model's output, expands macros, and converts the UI to the wire-stable A2UI Transport protocol messages, which are sent to the renderer.
  3. Rendering: A renderer is made of an A2UI Core library (e.g. the @a2ui/web_core npm package, or a2ui_core Dart package), a UI framework adapter (e.g. @a2ui/react React adapter, or a2ui_flutter Flutter adapter), and a widget catalog. The core library parses the incoming messages and creates a framework-agnostic in-memory representation of the UI and data. The framework adapter maps the in-memory representation to concrete framework-specific UI widgets. The widget catalog provides access to the widgets the agent is allowed to compose.

Getting started

Pick the path that matches where you want to start:

Path What you get Time
🍜 Quickstart A full-stack A2UI app with a backend and frontend. Learn A2UI end-to-end and customize to your use case. ~5 min
🎨 A2UI Composer Generate A2UI JSON from a visual editor and paste it into any agent prompt, with no install required. ~1 min
🎬 A2UI Theater Step through pre-built A2UI streaming scenarios across Lit, React, and Angular renderers, with no install required. ~1 min

Packages

These packages are developed in this repository. Packages marked "Not published yet" can be used from source.

Python

Package Description Version
a2ui-core Protocol messages, data model, data binding, expression evaluation, and catalog validation. PyPI
a2ui-agent-sdk Agent SDK: negotiates catalogs, generates prompts and skills, and compiles model output into A2UI. PyPI
a2ui-a2a Connects the agent SDK to the Agent-to-Agent (A2A) protocol. PyPI
a2ui-adk Connects the agent SDK to the Agent Development Kit (ADK). PyPI

TypeScript

Package Description Version
@a2ui/web_core Protocol messages, state management, expressions, and basic catalog shared by renderers and @a2ui/agent. npm
@a2ui/lit Lit (web components) renderer. npm
@a2ui/angular Angular renderer. npm
@a2ui/react React renderer. npm
@a2ui/markdown-it Markdown rendering with markdown-it and DOMPurify, shared by the web renderers. npm
@a2ui/agent Agent SDK: negotiates catalogs, generates prompts and skills, and compiles model output into A2UI. npm
@a2ui/catalog-mcp MCP catalog: calls MCP tools and renders A2UI messages returned in tool results and UI resources. npm
@a2ui/sandbox Double-iframe sandbox proxy and host-side helpers for embedded web apps and frame catalogs. Not published yet
@a2ui/catalog-vegachart VegaChart catalog: renders Vega and Vega-Lite chart specifications on A2UI surfaces. Not published yet

Dart and Flutter

Package Description Version
a2ui_core Protocol messages, data model, data binding, and expressions for renderers and agents. pub
a2ui_agent Agent SDK: negotiates catalogs, generates prompts, and compiles model output into A2UI. pub
a2ui_flutter Flutter renderer. pub
a2ui_cli Developer tool that validates catalog schemas and generates typesafe component code. GitHub Releases

Swift

The Swift libraries are distributed via Swift Package Manager from Package.swift at the root of this repository.

Package Description
A2UISwiftCore, BasicCatalog Message processor, data model, expression evaluation, and basic catalog definitions.
A2UISwiftUI, BasicCatalogSwiftUI SwiftUI renderer and basic catalog views.

Roadmap

The A2UI roadmap tracks the five-stage workflow for shipping and improving an agentic UI:

Stage Available today On the roadmap
Build JSON Schema catalogs, Basic Catalog, official renderers, Universal Web Components, a2ui codegen and a2ui lint, and Composer. Declarative design-system primitives, a cross-platform runtime templating engine, and a sandbox for shared component logic.
Configure Skill generation (SkillGenerator) in Python, TypeScript and Dart, catalog negotiation, swappable inference formats (such as Express), live surface validation, and ADK and A2A integrations. Official support for decision models (such as Jev), clearer skill-generator diagnostics, and more agent framework integrations.
Evaluate Inspect AI eval/ suite (schema checks, assertions, and an LLM judge) plus inference format benchmarks. Guidance and tooling to evaluate your own agents and catalogs with deterministic rules, configurable LLM judges, and tool-usage judges.
Distribute Web, desktop, and mobile renderers, rendering A2UI inside MCP Apps, and embedding MCP Apps via @a2ui/catalog-mcp. Shared state between A2UI and the MCP host when A2UI runs inside an MCP App, plus guides for AI assistants and messaging apps.
Monitor Renderer-to-agent user action and function result messages. Logging guidance and feedback loops that turn usage signals into component updates.

The A2UI CLI covers the Build stage today. Support is planned for every stage so you or a coding agent can run the workflow from a terminal. The A2UI coding-agent skill teaches coding agents to work with A2UI. The protocol evolves alongside this tooling, with version status in specification/versions.json and feature proposals in GitHub Discussions.

Contribute

A2UI is an Apache 2.0 licensed project. We believe the future of UI is agentic, and we want to work with you to help build it.

See CONTRIBUTING.md for details on how to get started.

a2ui (a2ui-project/a2ui)

正在搜索数据库…

17.6K ·GitHub
这是什么?A2UI 是一套开放协议和代码库,让 AI 智能体发送声明式的 JSON 界面描述,再由客户端应用使用自身的原生组件(如 Flutter、Angular、Lit、React 等)进行渲染,而不是执行智能体生成的代码。
它是 UI 框架,还是更像一种数据协议?它是协议或数据格式,而不是渲染框架:智能体输出一个扁平的 JSON 组件列表,组件之间通过 ID 相互引用,客户端再把这份抽象描述映射到自己的原生控件库上。
我该怎么试用?最简单的免安装方式是使用 A2UI Composer 或 Theater 演示;如果想在本地完整运行,可以试试 Quickstart Restaurant Finder 演示,它会启动一个由 Gemini 驱动、搭配 Lit 渲染器的 ADK 智能体;也可以通过 AG-UI CLI 为你所用的框架搭建一个 AG-UI 应用脚手架。
运行 Restaurant Finder 演示需要安装哪些东西?需要安装启用了 Corepack 的 Node.js 18+、uv,以及一个 Gemini API 密钥。
这个规范现在稳定到可以拿来开发吗?还不行。它目前是早期公开预览版,协议版本为 v0.9.1(v0.8 为旧版,v1.0 仅为候选发布版),因此预计会出现不兼容的变更。
目前哪些框架真正能渲染 A2UI?目前官方支持 Web(通过演示使用 Lit、Angular、React)和 Flutter(通过 GenUI SDK);React、Jetpack Compose 和 SwiftUI 还在路线图中。
A2UI 如何确保智能体生成的界面可以安全渲染?客户端维护一份可信的、预先批准的组件目录(例如 Card、Button、TextField),智能体只能从该目录中请求组件,而不能发送可执行代码。
智能体能否在对话过程中更新界面,而不是整体重新生成?可以。界面是由带 ID 引用的扁平组件列表构成的,LLM 很容易逐步生成这种结构,因此随着对话继续,界面可以渐进式、即时地更新。
A2UI 如何与 A2A 等智能体传输协议衔接?A2UI 的载荷与传输方式无关,可以通过 A2A Protocol、AG-UI 等现有智能体通信协议发送,因此任何能输出 JSON 的模型都能驱动它。
A2UI 中的“Smart Wrapper”是什么?它是一种注册表模式,开发者可以把服务端的组件类型映射到自定义的客户端实现上,例如原生控件、React 组件或沙箱 iframe,同时安全策略仍由开发者自己掌控。
大小
294.2 MB
星标
17.6K
时长
1年
提交 · 90 天