我学习到的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: [...]
    }
  }
}
相关推荐
m0_7190841133 分钟前
React笔记张天禹
前端·笔记·react.js
Ziky学习记录1 小时前
从零到实战:React Router 学习与总结
前端·学习·react.js
wuhen_n1 小时前
JavaScript链表与双向链表实现:理解数组与链表的差异
前端·javascript
wuhen_n1 小时前
JavaScript数据结构深度解析:栈、队列与树的实现与应用
前端·javascript
狗哥哥1 小时前
微前端路由设计方案 & 子应用管理保活
前端·架构
前端大卫2 小时前
Vue3 + Element-Plus 自定义虚拟表格滚动实现方案【附源码】
前端
却尘2 小时前
Next.js 请求最佳实践 - vercel 2026一月发布指南
前端·react.js·next.js
ccnocare2 小时前
浅浅看一下设计模式
前端
Lee川2 小时前
🎬 从标签到屏幕:揭秘现代网页构建与适配之道
前端·面试
Ticnix3 小时前
ECharts初始化、销毁、resize 适配组件封装(含完整封装代码)
前端·echarts