Repository: ag-ui-protocol/ag-ui
Stars: 13050
CLAUDE.md
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Common Development Commands
TypeScript SDK (Main Development)
Install dependencies (using pnpm)
pnpm installBuild all packages
pnpm buildRun development mode
pnpm devRun linting
pnpm lint
Run type checking
pnpm check-typesRun tests
pnpm testFormat code
pnpm formatClean build artifacts
pnpm cleanFull clean build
pnpm build:cleanPython SDK
Navigate to python-sdk directory
cd python-sdkInstall dependencies (using poetry)
poetry installRun tests
python -m unittest discover testsBuild distribution
poetry buildRunning Specific Integration Tests
For TypeScript packages/integrations
cd packages/<package-name>
pnpm testFor running a single test file
cd packages/<package-name>
pnpm test -- path/to/test.spec.tsHigh-Level Architecture
AG-UI is an event-based protocol that standardizes agent-user interactions. The codebase is organized as a monorepo with the following structure:
Core Protocol Architecture
- Event-Driven Communication: All agent-UI communication happens through typed events (BaseEvent and its subtypes)
- Transport Agnostic: Protocol supports SSE, WebSockets, HTTP binary, and custom transports
- Observable Pattern: Uses RxJS Observables for streaming agent responses
Key Abstractions
1. AbstractAgent: Base class that all agents must implement with a
run(input: RunAgentInput) -> Observable<BaseEvent> method2. HttpAgent: Standard HTTP client supporting SSE and binary protocols for connecting to agent endpoints
3. Event Types: Lifecycle events (RUN_STARTED/FINISHED), message events (TEXT_MESSAGE_), tool events (TOOL_CALL_), and state management events (STATE_SNAPSHOT/DELTA)
Repository Structure
-
/sdks/typescript/: Main TypeScript implementation-
/packages/: Core protocol packages (@ag-ui/core, @ag-ui/client, @ag-ui/encoder, @ag-ui/proto)-
/integrations/: Framework integrations (langgraph, mastra, crewai, etc.)-
/apps/: Example applications including the AG-UI Dojo demo viewer-
/sdks/python/: Python implementation of the protocol-
/docs/: Documentation site contentIntegration Pattern
Each framework integration follows a similar pattern:
1. Implements the AbstractAgent interface
2. Translates framework-specific events to AG-UI protocol events
3. Provides both TypeScript client and Python server implementations
4. Includes examples demonstrating key AG-UI features (agentic chat, generative UI, human-in-the-loop, etc.)
State Management
- Uses STATE_SNAPSHOT for complete state representations
- Uses STATE_DELTA with JSON Patch (RFC 6902) for efficient incremental updates
- MESSAGES_SNAPSHOT provides conversation history
Multiple Sequential Runs
- AG-UI supports multiple sequential runs in a single event stream
- Each run must complete (RUN_FINISHED) before a new run can start (RUN_STARTED)
- Messages accumulate across runs (e.g., messages from run1 + messages from run2)
- State continues to evolve across runs unless explicitly reset with STATE_SNAPSHOT
- Run-specific tracking (active messages, tool calls, steps) resets between runs
Development Workflow
- Nx is used for monorepo build orchestration
- Each package has independent versioning
- Integration tests demonstrate protocol compliance
- The AG-UI Dojo app showcases all protocol features with live examples
<!-- nx configuration start-->
<!-- Leave the start & end comments to automatically receive updates. -->
General Guidelines for working with Nx
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through nx (i.e. nx run, nx run-many, nx affected) instead of using the underlying tooling directly
- You have access to the Nx MCP server and its tools, use them to help the user
- When answering questions about the repository, use the nx_workspace tool first to gain an understanding of the workspace architecture where applicable.
- When working in individual projects, use the nx_project_details mcp tool to analyze and understand the specific project structure and dependencies
- For questions around nx configuration, best practices or if you're unsure, use the nx_docs tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the nx_workspace tool to get any errors
- For Nx plugin best practices, check node_modules/@nx/<plugin>/PLUGIN.md. Not all plugins have this file - proceed without it if unavailable.
<!-- nx configuration end-->
README.md
<img src="https://github.com/user-attachments/assets/ebc0dd08-8732-4519-9b6c-452ce54d8058" alt="ag-ui Logo" width="22"/> AG-UI: The Agent-User Interaction Protocol
AG-UI is an open, lightweight, event-based protocol that standardizes how AI agents connect to user-facing applications.
Built for simplicity and flexibility, it enables seamless integration between AI agents, real time user context, and user interfaces.
---
<br>

