React 渲染器依赖 @a2ui/web_core,直接引用消息处理器或基础目录时需显式安装;跑示例需自备 GEMINI_API_KEY 并启用 Corepack;macOS Homebrew 用户需先 brew unlink yarn pnpm 再装 Corepack 以免版本冲突
a2ui
a2ui-projectApache-2.0活跃维护开源生成式 UI 框架:智能体以流式输出布局数据,应用用 React、Angular、Flutter、SwiftUI 等原生组件实时渲染界面。
Open-source generative UI framework: agents stream layout data, and apps render it with native components in React, Angular, Lit, Flutter, SwiftUI and Jetpack Compose.
npm install @a2ui/react
# 或 Flutter:flutter pub add a2ui_flutter a2ui_coreREADME 未说明;仅要求宿主应用基于受支持框架(当前为 Web 或 Flutter),示例需 Node.js 18+ 与 Gemini API key。
让 Agent 用声明式 JSON 描述界面,客户端用原生组件安全渲染的生成式 UI 框架
开源生成式 UI 框架:智能体以流式输出布局数据,应用用 React、Angular、Flutter、SwiftUI 等原生组件实时渲染界面。
核心能力
- Agent 发送声明式 JSON 描述 UI 意图,不传可执行代码
- 客户端从预审组件目录中映射到原生组件渲染
- 扁平组件列表加 ID 引用,便于 LLM 增量生成与渐进渲染
- 同一份 JSON 可跨 React、Angular、Lit、Flutter、SwiftUI、Compose 渲染
- 提供开放注册机制,把自定义组件接入数据绑定与事件系统
容易踩的坑
- docs-assetsDocumentation Media Assets (Do Not Delete)pre-release2026-11-09 · 2026-11-09 05:46 UTC
查看更新说明
Immutable, content-addressed media assets referenced by docs/site/assets-manifest.json.
- python/a2ui-adk/v0.2.0a2ui-adk 0.2.02026-11-02 · 2026-11-02 02:38 UTC
查看更新说明
- BREAKING CHANGE:
GenAIFileResolveris removed, along with theFileResolverit extended ina2ui-agent-sdk. #3731 - BREAKING CHANGE:
SendA2uiToClientToolset(a2ui_enabled, a2ui_processor)takes the request'sA2uiRequestProcessor, or anA2uiProcessorProviderthat returns it per context, instead of catalogs and examples. The processor holds the catalogs, the example turns, the inference format and, for a canvas agent, the boundRendererState.A2uiCatalogsProviderandA2uiExamplesProviderare removed; markdown examples are no longer accepted, so pass example turns toA2uiGeneratororA2uiRequestProcessor. To migrate, putgenerator.create_processor(capabilities)in anA2uiProcessorStoreand passA2uiProcessorStore.getas the provider. A canvas agent binds itsRendererStateto the processor it puts there. #3299 - BREAKING CHANGE: The tool reads its argument, renamed from
a2ui_jsontoa2ui_payload, in the processor's inference format (Express by default) instead of always reading JSON. It compiles the payload with the format's parser, no longer withparse_and_fix, validates it against the processor's bound state or, without one, withvalidate_payload, and still returns A2UI JSON messages for the part converter. The prompt it adds comes from the format's prompt generator, and it skips each section (rules, catalogs, examples) that the agent's system instruction already holds, such as when the instruction includesprocessor.prompt_snippet. #3299 - BREAKING CHANGE:
A2uiPartConvertertakes the processor, plus the keyword argumentsbypass_tool_checkandfallback_text, instead ofcatalogs,parser,versionandstate. It reads text-based A2UI with the processor's parser and checks it against the processor's bound state, as a response that shows new UI when there is none, so a response that updates a surface it does not create is then rejected and logged. Each part is labeled with its message's protocol version. #3299 - BREAKING CHANGE:
A2uiEventConvertertakes the request's processor, or a provider that returns it or None, in the required keyword argumenta2ui_processor, instead of reading catalogs from session state. Itscatalogs_keyargument and thesystem:a2ui_catalogskey are removed. When the processor's format can stream, it opens oneResponseStreamper response, feeds it each partial ADK event, and closes it on the final event. A response is keyed by its invocation and its event's branch or author, so the sub-agents of aParallelAgentdon't share a stream. A stream that gets no event forstream_idle_timeoutseconds (600 by default), as when a run is cancelled, is dropped. #3299 A2uiProcessorStorekeeps each session's request processor in memory, since ADK's persistent session services save state as JSON and can't hold one. Itsgetandis_enabledmethods are providers forSendA2uiToClientToolsetandA2uiEventConverter. #3299SendA2uiToClientToolsetandA2uiEventConverterlog a warning when they get one processor for every request with aRendererStatebound to it, since every conversation would share that state. #3299A2uiEventConverternow streams responses in the defaultExpressFormatincrementally as statements and progressive strings arrive, rather than waiting for the closing</a2ui>tag. #3712- Tool and parse errors, which may quote the A2UI payload, are logged by type at warning level and in full only at debug level. [#3299
- BREAKING CHANGE:
- python/a2ui-a2a/v0.2.0a2ui-a2a 0.2.02026-11-02 · 2026-11-02 02:38 UTC
查看更新说明
create_a2ui_partlabels a part with the message's ownversionfield when noversionis passed, so a v0.9.1 or v1.0 message gets the current A2UI MIME type. #3299parse_content_to_partslogs a parse error, which may quote the response, by type at warning level and in full only at debug level. #3299
Published to PyPI: a2ui-a2a 0.2.0
pip install a2ui-a2a==0.2.0 - python/a2ui-agent-sdk/v0.10.0a2ui-agent-sdk 0.10.02026-11-02 · 2026-11-02 02:38 UTC
查看更新说明
- Add incremental streaming support for the Express inference format via
ExpressResponseStream(ExpressFormat.supports_streamingandExpressParser.supports_streamingnow returnTrue).ExpressFormatFactory,ExpressFormat, andExpressParseracceptprogressive_keys(defaulting toDEFAULT_EXPRESS_PROGRESSIVE_KEYS = frozenset({"text"})) to heal unclosed string literals in matching component properties and data path assignments as chunks arrive, while gating initialcreateSurfaceemission onroot = ...for new surfaces, emitting deltaupdateComponentsand per-pathupdateDataModelmessages on subsequent chunks, and holding statements with unresolved value variables until defined (#2896). - BREAKING CHANGE: Use
'1.0'(without a'v'prefix) as theversionfield on v1.0 protocol messages and capabilities in inference format compilers, parsers, decompilers, builders (a2ui.builder.v1_0),RendererState,resolve_catalogs, and prompt examples. #3097, #3726 - BREAKING CHANGE: The
a2ui.extensions.file_resolvemodule (FileResolver,FileResolverSecurityErrorandResolvedFileConverter) is removed, and the package no longer depends onhttpx. File pointers are not part of the A2UI protocol, so resolving them is left to the agent. #3731 - Add
ComponentBuilderNode.metadata,ComponentBuilderNode.with_extension(namespace, value), andset_surface_extensions(messages, *, surface_id=..., extensions=...)ina2ui.builder.v1_0with UAX 31 extension key validation, and support the reservedextensions=keyword argument onsurface(...)and component calls in v1.0 A2UI Express (ExpressCompilerandExpressParser.decompile) (#3708, #3757). - BREAKING: In Express (
ExpressCompiler), data path assignments ($/... = ...) in surface-updating scopes (scopes that do not create a surface withrootor carryupdate=true) now emit one targetedupdateDataModelmessage per assigned path at its JSON Pointerpathinstead of folding all assignments into a single rootupdateDataModelwithpath: "/"(which overwrote the entire surface data model on the renderer). Surface-creating scopes continue to fold data path assignments into a single root data model and now support list element traversal, canonical numeric-segment list auto-vivification, and full root replacement via$/ = {...}(#3677). - BREAKING CHANGE: When
ResponseStream.feedorcloseraises anA2uiError, itspartial_resultsholds the parts the call made ready before the failure, as forparse_response, and they stay applied to the stream'sRendererState. Before, a chunk that finished a block and then failed in the next one raised without those parts and rolled them back. Recommended migration: showerror.partial_resultsbefore ending the stream. #3597 - BREAKING CHANGE:
ResponseStreamis generic in the parts it returns (ResponseStream[ResponsePart]by default,ResponseStream[StreamPart]for a stream that reads past rejected blocks) and has an abstractis_in_blockproperty, so a subclass must implement it and an annotation must name the part type. #3597 - BREAKING CHANGE:
DirectJsonPromptGenerator.generate_base_rules()now returns the workflow rules followed by the protocol schemas (agent-to-renderer and pruned common types) and acceptsallowed_messages, whilegenerate_catalog_instructions()returns only the catalog schemas and dropsallowed_messages([#3526](https://github.com/a2ui-project/a2ui/i
- Add incremental streaming support for the Express inference format via
- python/a2ui-core/v0.5.0a2ui-core 0.5.0最新正式版2026-11-02 · 2026-11-02 02:38 UTC
- BREAKING CHANGE:
DataContextrefuses a function whoseallowed_callersisagentOnly, before running it, so a binding, check or function call action that calls one reports anEXPRESSION_ERRORinstead of running it, as the v1.0 specification requires.RpcHandlerstill runs such a function for an agent'scallRendererFunction. Recommended migration: setallowed_callerstorendererOrAgenton a function both the renderer and the agent call (#3483, #3773). - From v0.9, a component its catalog declares with no
ComponentIdorChildListproperty has no child references. Previously any of its string properties that named a component on the surface, such as anIconnamedmailinside theRowwhose id ismail, was read as one, so a valid surface could fail topology checks as a cycle. A property declared as a plain string is read as text, as the protocol's catalog rules require. v0.8 catalogs, and components a catalog does not declare, still infer references from property names and values. - BREAKING CHANGE: Unify the v1.0 protocol version wire value on
'1.0'(without a'v'prefix) across message envelopes, capability objects, and catalog documents (ProtocolVersion.V1_0.valueis now'1.0'), while continuing to accept'v1.0'inCatalog.from_json.Catalog.protocol_versionis typed asProtocolVersion | str. #3097, #3726 - BREAKING CHANGE:
validate_composition_constraintsandSurfaceComponentsModel.validate_components_updateapply the"Surface"allowedParentsrule only to the surface's root component (root_id,"root"by default), even when another component also references it, and check every parent of a component that has several, not only the last one in surface order. A non-root component that nothing references is no longer checked against"Surface"; the topology checks report it as an orphan, or allow it. This matches the specification and the TypeScript, Dart and Swift SDKs, and changes which payloads are accepted. (#3354, #3360) - BREAKING CHANGE: A
MessageProcessorwithout avalidation_config, as a renderer has by default, checks eachupdateComponentsagainst theallowedParentsandallowedChildrenrules of its catalogs, as the TypeScript and Dart SDKs do. Before, it checked nothing, so a payload that breaks those rules is now rejected. The check is skipped when no catalog of the surface's components declares such rules. #3360 - Add extension metadata APIs across
SurfaceModel(metadata,extensions,on_metadata_changed,set_extension,remove_extension, anddispatch_action(..., metadata=...)),ComponentModel(metadata,extensions,on_metadata_changed,set_extension,remove_extension),ComponentNode(metadataandon_metadata_changed),ComponentContextandGenericBinder(metadata,extensions, and optionalmetadataon bound action closures), andComponentApi(metadataparsed and serialized inCatalog.from_json()andCatalog.to_json()). FixMessageProcessorto store componentmetadataonComponentModel.metadataoutsideComponentModel.propertiesand validate UAX 31 extension keys on component creation as well as updates, and fix Pydantic code generation to emit a distinctActionMetadatawrapper model instead of colliding withExtensions(#3103, #3468, #3560, #3708, [#3757](http
- BREAKING CHANGE:
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
A2UI: Agent-to-User Interface
A2UI is an open-source generative UI framework, complete with a format optimized for representing updatable agent-generated UIs and an initial set of renderers, that allows agents to generate or populate rich user interfaces.
A gallery of A2UI rendered cards, showing a variety of UI compositions that A2UI can achieve.
Summary
Generative AI excels at creating text and code, but agents can struggle to present rich, interactive interfaces to users, especially when those agents are remote or running across trust boundaries.
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 (Flutter, Angular, Lit, etc.).
This approach ensures that agent-generated UIs are safe like data, but expressive like code.
When to use A2UI
- Use A2UI when you need agent-generated UI on Flutter, Angular, SwiftUI / Jetpack Compose, or more than one platform from the same agent.
- Use A2UI when the agent is remote, third-party, or across a trust boundary and must not send executable code to your renderer.
- Use A2UI on Flutter with
a2ui_flutter:flutter pub add a2ui_flutter a2ui_core. It replaces thegenuipackage. - You may not need A2UI for a React-only chat that renders tool results as your own components; an LLM toolkit alone may be enough. A2UI fits once you add platforms or remote agents.
Install the renderer for your framework, for example npm install @a2ui/react
(or @a2ui/angular, @a2ui/lit). It depends on @a2ui/web_core; add
@a2ui/web_core explicitly too if your app imports from it directly (e.g. the
message processor or basic catalog). See the
Client Setup guide for each platform.
High-level philosophy
A2UI was designed to address the specific challenges of interoperable, cross-platform, generative or template-based UI responses from agents.
The project's core philosophies:
- Security first: Running arbitrary code generated by an LLM may present a security risk. A2UI is a declarative data format, not executable code. Your client application maintains a "catalog" of trusted, pre-approved UI components (e.g., Card, Button, TextField), and the agent can only request to render components from that catalog.
- LLM-friendly and incrementally updatable: The UI is represented as a flat list of components with ID references which is easy for LLMs to generate incrementally, allowing for progressive rendering and a responsive user experience. An agent can efficiently make incremental changes to the UI based on new user requests as the conversation progresses.
- Framework-agnostic and portable: A2UI separates the UI structure from the UI implementation. The agent sends a description of the component tree and its associated data model. Your client application is responsible for mapping these abstract descriptions to its native widgets—be it web components, Flutter widgets, React components, SwiftUI views or something else entirely. The same A2UI JSON payload from an agent can be rendered on multiple different clients built on top of different frameworks.
- Flexibility: A2UI also features an open registry pattern that allows developers to map server-side types to custom client implementations, from native mobile widgets to React components. By registering a "Smart Wrapper," you can connect any existing UI component—including secure iframe containers for legacy content—to A2UI's data binding and event system. Crucially, this places security firmly in the developer's hands, enabling them to enforce strict sandboxing policies and "trust ladders" directly within their custom component logic rather than relying solely on the core system.
Use cases
Some of the use cases include:
- Dynamic Data Collection: An agent generates a bespoke form (date pickers, sliders, inputs) based on the specific context of a conversation (e.g., booking a specialized reservation).
- Remote Sub-Agents: An orchestrator agent delegates a task to a remote specialized agent (e.g., a travel booking agent) which returns a UI payload to be rendered inside the main chat window.
- Adaptive Workflows: Enterprise agents that generate approval dashboards or data visualizations on the fly based on the user's query.
Architecture
The A2UI flow disconnects the generation of UI from the execution of UI:
- Generation: An Agent (using Gemini or another LLM) generates or uses
a pre-generated
A2UI Response, a JSON payload describing the composition of UI components and their properties. - Transport: This message is sent to the client application (via A2A, AG-UI, etc.).
- Resolution: The Client's A2UI Renderer parses the JSON.
- Rendering: The Renderer maps the abstract components
(e.g.,
type: 'text-field') to the concrete implementation in the client's codebase.
Dependencies
A2UI is designed to be a lightweight format, but it fits into a larger ecosystem:
- Transports: Compatible with A2A Protocol and AG-UI.
- LLMs: Can be generated by any model capable of generating JSON output.
- Host Frameworks: Requires a host application built in a supported framework (currently: Web or Flutter).
Getting started
Pick the path that matches where you want to start:
| Path | What you get | Time |
|---|---|---|
| 🍜 Quickstart Restaurant Finder Demo | Full-stack A2UI running locally with a Gemini powered ADK agent and Lit renderer. Learn A2UI end-to-end and customize to your use case. | ~5 min |
| ⚛️ Use A2UI with Any Agent Framework & Harness | Scaffold an AG-UI app or harness for your framework of choice, then enable A2UI rendering over AG-UI. | ~5 min |
| 🎨 A2UI Composer | Generate A2UI JSON from a visual editor and paste it into any agent prompt — no install required. | ~1 min |
| 🎬 A2UI Theater | Step through pre-built A2UI streaming scenarios across Lit, React, and Angular renderers — no install required. | ~1 min |
Restaurant Finder demo — Summary
Prerequisites: Node.js 18+ (with Corepack enabled), uv, and a Gemini API key.
git clone https://github.com/a2ui-project/a2ui.git
cd a2ui
export GEMINI_API_KEY="your_gemini_api_key"
# Enable Corepack (macOS Homebrew users: see tip below)
corepack enable
yarn install
cd samples/client/lit
yarn demo:restaurant
[!TIP] macOS Homebrew Users: If you previously installed standalone package managers, unlink conflicts before installing Corepack so Corepack can manage versions per-project:
brew unlink yarn pnpm brew install corepack corepack enable
These commands install dependencies across workspaces, build the renderers, start the Python agent, and open the client at http://localhost:5173. For step-by-step instructions, alternative demos, and troubleshooting see the full Quickstart.
Use A2UI with Any Agent Framework & Harness — Summary
npx create-ag-ui-app@latest
Use the AG-UI CLI with your framework or harness of choice (Google Chat, ADK, LangGraph, CrewAI, Mastra, Strands, Slack, Teams, etc.), then follow the AG-UI guide to enable A2UI rendering. Some scaffold paths use CopilotKit's A2UI runtime with Next.js under the hood, but the setup surface is AG-UI-first.
Other renderers
For Flutter, check out the GenUI SDK, which uses A2UI under the hood. See docs/public/reference/renderers.md for the full list of client implementations.
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 and catalog validation. | |
| a2ui-agent-sdk | Agent SDK: teaches the LLM a catalog and parses its response into A2UI messages. | |
| a2ui-a2a | Connects the agent SDK to the Agent-to-Agent (A2A) protocol. | Not published yet |
| a2ui-adk | Connects the agent SDK to the Agent Development Kit (ADK). | Not published yet |
TypeScript
| Package | Description | Version |
|---|---|---|
| @a2ui/web_core | Protocol messages, state management and catalogs shared by the web renderers. | |
| @a2ui/lit | Lit (web components) renderer. | |
| @a2ui/angular | Angular renderer. | |
| @a2ui/react | React renderer. | |
| @a2ui/markdown-it | Markdown rendering with markdown-it and DOMPurify, shared by the web renderers. | |
| @a2ui/agent | Agent SDK for TypeScript and Node.js. | Not published yet |
Dart and Flutter
| Package | Description | Version |
|---|---|---|
| a2ui_core | Protocol messages, data model, data binding and expressions for renderers and agents. | |
| a2ui_agent | Agent SDK: teaches the LLM a catalog and parses its response into A2UI messages. | |
| a2ui_flutter | Flutter renderer. | Not published yet |
| a2ui_cli | Developer tool that generates typesafe component code from a catalog. | Not published yet |
Swift
The Swift libraries are built by the Package.swift at the root of this repository.
| Package | Description | Version |
|---|---|---|
| A2UISwiftCore, BasicCatalog | Message processor, data model and basic catalog definitions. | Not published yet |
| A2UISwiftUI, BasicCatalogSwiftUI | SwiftUI renderer and basic catalog views. | Not published yet |
Roadmap
We hope to work with the community on the following:
- Spec stabilization: Moving towards a v1.0 specification.
- More renderers: Adding official support for React, Jetpack Compose, iOS (SwiftUI), and more.
- Additional transports: Support for REST and more.
- Additional Agent frameworks: Genkit, LangGraph, and more.
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.