After MCP and A2A, the AI field has added AG-UI protocol

A revolutionary new chapter in AI interaction protocols: AG-UI protocol is coming!
Core content:
1. AG-UI protocol definition and its innovative significance in the field of AI
2. How AG-UI protocol standardizes the interaction between AI agents and front-end applications
3. AG-UI's core components and their key role in AI interaction
What is AG-UI
AG-UI (Agent User Interaction Protocol) is an open, lightweight, event-based protocol released by CopilotKit. It streams a series of JSON events through standard HTTP or optional binary channels. It is mainly used to standardize the interaction between AI agents and front-end applications.
CopilotKit is an AI startup founded in 2022, focusing on building AI assistants for products. The official website introduction is: AI Copilots for your product. Build fast, customize effortlessly. The official website address is: https://www.copilotkit.ai/.
What problems does AG-UI mainly solve?
CopilotKit staff explained that most agents are currently backend automation tools that perform tasks such as data migration, form filling, and content summarization. These agents run in the background and are invisible to users. However, interactive agents (such as Cursor, Windsurf, Devin, etc.) have achieved real-time collaboration with users, and they will also bring a large number of application scenarios. In this case, these agents need to have the capabilities of real-time updates, tool orchestration, shareable mutable states, security boundary control, and front-end synchronization. For this purpose, they built and released the AG-UI protocol.
AG-UI Introduction
AG-UI builds a bridge between AI agents and front-end applications, making the interaction between the two more friendly and providing users with a better experience. The schematic diagram is as follows:
-
Application: The application used by the user to interact (such as chat or any other AI application) -
AG-UI Client: A general-purpose communication client such as HttpAgent
, or a dedicated client for connecting to existing protocols -
Agent: The backend user processes user requests and generates streaming responses -
Secure Proxy: A backend service that can provide additional capabilities or act as a secure proxy
Core Components
The core components of AG-UI include Protocol Layer, Standard HTTP Client, Message Type, Running Agent, State Management, Tools and Handoff, and Events.
Protocol Layer
The AG-UI protocol layer mainly provides a flexible foundation for agent communication. The core of the protocol enables applications to run agents and receive event streams.
Standard HTTP Client
AG-UI provides a standard HTTP client HttpAgent
that can be used to connect to any endpoint that supports POST requests. The endpoint receives RunAgentInput
a request body of type and returns BaseEvent
a data stream of objects.
HttpAgent
Supports two modes : HTTP SSE (Server-Sent Events) and HTTP binary protocol .
Message Type
AG-UI defines some event strategies for different aspects of agent communication, mainly including:
-
• Lifecycle events: monitors the running status of the Agent. The running status of the Agent may include RunStarted
,StepStarted/StepFinished
,RunFinished
(success), andRunError
(failure). -
• Text message events: Events used to process text streaming content. These events follow a streaming pattern and deliver content in increments. A text message may TextMessageStart
start with an event, then useTextMessageContent
events to deliver the text, and finallyTextMessageEnd
end with an event. -
• Tool call events: Manages the execution of tools by agents. When an agent wants to use a tool, an ToolCallStart
event is triggered, followed byToolCallArgs
events for streaming the parameters passed to the tool, and finallyToolCallEnd
ends with an event. -
• State management events: Synchronize the state between the Agent and the UI. The state management in the protocol adopts an efficient "snapshot-incremental" model: a complete state snapshot is sent initially or occasionally, and continuous changes are delivered through incremental updates (delta). Snapshots ensure that the front end has complete state context, while deltas minimize data transfers that require frequent updates. The effective combination of the two allows the front end to maintain an accurate representation of the Agent state without unnecessary data transfers. The events included are StateSnapshot
andStateDelta
. -
• Special events: Supports custom features, such as integration with external systems. Included events are Raw
andCustom
.
Run Agent
Create an agent client instance and enable the agent.
State Management
AG-UI manages the status through dedicated events. The events currently provided are:
-
STATE_SNAPSHOT: A complete state representation at a certain moment; -
STATE_DELTA: incremental state changes using the JSON patch format (RFC 6902); -
MESSAGES_SNAPSHOT: represents the complete conversation history;
Tools and Handoffs
AG-UI provides task handover and tool usage between agents through standardized events.
event
All communications in AG-UI are based on event types. Each event inherits from BaseEvent
, and its interface is as follows:
interface BaseEvent {
type: EventType
timestamp?: number
rawEvent?: any
}
Currently, the official TypeScript and Python SDKs are provided for the development and use of the protocol.
MCP vs A2A vs AG-UI
At the end of last year, Anthropic released MCP (Model Context Protocol), and this year, Google released A2A (Agent to Agent), both of which are protocols aimed at this round of AI development.
Compared with MCP and A2A, AG-UI focuses on the interaction layer between agents and users. It is not in competition with MCP and A2A. The three have different roles in the AI ecosystem:
-
AG-UI: mainly handles the interaction participated by users (people) and streaming updates of user interfaces; -
A2A: mainly promotes communication and collaboration between agents (agent-to-agent); -
MCP: mainly solves the standardization and context processing problems of tool calls across different models;
These three complement each other. For example, the same agent can communicate with other agents through A2A, interact with users through AG-UI, and call tools through MCP. These three protocols complete the standardization of the interaction between the user, agent, and LLM.
The Agent protocol stac,k consisting of three protocol,s is shown in the following figure: