# 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) ```bash # Install dependencies (using pnpm) pnpm install # Build all packages pnpm build # Run development mode pnpm dev # Run linting pnpm lint # Run type checking pnpm check-types # Run tests pnpm test # Format code pnpm format # Clean build artifacts pnpm clean # Full clean build pnpm build:clean ``` ### Python SDK ```bash # Navigate to python-sdk directory cd python-sdk # Install dependencies (using poetry) poetry install # Run tests python -m unittest discover tests # Build distribution poetry build ``` ### Running Specific Integration Tests ```bash # For TypeScript packages/integrations cd packages/ pnpm test # For running a single test file cd packages/ pnpm test -- path/to/test.spec.ts ``` ## High-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` method 2. **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 content ### Integration 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 # 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.md`. Not all plugins have this file - proceed without it if unavailable. ## README.md # ag-ui Logo 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. ---
[![Version](https://img.shields.io/npm/v/@ag-ui/core?label=Version&color=6963ff&logo=npm&logoColor=white)](https://www.npmjs.com/package/@ag-ui/core) ![MIT](https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License) ![Discord](https://img.shields.io/discord/1379082175625953370?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff) Join our Discord โ†’     Read the Docs โ†’     Go to the AG-UI Dojo โ†’     Follow us โ†’ 1600x680 ## ๐Ÿš€ Getting Started Create a new AG-UI application in seconds: ```bash npx create-ag-ui-app my-agent-app ```

Useful Links:

- [The AG-UI Dojo](https://dojo.ag-ui.com/) - [Build AG-UI-powered applications(Quickstart)](https://docs.ag-ui.com/quickstart/applications) - [Build new AG-UI framework integrations (Quickstart)](https://go.copilotkit.ai/agui-contribute) - [Book a call to discuss an AG-UI integration with a new framework](https://calendly.com/markus-copilotkit/ag-ui) - [Join the Discord Community](https://discord.gg/Jd3FzfdJa8) ## 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 โ†’](https://go.copilotkit.ai/ag-ui-introduction) ## 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
The Agent Protocol Stack
## ๐Ÿš€ 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](https://docs.copilotkit.ai/direct-to-llm) | ### ๐Ÿค Partnerships | Framework | Status | AG-UI Resources | | ---------- | ------- | ---------------- | | [LangGraph](https://www.langchain.com/langgraph) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/langgraph/) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/langgraph-fastapi/feature/shared_state) | | [CrewAI](https://crewai.com/) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/crewai-flows) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/crewai/feature/shared_state) | ### ๐Ÿงฉ 1st Party | Framework | Status | AG-UI Resources | | ---------- | ------- | ---------------- | | [Microsoft Agent Framework](https://azure.microsoft.com/en-us/blog/introducing-microsoft-agent-framework/) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/microsoft-agent-framework) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/microsoft-agent-framework-dotnet/feature/shared_state) | | [Google ADK](https://google.github.io/adk-docs/get-started/) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/adk) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/adk-middleware/feature/shared_state?openCopilot=true) | | [AWS Strands Agents](https://github.com/strands-agents/sdk-python) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/aws-strands) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/aws-strands/feature/shared_state) | | [AWS Bedrock AgentCore](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-agui-protocol-contract.html) | โœ… Supported | โžก๏ธ [Docs](https://github.com/awslabs/fullstack-solution-template-for-agentcore) | | [Mastra](https://mastra.ai/) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/mastra/) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/mastra/feature/tool_based_generative_ui) | | [Pydantic AI](https://github.com/pydantic/pydantic-ai) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/pydantic-ai/) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/pydantic-ai/feature/shared_state) | | [Agno](https://github.com/agno-agi/agno) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/agno/) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/agno/feature/tool_based_generative_ui) | | [LlamaIndex](https://github.com/run-llama/llama_index) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/llamaindex/) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/llamaindex/feature/shared_state) | | [AG2](https://ag2.ai/) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/ag2/) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/ag2/feature/shared_state) | | [AWS Bedrock Agents](https://aws.amazon.com/bedrock/agents/) | ๐Ÿ› ๏ธ In Progress | โ€“ | ### ๐ŸŒ Community | Framework | Status | AG-UI Resources | | ---------- | ------- | ---------------- | | [Langroid](https://github.com/ag-ui-protocol/ag-ui/tree/main/integrations/langroid) | โœ… Supported | ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/langroid/feature/shared_state) | | [OpenAI Agent SDK](https://openai.github.io/openai-agents-python/) | ๐Ÿ› ๏ธ In Progress | โ€“ | | [Cloudflare Agents](https://developers.cloudflare.com/agents/) | ๐Ÿ› ๏ธ In Progress | โ€“ | ## Agent Interaction Protocols | Protocols | Status | AG-UI Resources | Integrations | | ---------- | ------- | ---------------- | ------------- | | [A2A]() | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/a2a-protocol) | Partnership | ## Infrastructure / Deployment | Platform | Status | AG-UI Resources | Integrations | | ---------- | ------- | ---------------- | ------------- | | [Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/) | โœ… Supported | โžก๏ธ [Docs](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-agui.html) | 1st Party | ## Specification (standard) | Framework | Status | AG-UI Resources | | ---------- | ------- | ---------------- | | [Oracle Agent Spec](http://oracle.github.io/agent-spec/) | โœ… Supported | โžก๏ธ [Docs](https://go.copilotkit.ai/copilotkit-oracle-docs) ๐ŸŽฎ [Demos](https://dojo.ag-ui.com/agent-spec-langgraph/feature/tool_based_generative_ui) | ## Generative UI | Framework | Status | AG-UI Resources | | ---------- | ------- | ---------------- | | [MCP Apps](https://blog.modelcontextprotocol.io/posts/2025-11-21-mcp-apps/) | โœ… Supported | โžก๏ธ [Docs](https://docs.copilotkit.ai/generative-ui-specs/mcp-apps) ๐ŸŽฎ [Demos]() | ## SDKs | SDK | Status | AG-UI Resources | Integrations | | --- | ------- | ---------------- | ------------- | | [Kotlin]() | โœ… Supported | โžก๏ธ [Getting Started](https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/kotlin/overview.mdx) | Community | | [Golang]() | โœ… Supported | โžก๏ธ [Getting Started](https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/go/overview.mdx) | Community | | [Dart]() | โœ… Supported | โžก๏ธ [Getting Started](https://github.com/ag-ui-protocol/ag-ui/tree/main/sdks/community/dart) | Community | | [Java]() | โœ… Supported | โžก๏ธ [Getting Started](https://github.com/ag-ui-protocol/ag-ui/blob/main/docs/sdk/java/overview.mdx) | Community | | [Rust]() | โœ… Supported | โžก๏ธ [Getting Started](https://github.com/ag-ui-protocol/ag-ui/tree/main/sdks/community/rust/crates/ag-ui-client) | Community | | [Ruby]() | โœ… Supported | โžก๏ธ [Getting Started](https://github.com/ag-ui-protocol/ag-ui/tree/main/sdks/community/ruby) | Community | | [.NET]() | ๐Ÿ› ๏ธ In Progress | โžก๏ธ [PR](https://github.com/ag-ui-protocol/ag-ui/pull/38) | Community | | [Nim]() | ๐Ÿ› ๏ธ In Progress | โžก๏ธ [PR](https://github.com/ag-ui-protocol/ag-ui/pull/29) | Community | | [Flowise]() | ๐Ÿ› ๏ธ In Progress | โžก๏ธ [GitHub Source](https://github.com/ag-ui-protocol/ag-ui/issues/367) | Community | | [Langflow]() | ๐Ÿ› ๏ธ In Progress | โžก๏ธ [GitHub Source](https://github.com/ag-ui-protocol/ag-ui/issues/366) | Community | | [C++]() | ๐Ÿ› ๏ธ In Progress | โžก๏ธ [GitHub Source](https://github.com/ag-ui-protocol/ag-ui/issues/1108) | Community | ## Clients | Client | Status | AG-UI Resources | Integrations | | --- | ------- | ---------------- | ------------- | | [CopilotKit](https://github.com/CopilotKit/CopilotKit) | โœ… Supported | โžก๏ธ [Getting Started](https://docs.copilotkit.ai/direct-to-llm/guides/quickstart) | 1st Party | | [Terminal + Agent]() | โœ… Supported | โžก๏ธ [Getting Started](https://docs.ag-ui.com/quickstart/clients) | Community | | [React Native]() | ๐Ÿ› ๏ธ Help Wanted | โžก๏ธ [GitHub Source](https://github.com/ag-ui-protocol/ag-ui/issues/510) | Community | [View all supported integrations โ†’](https://docs.ag-ui.com/introduction#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/ag-ui-protocol/ag-ui/tree/main/apps/dojo). https://github.com/user-attachments/assets/c298eea8-3f39-4a94-b968-7712429b0c49 ## ๐Ÿ™‹๐Ÿฝโ€โ™‚๏ธ Contributing to AG-UI Check out the [Contributing guide](https://github.com/ag-ui-protocol/ag-ui/blob/main/CONTRIBUTING.md) - **[Bi-Weekely AG-UI Working Group](https://lu.ma/CopilotKit?k=c)** ๐Ÿ“… Follow the CopilotKit Luma Events Calendar ## Roadmap Check out the [AG-UI Roadmap](https://github.com/orgs/ag-ui-protocol/projects/1) to see what's being built and where you can jump in. ## ๐Ÿ“„ License AG-UI is open source software [licensed as MIT](https://opensource.org/licenses/MIT).