TL;DR

AG-UI (Agent–User Interaction) là giao thức mở do CopilotKit phát hành tháng 5/2025, định nghĩa cách 1 AI agent backend nói chuyện hai chiều với bất kỳ frontend nào qua HTTP + Server-Sent Events. Stream JSON event được chuẩn hoá (~16 loại) cho phép: token streaming real-time, tool call chạy ở browser hoặc server, state đồng bộ bằng diff, và đổi backend/UI mà không phải viết lại. Repo đã có 13.2k sao, license MIT, và được Microsoft Agent Framework, Google ADK, AWS Strands, LangGraph, CrewAI, Mastra, PydanticAI, LlamaIndex hỗ trợ first-party.

AG-UI là gì?

Trước AG-UI, mỗi team build agent UI tự dựng giao thức riêng — chỗ thì WebSocket custom stream token, chỗ thì poll API rồi merge JSON patch. Kết quả: integration nào cũng giòn, mỗi UI lại phải tự viết adapter cho từng framework agent (LangChain, CrewAI, Mastra, AG2…).

AG-UI giải bài toán last-mile đó. Frontend gửi POST tới agent endpoint kèm prompt/state, sau đó mở SSE listener trên cùng endpoint. Agent emit ra một dòng typed JSON event:

  • TEXT_MESSAGE_CONTENT — token chữ stream về.
  • TOOL_CALL_START / TOOL_CALL_END — vòng đời gọi function/API.
  • STATE_DELTA — JSON patch state (chỉ phần thay đổi).
  • RUN_ERROR / RUN_FINISHED — vòng đời session.

UI chỉ cần switch theo event type và update tương ứng. Không có format binary đặc biệt, không cần proxy đặc biệt — SSE chỉ là HTTP streaming response, đi qua firewall, CDN, load balancer như request thường.

Vì sao quan trọng

Agent stack 2026 đã thành 3 lớp giao thức song song, không cạnh tranh nhau:

LớpGiao thứcNgười khởi xướngVai trò
Agent ↔ Tools/DataMCPAnthropicCho agent gọi DB, API, function
Agent ↔ AgentA2AGooglePhối hợp multi-agent
Agent ↔ UserAG-UICopilotKitCầu nối real-time tới UI

Một help-desk agent điển hình có thể: dùng MCP để query CRM, dùng A2A để spawn sub-agent phân loại case, và dùng AG-UI để stream toàn bộ tiến trình về dashboard user. Mỗi lớp đổi được độc lập — đổi LLM, đổi DB, đổi UI framework không phá lớp khác.

Bốn capability lõi

1. Streaming real-time qua SSE. Token chảy từ agent về UI ngay khi sinh ra. User có thể cancel, pause, refine giữa stream — AG-UI dùng thread_id + run_id để server xử lý interrupt đúng.

2. Tool execution browser hoặc server — tuỳ bạn chọn. Backend tool rendering: server chạy tool, stream progress + log + kết quả về client. Frontend tool call: agent “handoff” có type sang client để frontend chạy action (ví dụ điều hướng router, mở modal, gọi browser API), kết quả được trả ngược về agent. Cùng giao thức, hai chế độ.

3. Bidirectional state sync bằng diff. Agent và app share một typed store. Mỗi lần state đổi, agent emit STATE_DELTA chỉ chứa phần thay đổi (vd: thêm 1 row trong bảng), không gửi lại toàn bộ blob. Frontend merge và resolve conflict cục bộ. Đỡ băng thông + giảm latency rõ rệt với state lớn (kế hoạch nhiều bước, document đang co-edit, table dữ liệu).

4. Backend build 1 lần, plug vào mọi AG-UI frontend. CopilotKit ship sẵn client React + Angular. Cộng đồng có SDK Kotlin, Golang, Dart, Java, Rust, Ruby. .NET, C++, Nim, React Native đang in-progress. Đổi UI framework không cần đụng vào agent.

Ai đã adopt

Đây là điểm nổi bật nhất sau 11 tháng từ ngày ra mắt. AG-UI đã nằm sẵn trong các framework agent first-party:

Framework / VendorTrạng thái
Microsoft Agent FrameworkSupported (1st-party)
Google ADKSupported (1st-party)
AWS Strands Agents, Bedrock AgentCoreSupported (1st-party)
LangGraph (LangChain)Supported — partner gốc
CrewAISupported — partner gốc
Mastra, Pydantic AI, Agno, LlamaIndex, AG2Supported (1st-party)
AWS Bedrock Agents, OpenAI Agent SDK, Cloudflare AgentsIn progress

Repo ag-ui-protocol/ag-ui trên GitHub đã đạt 13.2k sao, 1.2k fork, release mới nhất ngày 21/04/2026. License MIT, fully self-hosted-friendly.

Use case thực tế

  • Coding assistant kiểu Cursor / GitHub Copilot — agent stream code suggestion thẳng vào editor.
  • Document co-writing kiểu Notion AI — agent embed trong editor, completion + summary in-line.
  • Analytics dashboard: LangGraph planner stream charting plan về React UI, sub-agent fetch data, chart cập nhật live khi user trò chuyện với DB.
  • Multi-agent customer support: nhiều agent chuyên biệt phối hợp sau cùng 1 UI — CopilotKit có blog post 24/04/2026 dựng telecom support system với LangGraph + AG-UI.
  • Design tool co-creation: designer sketch, agent refine mockup live.
  • AI tutor: walk-through từng bước giải bài cùng học sinh.

Hạn chế & pricing

Giao thức và spec hoàn toàn miễn phí (MIT). Một số góc còn rough:

  • SDK .NET, C++, Nim, Flowise, Langflow client còn in-progress — team nào dùng stack này phải tự build hoặc đóng góp.
  • React Native client mới ở “Help Wanted”.
  • OpenAI Agent SDK, AWS Bedrock Agents, Cloudflare Agents tích hợp chưa ship — dù workaround qua middleware có thể được.
  • AG-UI chỉ giải lớp UI. Để có production stack đầy đủ phải pair với MCP (tools/data) và có thể A2A (multi-agent).
  • CopilotKit có bản hosted Copilot Cloud (Protection guardrails đã GA; Cockpit analytics + Learning RLiHF còn coming soon) — pricing chưa public, phải liên hệ sales.

Roadmap sắp tới

Theo trang docs & roadmap chính thức, AG-UI đang draft 3 đề xuất lớn:

  • Interrupt-Aware Run Lifecycle — chuẩn hoá hành vi pause/resume/escalate.
  • Generative User Interfaces — chính thức hoá việc agent tự ship UI tree (giao tuyến với A2UI của Google).
  • Meta Events — lớp event mở rộng cho observability, telemetry, custom signal.

Cộng với việc thêm SDK ngôn ngữ mới và mở rộng số agent framework hỗ trợ, AG-UI đang đi theo hướng “HTTP của agent UI” — hạ tầng vô hình mà ai build agent app cũng dùng.

Nguồn: CopilotKit blog, docs.ag-ui.com, GitHub ag-ui-protocol/ag-ui, Microsoft Learn.