AG-UI protocol

Also known as: AG-UI · Agent-User Interaction Protocol

On this page 7

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.

CategoryExample eventsPurpose in the interface
Lifecycle eventsRunStarted, RunFinished, RunError, StepStartedShow progress, spinners and failure states
Text message eventsTextMessageStart, TextMessageContent, TextMessageEndStream assistant text token by token
Tool call eventsToolCallStart, ToolCallArgs, ToolCallEndDisplay or execute tool invocations
State management eventsStateSnapshot, StateDelta, MessagesSnapshotKeep agent and interface state synchronized
Special eventsRaw, CustomPass through framework-specific or app-specific data
Main AG-UI event categories

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.

TransportStrengthTypical use
HTTP with SSESimple, works through most proxiesWeb chat and copilot panels
WebSocketsBidirectional, low latencyCollaborative or long-lived sessions
WebhooksAsynchronous deliveryBackground agents notifying an app
Binary encodingSmaller payloadsHigh-volume or mobile clients
Common transport options

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.

ProtocolConnectsMain concernTypical message
AG-UIAgent and user interfaceStreaming interaction and shared stateTextMessageContent event
MCPAgent and tools or data sourcesTool discovery and invocationTool call request to an MCP server
Agent2Agent protocolAgent and another agentDelegation across organizationsTask sent to a remote agent
Comparison of agent protocols

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.

SituationRecommendationReason
Single chatbot with plain text repliesOptionalBasic streaming may be sufficient
Copilot embedded in an existing appStrongly recommendedShared state and frontend tools are central
Several agent frameworks behind one UIRecommendedOne event vocabulary for all backends
Strict regulated workflowsRecommended with controlsApproval steps map to frontend tools
When AG-UI is a good fit
  • 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.