The Agent-User Interaction Protocol (AG-UI) is a protocol for connecting an AI agent to a frontend. Developer’s Guide to AI Agent Protocols describes it as middleware that translates raw agent-framework events into a standardized server-sent events (SSE) stream, so that a frontend can listen for typed events — its examples include TEXT_MESSAGE_CONTENT and TOOL_CALL_START — without caring which agent framework produced them.

Usage

The guide’s case for AG-UI starts from how agents differ from traditional REST APIs: a REST call returns a response and is done, whereas an agent streams text incrementally, calls tools in the middle of a response and sometimes pauses to wait for human input. A developer can handle this directly — the guide notes that Agent Development Kit (ADK) provides a native /run_sse endpoint and that a few dozen lines of frontend code can parse the stream — but calls that parsing code boilerplate that breaks whenever the event format changes. AG-UI removes that boilerplate.

In the guide’s example, an ADK agent is wrapped with the ag_ui_adk package and mounted as an endpoint on a FastAPI app. The resulting stream opens with a run-started event, reports each tool call with start, result and end events, delivers text as a series of message-content deltas, and closes with a run-finished event.

The guide distinguishes AG-UI from the Agent-to-User Interface Protocol (A2UI): A2UI defines what to render, and AG-UI defines how to stream it.