BETACopilotKit + Partners

AG-UI Protocol

2 min read

The standard for streaming AI agent interactions to user interfaces.

Overview

While MCP connects agents to tools and A2A enables agent-to-agent communication, AG-UI addresses the user-facing layer: how do agents interact with humans through modern applications?

AG-UI streams structured events between agent backends and frontends, enabling rich, interactive experiences.

The Protocol Stack

┌─────────────────────────────────────────┐
│           User Interface (AG-UI)        │
└────────────────────┬────────────────────┘
                     │
┌────────────────────┴────────────────────┐
│              Agent Backend              │
├─────────────────┬───────────────────────┤
│   Tools (MCP)   │   Other Agents (A2A)  │
└─────────────────┴───────────────────────┘

Core Event Types (~17 total)

Message Events

  • TEXT_MESSAGE_START: Begin streaming
  • TEXT_MESSAGE_CONTENT: Token chunks
  • TEXT_MESSAGE_END: Complete message

Tool Events

  • TOOL_CALL: Request tool execution
  • TOOL_RESULT: Return results

State Events

  • STATE_DELTA: Incremental patches
  • STATE_SNAPSHOT: Full sync

Control Events

  • INTERRUPT: Pause for user confirmation
  • ERROR: Report failures
  • LIFECYCLE: Start/stop signals

Key Features

Real-Time Streaming

Tokens stream as generated. Works over SSE, WebSockets, or webhooks.

Shared State

Using STATE_DELTA, agents and frontends stay synchronized with minimal data transfer.

Human-in-the-Loop

The INTERRUPT event enables safety-critical patterns:

{
  "type": "INTERRUPT",
  "action": "delete_all_records",
  "message": "Are you sure?",
  "options": ["approve", "deny"]
}

Framework Support

First-party integrations:

  • Microsoft Agent Framework
  • Google ADK
  • AWS Strands Agents
  • LangGraph
  • CrewAI

Adoption

  • 619K+ Python downloads/week
  • 178K+ JavaScript downloads/week
  • Oracle adopted for Agent Spec

When to Use AG-UI

Use AG-UI for:

  • Chat interfaces with streaming
  • Collaborative AI editing
  • Human-in-the-loop workflows
  • Real-time dashboards

Don't use AG-UI for:

  • Backend orchestration (use A2A)
  • Tool calling (use MCP)
Example Code
// React AG-UI Integration
import { useAgent } from '@ag-ui/react';

function ChatInterface() {
  const { messages, sendMessage, interrupt } = useAgent({
    endpoint: '/api/agent',
    onInterrupt: async (action) => {
      const approved = await showConfirmation(action);
      return approved ? 'approve' : 'deny';
    }
  });

  return (
    <div>
      {messages.map(msg => (
        <Message key={msg.id} content={msg.content} />
      ))}
      <Input onSubmit={sendMessage} />
      {interrupt && <InterruptDialog action={interrupt} />}
    </div>
  );
}
Quick Info
Architectureevent-driven
Message FormatJSON Events
TransportSSE, WebSocket, HTTP Webhooks
SDKsTypeScript, Python, React, Vue, Kotlin, Go
Agent-to-Agent Features
Discovery
Negotiation
Streaming
Bidirectional
Multi-Agent
Stay Updated

Get notified when protocols evolve.

Subscribe
Strengths
  • Purpose-built for frontend integration
  • Human-in-the-loop patterns built-in
  • Framework-agnostic design
  • Growing adoption (Oracle, Microsoft)
  • 600K+ weekly downloads
Considerations
  • Frontend-specific scope
  • No agent discovery
  • Smaller community than MCP/A2A
Tags
frontenduistreaminghuman-in-the-loop

Compare with Other Protocols

Compare against:(2/2)
AG-UI Protocol(current)
Strengths
AG-UI Protocol
beta
  • Purpose-built for frontend integration
  • Human-in-the-loop patterns built-in
  • Framework-agnostic design
Agent Name Service (ANS)
experimental
  • Leverages existing DNS infrastructure
  • Cryptographic identity via PKI
  • Scalable and decentralized
Agent Network Protocol (ANP)
experimental
  • Fully decentralized—no central authority
  • Strong privacy through DID-based identity
  • Semantic interoperability
Considerations
AG-UI Protocol
  • Frontend-specific scope
  • No agent discovery
  • Smaller community than MCP/A2A
Agent Name Service (ANS)
  • Early draft stage
  • Requires PKI infrastructure
  • DNS propagation delays
Agent Network Protocol (ANP)
  • Early stage (experimental)
  • Smaller ecosystem
  • Complex implementation
Best For
AG-UI Protocol
AI-powered chat interfacesCollaborative document editingApproval workflow UIsReal-time agent dashboards
Agent Name Service (ANS)
Finding agents by capabilityVerifying agent identityCross-platform discovery
Agent Network Protocol (ANP)
Decentralized agent marketplacesCross-organizational collaborationPrivacy-preserving networksFederated research systems
Technical Details
AG-UI ProtocolAgent Name Service (ANS)Agent Network Protocol (ANP)
Architectureevent-drivendistributeddecentralized
Message FormatJSON EventsDNS RecordsJSON-LD
TransportSSE, WebSocket, HTTP WebhooksDNSHTTP/HTTPS, WebSocket, DIDComm
Version1.0draft-000.1
SDKsTypeScript, Python, ReactPython, TypeScript
Architecture
AG-UI Protocolevent-driven
Agent Name Service (ANS)distributed
Agent Network Protocol (ANP)decentralized
Message Format
AG-UI ProtocolJSON Events
Agent Name Service (ANS)DNS Records
Agent Network Protocol (ANP)JSON-LD
Transport
AG-UI ProtocolSSE, WebSocket, HTTP Webhooks
Agent Name Service (ANS)DNS
Agent Network Protocol (ANP)HTTP/HTTPS, WebSocket, DIDComm
Version
AG-UI Protocol1.0
Agent Name Service (ANS)draft-00
Agent Network Protocol (ANP)0.1
SDKs
AG-UI ProtocolTypeScript, Python, React
Agent Name Service (ANS)
Agent Network Protocol (ANP)Python, TypeScript