In recent years, AI Copilot applications have flourished, ranging from GitHub Copilot to Notion AI and the ChatGPT plugin ecosystem. Increasingly, products are incorporating AI into real-world business workflows.
But for developers, a key challenge has emerged:
How can a frontend UI dynamically display an LLM’s reasoning process, the tools it calls, document sources, and status updates in real time?
The traditional “chat bubble” UI (like ChatGPT) often falls short. The industry needs a standard “AI Copilot frontend protocol” + a “framework-based frontend toolkit” as foundational infrastructure.
This quick tutorial helps you integrate AG-UI CopilotKit into your React app in minutes.
This post introduces two core components:
- AG-UI: A universal frontend interaction protocol that defines the events and component rules between LLMs and the frontend.
- CopilotKit: A React-based open-source frontend framework that implements the AG-UI protocol, offering rich interactivity and extensibility.
With these, developers can assemble Copilot interfaces — complete with toolbars, cards, forms, and visual workflows — like building blocks, turning AI reasoning from a “black box” into a transparent, controllable collaboration process.
AG-UI Protocol Overview
AG-UI (Agent-Generated UI) is a frontend protocol designed specifically for AI Copilot apps. Its main goal:
Enable LLMs (or Agents) to drive the frontend by generating structured data that creates dynamic UI components — supporting multi-turn interactions, information display, and tool calls.
Think of it as:
- For the LLM: generate structured JSON instead of plain natural language.
- For the frontend: read JSON and render components like cards, buttons, forms, charts, and tags.
Core Capabilities of AG-UI
Capability | Example |
---|---|
Card rendering | Tool call result (“Meeting created successfully, time: 15:00”) |
Action buttons | “Regenerate,” “View Details,” “Call API” |
Form generation | Dynamically prompt the user for missing info |
Component composition | A single card with a table + chart + buttons |
Status updates | Progress bars, state changes (“Processing → Done”) |
Simple AG-UI Example
{
"type": "card",
"title": "Search Results",
"body": [
{ "type": "text", "value": "Found 12 related results:" },
{
"type": "table",
"columns": ["Title", "Source", "Published Date"],
"data": [["IoT Trends", "Zedyer", "2025-08-01"]]
}
],
"actions": [
{ "type": "button", "label": "View More", "action": "load_more" }
]
}
AG-UI is model-agnostic — it works with GPT-4, Claude, DeepSeek, or any model that can output JSON.
CopilotKit Component Breakdown
CopilotKit is a React-based toolkit that implements the AG-UI protocol. It supports both server-side rendering and frontend builds. Its goal:
Provide a structured, transparent, and interactive presentation layer for AI Agents — a standard Copilot UI component library.
Core Components
Component | Function |
---|---|
CopilotSidebar | Chat area + card display, supports multi-turn rendering |
CopilotTextarea | LLM-assisted input, autocomplete, embedded citations |
CopilotCard | Renders AI-generated dynamic cards (status, feedback) |
CopilotActions | Action button area, binds to LLM-returned actions |
useCopilot Hook | Event subscription, push updates, streaming responses |
CopilotLayout | Responsive layout for plugin bar, chat area, action area |
Connecting to LLMs
CopilotKit connects to LLM backends (OpenAI, Claude, DeepSeek API, etc.) via API or streaming. On the server side, you can wrap inference results into AG-UI structures before sending them to the frontend.
AG-UI Copilotkit Architecture
graph TD subgraph AI Model Layer direction TB L1["Multi-Model Orchestration (LangGraph / AutoGen / LangChain)"]:::aiLayer L2["Business Knowledge Base & Toolset"]:::aiLayer end subgraph Protocol Bridge Layer direction TB P1["AG-UI Protocol Parser"]:::bridgeLayer P2["Event & Data Binding Module"]:::bridgeLayer end subgraph Frontend Rendering Layer direction TB F1["CopilotKit Frontend Framework"]:::frontendLayer F2["Plugin System (Visual Components, Tables, Charts, Buttons)"]:::frontendLayer F3["Interaction Event Listener"]:::frontendLayer end subgraph Backend & External Services direction TB B1["Business APIs / IoT Platform"]:::backendLayer B2["Database / Data Warehouse"]:::backendLayer B3["3rd-Party Service APIs"]:::backendLayer end L1 --> P1 L2 --> P1 P1 --> P2 P2 --> F1 F1 --> F2 F2 --> F3 F3 --> B1 F3 --> B2 F3 --> B3 %% Styles classDef aiLayer fill:#f6d365,stroke:#333,stroke-width:1px,color:#000; classDef bridgeLayer fill:#ffb7b2,stroke:#333,stroke-width:1px,color:#000; classDef frontendLayer fill:#c3f0ca,stroke:#333,stroke-width:1px,color:#000; classDef backendLayer fill:#cde7f0,stroke:#333,stroke-width:1px,color:#000;
AG-UI Quick Start with Copilotkit (3 steps)
- Install
npm i @copilotkit/react-core @copilotkit/react-ui @ag-ui/client
- Wrap the app with CopilotKit
// app/layout.tsx import { CopilotKit } from "@copilotkit/react-core"; export default function Root({ children }) { return <CopilotKit>{children}</CopilotKit>; }
- Bridge & Subscribe
- Create a streaming API endpoint that emits AG-UI events (e.g., HTTP/SSE).
- In the client, create an HttpAgent and iterate events (TEXT_MESSAGE_, TOOL_CALL_, RUN_FINISHED, UI/State updates) to render UI.
*Why AG-UI? **Instead of ad-hoc REST/WebSocket payloads, AG-UI defines intent-rich event types, so your frontend can react to agent reasoning and state updates immediately.
Integrations (what developers search for)
- LangGraph + CopilotKit — add a research-assistant UI in minutes (bridge → provider → subscribe).
- AG2 (AutoGen 2) + CopilotKit — same pattern, first-party examples available.
- Others: CrewAI / Mastra / Pydantic AI—follow the same bridge pattern.
Plugin System & Event Mechanism
A great AI frontend can’t just render static cards — it must support dynamic tool calls and real-time results. CopilotKit implements the AG-UI protocol with a plugin system and an event bus.
Plugin System
Plugins are pluggable frontend modules. Once a communication protocol is agreed with the AI Agent, they can be added like “app store” items to enhance the Copilot UI.
Common plugin types:
- Data Source Plugins: Query databases or knowledge bases and return results as AG-UI cards.
- Business Plugins: Call CRM, ERP, or IoT APIs for business actions (update inventory, adjust AC temperature).
- Visualization Plugins: Render charts, maps, flow diagrams.
- Action Plugins: Offer shortcuts like “Export to Excel” or “Send Email.”
📌 Example plugin communication flow:
sequenceDiagram participant User as User participant UI as CopilotKit Frontend participant Plugin as Plugin Module participant Agent as AI Agent User->>UI: Click "Generate Sales Report" UI->>Plugin: Send plugin call event Plugin->>Agent: Request AI to generate data Agent->>Plugin: Return analysis results Plugin->>UI: Render AG-UI card + chart
Event Bus
CopilotKit’s built-in event bus handles two-way communication between frontend components, plugins, and the AI Agent.
Typical events:
- onAction: User clicks a button to trigger business logic
- onUpdate: Streamed AI reasoning updates
- onError: Task failures or timeouts
- onData: Plugin data updates
This removes the need for complex callback management — just subscribe to events and bind logic.
Multi-Model Collaboration (LangGraph, AutoGen, LangChain)
In real-world AI Copilot systems, the frontend is just the entry point. The actual reasoning and business execution often involve multiple models and Agents.
The AG-UI + CopilotKit combo works seamlessly with orchestration frameworks like LangGraph, AutoGen, and LangChain.
🔹 LangGraph
- Ideal for stateful, multi-node reasoning workflows.
- Each node can return an AG-UI component (progress bar, interim results card).
🔹 AutoGen
- Focuses on Agent-to-Agent conversational task breakdown.
- CopilotKit can visualize the multi-Agent conversation so users see task distribution and execution flow.
🔹 LangChain
- Often used for tool integration.
- Tool outputs can be displayed via AG-UI cards, e.g., database queries rendered as tables + charts.
Example: Multi-Model Collaboration UI
graph LR A[User Request: Generate Market Analysis Report]:::input --> B[LangChain Calls Data Analysis Tool]:::process B --> C[LangGraph Coordinates Chart Generation Model]:::process C --> D[AutoGen Team Writes Conclusions & Recommendations]:::ai D --> E[AG-UI Renders Combined Report Card + Buttons]:::ui classDef input fill:#fff9c4,stroke:#fbc02d,stroke-width:2px,color:#6d4c41,rounded:10px classDef process fill:#bbdefb,stroke:#1976d2,stroke-width:2px,color:#0d47a1,rounded:10px classDef ai fill:#ffe0b2,stroke:#ef6c00,stroke-width:2px,color:#e65100,rounded:10px classDef ui fill:#c8e6c9,stroke:#388e3c,stroke-width:2px,color:#1b5e20,rounded:10px
AG-UI Use Cases
1. Enterprise Data Analysis Copilot
- Need: Business users want instant sales reports and interactive analysis.
- Solution:
- CopilotKit + AG-UI receive user requests.
- AI Agent calls LangChain tools to fetch database data.
- Visualization plugin renders sales trends, regional maps, with an export button.
- Result: No SQL needed — click and get insights, with AI suggesting next steps.
2. Intelligent Operations Dashboard
- Need: Ops teams need real-time IoT status and quick control commands.
- Solution:
- IoT platform feeds data via plugin system.
- AI analyzes device health, highlighting anomalies.
- Action buttons (“Restart,” “Switch Backup Line”) trigger backend APIs.
- Result: AI reasoning + real-time control in one adaptive dashboard.
3. Multi-Language Customer Support Panel
- Need: Global SaaS customer support with AI assistance.
- Solution:
- CopilotKit renders multi-turn chat cards.
- AI Agent integrates translation models + domain knowledge.
- Plugins handle “Send Email,” “Create Ticket.”
- Result: AI handles language; agents handle customers — all in one UI.
Final Thoughts of AG-UI Protocol
AG-UI solves the problem of AI outputs lacking structure and interactivity.
CopilotKit brings frontend implementation and modular extensibility, letting developers quickly build interactive, visual, and actionable AI frontends.
Key Advantages:
- Unified Protocol: Standard bridge between AI output and frontend rendering.
- Plugin Extensions: Add business modules on demand.
- Event-Driven: Lower dev complexity, easier maintenance.
- Multi-Model Friendly: Works with LangGraph, AutoGen, and LangChain.
As demand grows for interactive, visual AI apps, this combo is well-positioned to become the de facto standard for next-gen AI frontends.
FAQ
Q1: What is the AG-UI CopilotKit integration?
A1: It’s a React-based framework built atop the AG-UI (Agent-User Interaction) Protocol, enabling developers to wire up AI agent backends to frontend apps using JSON event streams with minimal boilerplate.
Q2: What is the AG-UI Protocol?
A2: AG-UI is an open, lightweight, event-based protocol that standardizes communication between AI agents and UIs. It streams ordered JSON events (e.g., messages, tool calls, state patches, lifecycle events) over HTTP/SSE or optional binary/WebSocket transports.
Q3: What types of events does AG-UI support?
A3: It supports a variety of semantic events, including:
- Lifecycle events like
RUN_STARTED
/RUN_FINISHED
- Text streaming events like
TEXT_MESSAGE_START
/TEXT_MESSAGE_CONTENT
/TEXT_MESSAGE_END
- Tool call events like
TOOL_CALL_START
/TOOL_CALL_ARGS
/TOOL_CALL_END
- State updates like
STATE_SNAPSHOT
/STATE_DELTA
Q4: How does CopilotKit enhance AG-UI?
A4: CopilotKit provides a React Provider, runtime abstractions, and UI components that seamlessly consume AG-UI event streams—so you can build interactive AI interfaces quickly using frameworks like LangGraph, AG2, CrewAI, and more.
Q5: Which agent frameworks are supported by AG-UI + CopilotKit?
A5: Supported configurations include:
- LangGraph + CopilotKit
- AG2 + CopilotKit with first‑party starter kits
- CrewAI, Mastra, Pydantic AI and others via CopilotKit bridges
Q6: Is AG-UI CopilotKit open-source?
A6: Yes. Both the AG-UI protocol (under MIT license) and CopilotKit implementations are open-source and available on GitHub. GitHub+1
Open-Source References
- AG-UI Protocol:
Ag-ui · GitHub — Protocol specs & examples.- CopilotKit:
CopilotKit · GitHub — React/Vue SDK & plugin system.- Multi-Model Orchestration: