The .NET team is pleased to announce that we've contributed a .NET SDK for AG-UI in collaboration with CopilotKit. The AG-UI .NET SDK lives in the AG-UI repository alongside the TypeScript and Python SDKs, published on NuGet under the MIT license. Any .NET service can now speak AG-UI directly. The Microsoft Agent Framework (MAF) AG-UI support for .NET is now based on the AG-UI .NET SDK.What is AG-UI?Agents break the traditional request-and-response paradigm. They are long-running, stream tokens as they work, delegate to subagents, and invoke tools mid-response. Without a shared protocol, each agent framework or service can expose a different streaming format, leaving application developers to parse chunks, track state, and map framework-specific events to UI. This creates boilerplate that you must maintain, and it can break whenever the event format shifts.AG-UI (Agent-User Interaction Protocol) standardizes how agents communicate with user-facing applications.It streams the agent lifecycle as typed events, grouped into several categories. The frontend listens for RUN_STARTED, TEXT_MESSAGE_CONTENT, STATE_DELTA, and the other events without caring which framework produced them. State events keep the agent, the app, and the user in sync. How those events are displayed is the client's choice, so the surface can be a web app, terminal, mobile app, or even a chat platform like Slack or Teams.The .NET SDK brings that capability to C#. A backend emits those events natively, and a client consumes them from an agent written in any supported language.QuickstartThe SDK works in both directions. AGUI.Server turns an agent into an AG-UI endpoint, and AGUI.Client lets a .NET application consume one. The server and client support is built on a common set of AG-UI primitives.dotnet add package AGUI.ServerYour agent is an IChatClient, the standard chat abstraction from Microsoft.Extensions.AI. Assuming your app defines a CreateChatClient() method that returns a configured IChatClient, register the client and the AG-UI serializer:using AGUI.Abstractions;using AGUI.Server;using Microsoft.AspNetCore.Http.Json;using Microsoft.Extensions.AI;using Microsoft.Extensions.Options;var builder = WebApplication.CreateBuilder(args);builder.Services.AddSingleton(CreateChatClient());builder.Services.Configure(options => options.SerializerOptions.TypeInfoResolverChain.Insert( 0, AGUIJsonUtilities.DefaultTypeInfoResolver));var app = builder.Build();app.MapPost("/", ( RunAgentInput input, IChatClient chatClient, IOptions jsonOptions, CancellationToken cancellationToken) =>{ var context = input.ToChatRequestContext( jsonOptions.Value.SerializerOptions); var events = chatClient .GetStreamingResponseAsync( context.Messages, context.ChatOptions, cancellationToken) .AsAGUIEventStreamAsync(context, cancellationToken); return TypedResults.ServerSentEvents(events);});await app.RunAsync();ToChatRequestContext unpacks the incoming RunAgentInput, the protocol's request payload, into the messages and options your IChatClient expects.AsAGUIEventStreamAsync turns the response stream back into protocol events. It emits RUN_STARTED and RUN_FINISHED around the run, closes open text and reasoning blocks before switching to a different message or tool call, and collapses multiple interrupts into a single terminal RUN_FINISHED.The SDK handles the protocol. The web server is yours, which is why Agent Framework's ASP.NET Core package wraps these same primitives as AddAGUIServer() and MapAGUIServer().In Agent Framework, the same endpoint takes only a few lines. Given an existing IChatClient named chatClient, the following code creates and hosts the agent. Read the full walkthrough on Microsoft Learn for a complete server and client.dotnet add package Microsoft.Agents.AI.Hosting.AGUI.AspNetCore --prereleaseusing Microsoft.Agents.AI;using Microsoft.Agents.AI.Hosting.AGUI.AspNetCore;using Microsoft.Extensions.AI;var builder = WebApplication.CreateBuilder(args);builder.Services.AddAGUIServer();var app = builder.Build();AIAgent agent = chatClient.AsAIAgent( name: "AGUIAssistant", instructions: "You are a helpful assistant.");app.MapAGUIServer("/", agent);await app.RunAsync();AGUI.Client handles the other direction, connecting a .NET application to any AG-UI agent.dotnet add package AGUI.Clientusing AGUI.Client;using var httpClient = new HttpClient();var chatClient = new AGUIChatClient( new(httpClient, "http://localhost:5001"));AGUIChatClient is an IChatClient, so it works anywhere your code already takes an IChatClient. The agent on the other end can be written in Python, TypeScript, or C#, and your code does not change.Once your endpoint speaks AG-UI, any AG-UI client can drive it: a .NET application through AGUI.Client, or a React frontend through CopilotKit. The CopilotKit Interactive Dojo has running examples against a .NET backend.The repository has worked examples for each part of the protocol. There is one client and server pair per step, covering chat, backend and frontend tools, human in the loop, shared state, reasoning, multimodal input, interrupts, parallel tool calls, protobuf, and telemetry.ArchitectureHere is how everything works together. A request arrives from any AG-UI client, the endpoint hands it to your agent in Microsoft Agent Framework or your own agent code, and the response streams back as protocol events while the agent calls your tools and the model.The packagesThe SDK ships as five packages on NuGet: protocol types, wire formatters, protobuf support, an HTTP client, and a framework-agnostic server adapter built on Microsoft.Extensions.AI.PackageWhat it isAGUI.AbstractionsProtocol model: events, messages, tools, capabilities, interrupts, state, and the source-generated serializerAGUI.FormattingWire format abstraction and the default Server-Sent Events implementationAGUI.ProtobufOpt-in protobuf codec generated from the TypeScript .proto definitions. It covers a subset of event types. SSE is the default and carries all of themAGUI.ClientConsumes AG-UIAGUI.ServerProduces AG-UIThe client and server packages pull in the abstractions they need, so most applications reference one of them.What this means for Microsoft Agent FrameworkAgent Framework, our SDK for building AI agents in .NET and Python, used to include its own implementation of the AG-UI protocol. It now depends on the AGUI.* packages from NuGet and keeps the ASP.NET Core integration that turns an agent into an endpoint.The protocol is maintained in the AG-UI C# SDK and stays wire-compatible with the TypeScript and Python SDKs. See the migration notice for full details.For existing Agent Framework users, the programming model is unchanged, though a few APIs were renamed:BeforeNowAddAGUI(), MapAGUI()AddAGUIServer(), MapAGUIServer()Microsoft.Agents.AI.AGUI namespaceAGUI.Client, AGUI.Server, AGUI.AbstractionsAGUIChatClient positional constructorOptions-based constructorReading the originating requestchatOptions.TryGetRunAgentInput(out RunAgentInput? agentInput)The event format is unchanged, so existing frontends keep working against an upgraded backend without changes of their own.Why this mattersAny .NET backend can speak the protocol. A worker service, internal API, or existing line-of-business application can expose an agent over AG-UI on its own. No agent framework is required.One backend can serve many surfaces. The client decides how to render the events, so the same endpoint serves a web app, terminal, mobile client, or chat platform like Slack and Teams.Your existing code remains the same. IChatClient is the only integration point. You can consume AG-UI from .NET Framework 4.7.2 and later, and expose an endpoint from current .NET.Interoperate across languages. The shared wire protocol keeps the C#, TypeScript, and Python SDKs compatible, so a .NET backend can work with clients built using any of them.Get startedThe AG-UI .NET SDK provides one C# implementation of AG-UI, published on NuGet and usable from any .NET service. Agent Framework consumes it, and so can you.AG-UI .NET SDK source and samplesAG-UI documentationCopilotKit's AG-UI .NET SDK postAgent Framework AG-UI documentation on Microsoft LearnMicrosoft Agent Framework migration notesQuestions and feedback about the SDK are welcome in the AG-UI repository. For MAF integration questions, use the Microsoft Agent Framework discussion boards.