交互式 UI(render_ui)
Myrm 提供声明式 UI 工件链路:Agent 调用 render_ui → Server 推送 UI_UPDATE SSE → WebUI 在对话内渲染可交互组件。
启用方式
- 在聊天中打开 Agent 配置。
- 开启 交互式 UI(
render_ui)。 - 首次在有 workspace 的场景运行时会自动 seed
.agent/docs/A2UI_REFERENCE.md(完整 props 手册)。
A2UI v3.1 要点
| 主题 | 行为 |
|---|---|
| 组件白名单 | 23 种 UIComponentType(前后端枚举 SSOT) |
| 渐进式 spec | 简单 UI(text + field + button)无需额外读取;table / chart / tabs 或 3+ 组件 前应 file_read_tool .agent/docs/A2UI_REFERENCE.md |
| 校验 | fail-closed — 未知 type、空 components、无效图(root_ids/children)、非法 actions 均返回结构化错误,禁止静默跳过 |
| 用户操作 | 按钮/表单提交以 UIActionEvent 回传 Agent 继续执行 |
投递链路(SSE)
工具可能在 LangGraph 子 asyncio 任务中执行,此时ArtifactContext 的 ContextVar 不可见。Myrm 按 assistant message_id stash UI 工件(run 级绑定 + post_run 弹出),确保 UI_UPDATE SSE 在 MESSAGE_END 前到达 WebUI。由集成 wiring 测试与 真实 LLM agent-stream E2E(关键路径无 mock)覆盖。
JSON 结构(邻接表)
竞品对比
| 产品 | 对话内生成式 UI |
|---|---|
| Myrm | 23 种 typed 组件 + SSE 工件 + 渐进 spec + fail-closed |
| OpenClaw / Codex / Claude Code | 无一等公民对话内表单渲染 |
| CopilotKit AG-UI | Web 协议 catalog(约 19 基础控件);无 workspace spec seed + 枚举门禁 |
| Hermes | 文本建议为主;无结构化 chat UI 工件 |
ask_question_tool,不必搭完整 UI。
另见:Agent 配置 — 工具加载策略。