CopilotKit 搞了个 AG-UI 协议,把 agent 响应变成事件流,省去了自己设计状态同步的麻烦,还能直接对接审批流程。
CopilotKit 推出 AG-UI(Agent-User Interaction Protocol),将 LLM 响应视为包含 5 种事件类型的流(生命周期、文本、工具调用、状态更新、特殊事件)。该协议基于标准传输协议(SSE、WebSocket、HTTP)传输 JSON 数据。支持 React、Angular、Vue 等 9 个前端框架和平台。开发者可直接集成现成的“人在回路”审批组件,无需自建。
AG-UI makes building agentic applications dramatic…
AG-UI makes building agentic applications dramatically easier.
Here's how it works.
This is a model for a simple chatbot:
User → LLM → Response
But interactive agents that render UI, pause for approvals, and ask users for input need a much more complex model.
When building these agents, a response from the LLM will include a series of state changes as the agent runs:
• Agent started a task • Agent called a tool • Agent updated its state • Agent streams these tokens • Agent is waiting on a human • Agent is resuming the task
The Agent-User Interaction Protocol (AG-UI) treats the LLM response as a stream of events rather than a text endpoint.
In practice, here is what you get as an agent runs:
1. Lifecycle events so your UI knows where the agent is. 2. Text messages that stream tokens. 3. Tool calls so your UI can prefill a form with any required arguments. 4. State updates that keep your UI in sync with the agent. 5. Special events for human approvals, rich media, and custom needs.
All of these events travel over standard transports (SSE, WebSockets, or plain HTTP) as JSON.
As a result, you can build a frontend that stays in sync with the agent's progress without having to invent a custom process to make this happen.
For example, building a human-in-the-loop workflow becomes an off-the-shelf component you can integrate rather than build from scratch.
@CopilotKit is the creator of AG-UI, and you can use it when building frontend applications pretty much anywhere:
• React • Angular • Vue • React Native • Slack • Teams • Discord • WhatsApp • Telegram
Here is the link for you to check it out: https://t.co/CGEDOtd8V1
Thanks to the CopilotKit team for partnering with me on this post.