The AG-UI protocol (Agent-User Interaction Protocol) is an open, event-based standard that defines how an AI agent backend communicates with a user-facing application in real time. In the field of AI agents, it covers the agent-to-user layer: streaming text, reporting tool calls, synchronizing shared state and accepting user input while a run is in progress.
AG-UI was introduced in 2025 by the team behind the CopilotKit framework and published as an open specification with SDKs for several languages. It is designed to be framework-agnostic and transport-agnostic, so that one frontend can work with agents built on different orchestration frameworks without custom glue code for each.
How the AG-UI protocol works
AG-UI works by turning every agent run into a stream of typed JSON events. The client sends a single request that contains the thread identifier, the message history, the current shared state and the tools the frontend makes available. The agent then responds with an ordered sequence of events that the interface renders as they arrive.
This design replaces the traditional request-response pattern, in which a user waits for a finished answer. Agents often run for many seconds or minutes, call tools, and change intermediate results, so the interface needs incremental, structured updates rather than a single block of text. Each event carries a type field and a small payload, which makes the stream easy to parse, log and replay.
The protocol does not prescribe how the agent reasons internally. An agent built with a graph-based framework, a role-based multi-agent framework or a custom loop can all emit the same events, provided an adapter maps their internal callbacks to the AG-UI vocabulary.
Event categories in the AG-UI specification
The specification groups its roughly sixteen standard event types into a few categories, each serving a distinct part of the interaction. The table below summarizes them.
| Category | Example events | Purpose in the interface |
|---|---|---|
| Lifecycle events | RunStarted, RunFinished, RunError, StepStarted | Show progress, spinners and failure states |
| Text message events | TextMessageStart, TextMessageContent, TextMessageEnd | Stream assistant text token by token |
| Tool call events | ToolCallStart, ToolCallArgs, ToolCallEnd | Display or execute tool invocations |
| State management events | StateSnapshot, StateDelta, MessagesSnapshot | Keep agent and interface state synchronized |
| Special events | Raw, Custom | Pass through framework-specific or app-specific data |
State updates use two complementary forms. A StateSnapshot delivers the complete state object, while a StateDelta delivers incremental changes expressed as JSON Patch operations (RFC 6902). Snapshots provide a reliable baseline, and deltas keep bandwidth low during long runs.
Transports, frontend tools and human-in-the-loop
AG-UI is independent of the transport layer. The reference implementations commonly use an HTTP POST request answered with server-sent events (SSE), but the same events can travel over WebSockets, webhooks or an optional binary encoding where efficiency matters.
| Transport | Strength | Typical use |
|---|---|---|
| HTTP with SSE | Simple, works through most proxies | Web chat and copilot panels |
| WebSockets | Bidirectional, low latency | Collaborative or long-lived sessions |
| Webhooks | Asynchronous delivery | Background agents notifying an app |
| Binary encoding | Smaller payloads | High-volume or mobile clients |
A distinctive feature is the frontend tool. The application declares tools such as opening a form, highlighting a document section or asking for approval, and the agent calls them through ToolCall events. The interface executes the tool locally and returns the result in the next request, which enables human-in-the-loop approval and generative user interfaces without exposing the browser to the agent’s backend.
How AG-UI relates to MCP and the Agent2Agent protocol
AG-UI is one of three complementary layers in the agent protocol stack. Each standardizes a different boundary, and a single product often uses all three.
| Protocol | Connects | Main concern | Typical message |
|---|---|---|---|
| AG-UI | Agent and user interface | Streaming interaction and shared state | TextMessageContent event |
| MCP | Agent and tools or data sources | Tool discovery and invocation | Tool call request to an MCP server |
| Agent2Agent protocol | Agent and another agent | Delegation across organizations | Task sent to a remote agent |
The distinction matters in design reviews. MCP answers what an agent can use, A2A answers whom an agent can delegate to, and AG-UI answers how the person sees and steers the work. Confusing these layers leads to interfaces that expose raw tool traffic or agents that cannot pause for user input.
Adoption considerations and limitations
AG-UI is attractive when a team wants to swap agent frameworks without rewriting the interface or to support several agents behind one product. Adapters exist for several popular orchestration frameworks, and SDKs cover TypeScript and Python, with community work in other languages.
| Situation | Recommendation | Reason |
|---|---|---|
| Single chatbot with plain text replies | Optional | Basic streaming may be sufficient |
| Copilot embedded in an existing app | Strongly recommended | Shared state and frontend tools are central |
| Several agent frameworks behind one UI | Recommended | One event vocabulary for all backends |
| Strict regulated workflows | Recommended with controls | Approval steps map to frontend tools |
- The specification is young and still evolving, so event details and SDK interfaces may change between versions.
- Security remains the application’s responsibility: authentication, authorization and validation of tool arguments are not defined by the protocol.
- Large state objects can make snapshots expensive; teams should prefer deltas and keep shared state compact.
- Custom events reduce portability when overused, because other clients will not understand them.
In plain words
An AI agent often works for a while before it finishes. During that time, the user wants to see what is happening. AG-UI is a shared language for that live conversation between the agent and the screen.
The agent sends small, labeled updates. One says it started. Another carries a few words of the answer. Another says it is using a tool. The app understands every label and shows it right away. Because the labels are standard, any app can talk to any agent that speaks AG-UI.
A real-world example
A mid-sized insurance company adds an agent-powered assistant to its claims portal. The backend agent reads claim documents, checks policy rules and drafts a settlement proposal, a process that usually takes 40 to 90 seconds.
With AG-UI, the portal shows lifecycle events as a progress bar, streams the draft explanation as it is written and updates a shared claim form through StateDelta events, so fields fill in while the agent works. Before the agent submits a payout above a set limit, it calls a frontend approval tool, and an adjuster confirms or edits the amount in the portal.
Six months later the company moves the agent to a different orchestration framework. Because both versions emit AG-UI events, the portal code stays unchanged, and the migration affects only the backend adapter.