!MIT
!Discord
<a href="https://discord.gg/Jd3FzfdJa8" target="_blank"> Join our Discord โ </a> <a href="https://ag-ui.com/" target="_blank"> Read the Docs โ </a> <a href="https://dojo.ag-ui.com/" target="_blank"> Go to the AG-UI Dojo โ </a> <a href="https://x.com/CopilotKit" target="_blank"> Follow us โ </a>
<img width="1600" height="680" alt="1600x680" src="https://github.com/user-attachments/assets/00ec7366-713e-443f-a8f0-8db52ad28ef4" />
๐ Getting Started
Create a new AG-UI application in seconds:
npx create-ag-ui-app my-agent-app<h3> Useful Links:</h3>
- The AG-UI Dojo
- Build AG-UI-powered applications(Quickstart)
- Build new AG-UI framework integrations (Quickstart)
- Book a call to discuss an AG-UI integration with a new framework
- Join the Discord Community
What is AG-UI?
AG-UI is an open, lightweight, event-based protocol for agent-human interaction, designed for simplicity & flexibility:
- During agent executions, agent backends emit events _compatible_ with one of AG-UI's ~16 standard event types
- Agent backends can accept one of a few simple AG-UI compatible inputs as arguments
AG-UI includes a flexible middleware layer that ensures compatibility across diverse environments:
- Works with any event transport (SSE, WebSockets, webhooks, etc.)
- Allows for loose event format matching, enabling broad agent and app interoperability
It also ships with a reference HTTP implementation and default connector to help teams get started fast.
Learn more about the specs โ
Why AG-UI?
AG-UI was developed based on real-world requirements and practical experience building in-app agent interactions.
Where does AGUI fit in the agentic protocol stack?
AG-UI is complementary to the other 2 top agentic protocols
- MCP gives agents tools
- A2A allows agents to communicate with other agents
- AG-UI brings agents into user-facing applications
<div align="center">
<img width="2048" height="1182" alt="The Agent Protocol Stack" src="https://github.com/user-attachments/assets/41138f71-50be-4812-98aa-20e0ad595716" />
</div>
๐ Features
- ๐ฌ Real-time agentic chat with streaming
- ๐ Bi-directional state synchronization
- ๐งฉ Generative UI and structured messages
- ๐ง Real-time context enrichment
- ๐ ๏ธ Frontend tool integration
- ๐งโ๐ป Human-in-the-loop collaboration
๐ Supported Integrations
AG-UI was born from CopilotKit's initial partnership with LangGraph and CrewAI - and brings the incredibly popular agent-user-interactivity infrastructure to the wider agentic ecosystem.
1st party = the platforms that have AGโUI built in and provide documentation for guidance.
Frameworks
| Framework | Status | AG-UI Resources |
| ------------------------------------------------------------------ | ------------------------ | -------------------------------------------------------------------------------- |
| Built-in Agent | โ
Supported | โก๏ธ Docs |
๐ค Partnerships
| Framework | Status | AG-UI Resources |
| ---------- | ------- | ---------------- |
| LangGraph | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| CrewAI | โ Supported | โก๏ธ Docs ๐ฎ Demos |
๐งฉ 1st Party
| Framework | Status | AG-UI Resources |
| ---------- | ------- | ---------------- |
| Microsoft Agent Framework | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| Google ADK | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| AWS Strands Agents | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| AWS Bedrock AgentCore | โ Supported | โก๏ธ Docs |
| Mastra | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| Pydantic AI | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| Agno | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| LlamaIndex | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| AG2 | โ Supported | โก๏ธ Docs ๐ฎ Demos |
| AWS Bedrock Agents | ๐ ๏ธ In Progress | โ |
๐ Community
| Framework | Status | AG-UI Resources |
| ---------- | ------- | ---------------- |
| Langroid | โ Supported | ๐ฎ Demos |
| OpenAI Agent SDK | ๐ ๏ธ In Progress | โ |
| Cloudflare Agents | ๐ ๏ธ In Progress | โ |
Agent Interaction Protocols
| Protocols | Status | AG-UI Resources | Integrations |
| ---------- | ------- | ---------------- | ------------- |
| [A2A]() | โ
Supported | โก๏ธ Docs | Partnership |
Infrastructure / Deployment
| Platform | Status | AG-UI Resources | Integrations |
| ---------- | ------- | ---------------- | ------------- |
| Amazon Bedrock AgentCore | โ Supported | โก๏ธ Docs | 1st Party |
Specification (standard)
| Framework | Status | AG-UI Resources |
| ---------- | ------- | ---------------- |
| Oracle Agent Spec | โ Supported | โก๏ธ Docs ๐ฎ Demos |
Generative UI
| Framework | Status | AG-UI Resources |
| ---------- | ------- | ---------------- |
| MCP Apps | โ Supported | โก๏ธ Docs ๐ฎ [Demos]() |
SDKs
| SDK | Status | AG-UI Resources | Integrations |
| --- | ------- | ---------------- | ------------- |
| [Kotlin]() | โ
Supported | โก๏ธ Getting Started | Community |
| [Golang]() | โ
Supported | โก๏ธ Getting Started | Community |
| [Dart]() | โ
Supported | โก๏ธ Getting Started | Community |
| [Java]() | โ
Supported | โก๏ธ Getting Started | Community |
| [Rust]() | โ
Supported | โก๏ธ Getting Started | Community |
| [Ruby]() | โ
Supported | โก๏ธ Getting Started | Community |
| [.NET]() | ๐ ๏ธ In Progress | โก๏ธ PR | Community |
| [Nim]() | ๐ ๏ธ In Progress | โก๏ธ PR | Community |
| [Flowise]() | ๐ ๏ธ In Progress | โก๏ธ GitHub Source | Community |
| [Langflow]() | ๐ ๏ธ In Progress | โก๏ธ GitHub Source | Community |
| [C++]() | ๐ ๏ธ In Progress | โก๏ธ GitHub Source | Community |
Clients
| Client | Status | AG-UI Resources | Integrations |
| --- | ------- | ---------------- | ------------- |
| CopilotKit | โ
Supported | โก๏ธ Getting Started | 1st Party |
| [Terminal + Agent]() | โ
Supported | โก๏ธ Getting Started | Community |
| [React Native]() | ๐ ๏ธ Help Wanted | โก๏ธ GitHub Source | Community |
View all supported integrations โ
Examples
Hello World App
Video:
https://github.com/user-attachments/assets/18c03330-1ebc-4863-b2b8-cc6c3a4c7bae
https://agui-demo.vercel.app/
The AG-UI Dojo (Building-Blocks Viewer)
The AG-UI Dojo demonstrates AG-UI's core building blocks through simple, focused examplesโeach just 50-200 lines of code.
View the source code for the Dojo and all framework integrations here.
https://github.com/user-attachments/assets/c298eea8-3f39-4a94-b968-7712429b0c49
๐๐ฝโโ๏ธ Contributing to AG-UI
Check out the Contributing guide
- Bi-Weekely AG-UI Working Group
๐
Follow the CopilotKit Luma Events Calendar
Roadmap
Check out the AG-UI Roadmap to see what's being built and where you can jump in.
๐ License
AG-UI is open source software licensed as MIT.