Overview of the AG-UI .NET SDK
mainMicrosoft.Extensions.AI.repository·main·Indexed 12 days ago
https://github.com/ag-ui-protocol/ag-uiAn open, event-based protocol that standardizes interactions between AI agents and user-facing applications. It enables real-time chat, generative UI, and bi-directional state synchronization. The ecosystem includes the AG-UI Protocol Dojo for exploring agent demos, a CLI example for streaming responses and tool call visualization, and integrations such as @ag-ui/a2a for remote A2A protocol services and ADK middleware for FastAPI-based agentic interaction patterns.
Microsoft.Extensions.AI.The ChatApp Wear OS sample is a standalone Wear OS application that demonstrates how to deliver an AG-UI chat experience on a wearable device. It reuses the chatapp-shared Kotlin multiplatform core to handle networking, state, and tool-confirmation layers.
Key Capabilities:
ChatController from chatapp-shared.androidx.wear.compose:compose-material3 to render streaming responses, tool confirmations, and error recovery in a compact layout.The Langroid integration allows you to adapt Langroid agents to the AG-UI protocol. It works by wrapping standard Langroid components with an AG-UI aware layer that understands AG-UI events, tool semantics, and shared-state conventions.
Key architectural features:
LangroidAgent to wrap langroid.ChatAgent or langroid.Task.The AG-UI Protocol Dojo is an interactive viewer designed for exploring CopilotKit agent demos. It provides a centralized interface to browse, preview, and inspect the source code of various agent implementations.
Key features include:
The Rust SDK is organized into two primary packages:
Agent trait, the HttpAgent implementation, and the subscriber system for handling interactions.The .NET SDK is modular, allowing you to adopt specific parts of the protocol independently. Use the following packages based on your requirements:
| Package | Use it for |
|---|---|
AGUI.Abstractions | Protocol events, messages, tools, capabilities, interrupts, and JSON serialization. |
AGUI.Formatting | Event-stream formatter abstractions and Server-Sent Events (SSE) support. |
AGUI.Protobuf | Protobuf event-stream formatting and binary protocol support. |
AGUI.Client | HTTP client and IChatClient implementation for consuming AG-UI endpoints. |
AGUI.Server | Framework-agnostic adapter from ChatResponseUpdate streams to AG-UI events. |
The @ag-ui/core package provides the foundational building blocks for the AG-UI protocol:
Message, Tool, Context, RunAgentInput, and State.The @ag-ui/a2ui-toolkit package provides framework-agnostic helpers designed for building A2UI (Agent-to-User Interface) subagent tools.
It is intended to be used as a foundation for framework-specific adapters (such as LangGraph, ADK, or Mastra). These adapters compose the toolkit's helpers with framework-specific logic like tool decorators, runtime accessors, and model bindings. The toolkit itself has zero dependencies on any specific agent framework.
The ag-ui-server library provides server-side utilities for building agents and streaming AG-UI events to clients. It is divided into two main functional areas:
Core Server Utilities (com.agui.server): Provides the foundation for local agents and event helpers.
LocalAgent: The base class for implementing server-side agents that emit events.EventFactory: Provides convenience methods to create standard AG-UI events.streamer.AgentStreamer: Acts as a bridge to connect agents to an EventStream.Spring Boot Integration (com.agui.server.spring): Provides seamless integration for Spring-based applications.
AgUiService: Manages running agents and streaming via SseEmitter.AgUiParameters: Maps incoming HTTP payloads to RunAgentParameters.The ag-ui-claude-agent-sdk provides several advanced interaction capabilities:
adapter.interrupt().TOOL_CALL_ARGS emission as JSON arguments stream in.ag_ui_update_state tool.@tool decorator to define custom tools.The @ag-ui/client SDK manages the full lifecycle of AG-UI communication. Key capabilities include:
HttpAgent for direct server connections (SSE/protobuf).AbstractAgent base class for implementing custom transport layers.The AG-UI Kotlin SDK is a Kotlin Multiplatform (KMP) client library designed to connect Kotlin applications to AI agents that implement the Agent User Interaction Protocol (AG-UI). It provides transport mechanisms, state management, and tool integration for communication across Android, iOS, and JVM platforms.
Key architectural components include:
The SDK uses native Kotlin idioms such as sealed classes, suspend functions, and Kotlin Flows for streaming responses to maintain conceptual parity with the TypeScript implementation.