ag-ui-protocol/ag-ui
AG-UI: the Agent-User Interaction Protocol. Bring Agents into Frontend Applications.
AG‑UI: An Open Protocol for Agent‑User Interaction
What it is – AG‑UI (Agent‑User Interaction) is a lightweight, event‑based protocol that standardises how AI agents talk to user‑facing applications. It defines a small set of ~16 event types that an agent can emit and a few simple input shapes that an app can send back. A middleware layer handles transport (SSE, WebSockets, webhooks, etc.) and loose format matching, making it easy to plug any backend‑oriented agent into any front‑end UI.
Why it matters – Modern AI agents (LangChain, CrewAI, Microsoft Agent Framework, etc.) are great at reasoning, but integrating them into live user interfaces is still ad‑hoc. AG‑UI sits in the agent‑to‑human layer of the emerging agentic protocol stack (MCP gives tools, A2A lets agents talk to each other, AG‑UI connects agents to people). By providing a common contract, developers can reuse UI components, share state, and swap out agents without rewriting glue code.
Key features
- Real‑time chat with streaming – agents push partial responses as events.
- Bi‑directional state sync – UI and agent keep a shared state model up‑to‑date.
- Generative UI messages – agents can describe UI elements (forms, tables, etc.) that the client renders on the fly.
- Context enrichment – events can carry extra user context (location, recent actions, etc.) for richer responses.
- Tool‑integration hooks – front‑end libraries can expose tools (e.g., file upload) that the agent can invoke.
- Human‑in‑the‑loop – users can intervene, edit, or approve agent actions.
Supported ecosystems – The project ships a reference HTTP implementation and a default connector, plus SDKs for many languages (Kotlin, Go, Dart, Java, Rust, Ruby, C++, .NET, etc.). First‑party integrations include CopilotKit, LangChain, CrewAI, Microsoft Agent Framework, Google ADK, AWS Strands, LlamaIndex, and more. Community adapters exist for Claude SDKs, Langroid, Cloudflare Agents, and others.
Getting started – The easiest entry point is the CLI starter:
npx create-ag-ui-app my-agent-app
This scaffolds a minimal app that connects an agent backend to a web UI using the protocol. The AG‑UI Dojo (https://dojo.ag-ui.com) showcases bite‑size examples (50‑200 lines) of each building block, and the docs provide quick‑start guides for both applications and framework integrations.
Typical use‑case
- Agent backend (e.g., a LangChain graph) emits
message,stateUpdate,toolCallevents. - AG‑UI middleware translates those into the standard event payload and streams them over WebSocket.
- Front‑end client (React, React‑Native, terminal, Slack, etc.) receives the events, renders a chat UI, updates shared state, and can send user inputs back as AG‑UI‑compatible requests.
- The loop continues, enabling interactive, context‑aware AI experiences inside the product.
Community & governance – The project is MIT‑licensed, has an active Discord, bi‑weekly working groups, and a public roadmap (GitHub Projects). Contributions are welcomed via the usual pull‑request flow and a detailed CONTRIBUTING guide.
TL;DR – AG‑UI is a real, open‑source protocol that standardises the communication between AI agents and user interfaces, offering real‑time chat, state sync, and generative UI capabilities across many languages and frameworks.
Related
- Project
- Project
- Project
- Project
- Project