wiki / concepts / ag-ui-protocol

AG-UI Protocol

high confidence updated 2026-08-30 agents · workflow · context-engineering · subagents

AG-UI Protocol

AG-UI (Agent–User Interaction Protocol) is an open, event-based specification that standardizes communication between backend agent execution loops and user-facing frontend applications. Originated by copilotkit in partnership with ecosystem frameworks (LangChain, CrewAI, Microsoft Agent Framework, AWS Bedrock AgentCore), AG-UI defines the frontend interaction layer alongside MCP (tools) and A2A (agent coordination). [source: ag-ui-protocol-specification-2026]

The Three Agentic Protocols

graph LR
    User[User / Frontend UI] <-- "AG-UI (Agent-User Interaction)" --> Agent[Agent Runtime / Backend]
    Agent <-- "MCP (Model Context Protocol)" --> Tools[External Tools & Data]
    Agent <-- "A2A (Agent to Agent)" --> Subagents[Distributed Agents]
LayerProtocolPrimary Origin / BackersPurpose
Agent ↔ UserAG-UIcopilotkit, LangChain, AWS, MicrosoftStandardizes streaming state, generative UI, client tools, and human-in-the-loop gates.
Agent ↔ Tools & DataMCPanthropicStandardizes tool definitions, context injection, and resource prompts.
Agent ↔ AgentA2AGoogleStandardizes distributed agent discovery, delegation, and message routing.

[source: ag-ui-protocol-specification-2026]

Protocol Primitives & Lifecycle Events

AG-UI models agent execution as a stateful, bi-directional event stream transported over Server-Sent Events (SSE) or WebSockets:

  1. Lifecycle & Text Streaming: RUN_STARTED, TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, RUN_FINISHED.
  2. Tool Execution Tracing: TOOL_CALL_START, TOOL_CALL_ARGS, TOOL_CALL_END, TOOL_CALL_RESULT.
  3. Reasoning & Thinking: REASONING_START, REASONING_DELTA, REASONING_END to display progress signals without leaking raw chain-of-thought tokens.
  4. Shared State Sync: Streamed event-sourced snapshots and delta updates (STATE_SNAPSHOT, STATE_DELTA) between client state and agent memory.
  5. Human-in-the-Loop (HITL) Interrupts: Protocol-level pause, approve, reject, or edit capabilities enabling gated tool execution.

Architectural Patterns

1. Pure Event-to-Message Fold

Frontends (such as assistant-ui or CopilotKit) maintain a pure reducer that projects the session event log into the client message model. Replaying stored historical events and tailing live SSE streams execute through the exact same fold function, ensuring state consistency across page reloads. [source: assistant-ui-claude-managed-agents-2026]

2. Generative UI (Static & Declarative)

Rather than raw markdown alone, agent backends emit structured intents that client components mount as typed, interactive widgets (charts, forms, parameter selectors). [source: ag-ui-protocol-specification-2026]

3. Multi-Surface Transport

Because AG-UI defines an event stream rather than a DOM rendering engine, it operates across React, React Native (native mobile components), Angular, and messaging platforms (Slack, Microsoft Teams) via channel adapters. [source: copilotkit-cma-agui-2026]