我学习到的AG-UI的功能:全面的交互支持

AG-UI提供了智能体和应用交互所需的几乎所有功能:

1. 流式聊天

bash 复制代码
{
  type: "message",
  role: "assistant",
  content: "正在为您查找...",
  streaming: true
}

2. 状态同步

css 复制代码
{
  type: "state_sync",
  state: {
    searchQuery: "中餐厅",
    results: [...]
  }
}

3. 生成式UI

bash 复制代码
{
  type: "generative_ui",
  component: "RestaurantCard",
  props: {...}
}

4. 工具调用

matlab 复制代码
{
  type: "tool_call",
  tool: "search_restaurants",
  arguments: {...}
}

5. 前端工具

bash 复制代码
{
  type: "frontend_action",
  action: "open_map",
  params: {...}
}

6. 人机协作(HITL)

bash 复制代码
{
  type: "interrupt",
  reason: "需要用户确认",
  options: [...]
}

7. 思考步骤

bash 复制代码
{
  type: "thinking",
  content: "正在分析用户需求..."
}

8. 多模态支持

less 复制代码
{
  type: "message",
  content: "这是餐厅照片",
  attachments: [{
    type: "image",
    url: "..."
  }]
}

9. 集成方式

ini 复制代码
# 使用LangGraph中间件
from copilotkit import CopilotKitSDK
 
sdk = CopilotKitSDK(
    agents=[my_langgraph_agent]
)

AG-UI可以传输A2UI消息

css 复制代码
// AG-UI事件中包含A2UI消息
{
  type: "generative_ui",
  format: "a2ui",
  content: {
    surfaceUpdate: {
      components: [...]
    }
  }
}
相关推荐
刘发财3 小时前
弃用html2pdf.js,这个html转pdf方案能力是它的几十倍
前端·javascript·github
牛奶5 小时前
2026年大模型怎么选?前端人实用对比
前端·人工智能·ai编程
牛奶5 小时前
前端人为什么要学AI?
前端·人工智能·ai编程
Kagol8 小时前
🎉OpenTiny NEXT-SDK 重磅发布:四步把你的前端应用变成智能应用!
前端·开源·agent
GIS之路9 小时前
ArcGIS Pro 中的 notebook 初识
前端
JavaGuide9 小时前
7 道 RAG 基础概念知识点/面试题总结
前端·后端
ssshooter9 小时前
看完就懂 useSyncExternalStore
前端·javascript·react.js
格砸10 小时前
从入门到辞职|从ChatGPT到OpenClaw,跟上智能时代的进化
前端·人工智能·后端
Live0000011 小时前
在鸿蒙中使用 Repeat 渲染嵌套列表,修改内层列表的一个元素,页面不会更新
前端·javascript·react native
柳杉11 小时前
使用Ai从零开发智慧水利态势感知大屏(开源)
前端·javascript·数据可视化