我学习到的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: [...]
    }
  }
}
相关推荐
紫禁玄科7 小时前
Shai-Hulud:npm生态的自我复制蠕虫风暴
前端·npm·node.js
东风破_8 小时前
后端API没写好,前端难道干等着吗?
前端
用户938515635078 小时前
从前后端分离到前端接口工程:React + MockJS + Vite 解析
前端·后端·全栈
用户938515635078 小时前
从零在浏览器里跑 DeepSeek-R1:WebGPU + Transformers.js 全链路实战(三)
前端·react.js·typescript
excel8 小时前
当前端行情变差,我们为什么还要坚持?
前端
鸿是江边鸟,曾是心上人9 小时前
快速搭建HTTPS本地开发环境
前端
To_OC9 小时前
写了 5 个表单 Demo 后,我终于彻底搞懂了 React 受控与非受控组件
前端·react.js·前端框架
Sterting10 小时前
第9课 Vue Router 路由
前端·vue.js
用户0595401744610 小时前
LangChain Memory 测试踩坑实录:用 pytest 自动化回归对话记忆,我折腾了整整一个周末
前端·css
kyriewen10 小时前
Claude Code后天起默认Auto模式了——我第一时间改了这6个设置
前端·ai编程·claude