核心特性

📋

声明式 UI

使用 JSON 定义界面结构,Agent 无需了解渲染细节

🔄

实时更新

通过流式消息实时推送 UI 更新,支持渐进式渲染

📱

跨平台

同一套协议可用于 Web、Mobile、Desktop 等多端渲染

🎨

组件丰富

16+ 标准组件:表单、列表、卡片、模态框等

协议概览

1

surfaceUpdate

定义或更新 UI 组件

2

dataModelUpdate

填充或更新数据状态

3

beginRendering

通知客户端开始渲染

快速开始

// 简单的 A2UI 消息示例
{"surfaceUpdate": {"surfaceId": "main", "components": [
  {"id": "root", "component": {"Column": {"children": {"explicitList": ["title", "button"]}}}},
  {"id": "title", "component": {"Text": {"text": {"literalString": "Hello A2UI"}, "usageHint": "h1"}}},
  {"id": "button", "component": {"Button": {"child": "btn_text", "action": {"name": "click"}}}}},
  {"id": "btn_text", "component": {"Text": {"text": {"literalString": "Click Me"}}}}
]}}
{"beginRendering": {"surfaceId": "main", "root": "root"}}