Description <p/>Your agent works. Now put it in front of real users.An AI agent doesn't behave like the APIs our screens were built for. It streams its answer as it works, calls tools while the user watches, changes shared data, asks for approval halfway through a task and sometimes fails partway. A spinner and a wall of text won't do. AG-UI, the open Agent-User Interaction protocol, defines how an agent and its user interface talk, and version 1.0 ships with an official .NET SDK.
Agentic UI in .NET shows you how to build both ends of that conversation in C#: the endpoint in ASP.NET Core, and clients in Blazor, .NET MAUI and the console. It uses the official AG-UI .NET SDK, Microsoft.Extensions.AI and standard .NET throughout, with Microsoft Agent Framework as an optional host, and no third-party framework to take on faith.
What you'll buildBeacon, a field-service assistant with one AG-UI backend and two .NET clients: Beacon Desk for dispatchers (Blazor) and Beacon Field for technicians (.NET MAUI). Along the way you'll build:
- A hardened AG-UI endpoint that, at twice its expected load, shows 95 percent of runs their first words within 250 ms
- Blazor components the agent chooses at run time, checked against a server allow-list and rendered as their arguments stream in
- A client reducer, shared by Blazor and .NET MAUI, that turns one event stream into every view
- Human-in-the-loop approval that holds a $1,795 parts order until a dispatcher says yes, enforced on the server, not just in the UI
- A model provider you switch with configuration: a scripted model, Ollama, OpenAI or Azure OpenAI
- A mobile client that survives a dropped connection and reads equipment from a photo
- Production hardening: a threat model and red-team suite, OpenTelemetry tracing, a deterministic test pyramid in CI and an Aspire deployment to Azure Container Apps
Inside the book
- Foundations: why agents need a UI protocol, a stream built by hand, the full AG-UI 1.0 event model, the .NET SDK and the agent behind the endpoint
- .NET Clients: a streaming Blazor chat, a client-side reducer, and .NET MAUI, desktop and console clients
- Interaction Patterns: backend and frontend tools, generative UI, shared and predictive state, approvals, interrupts, visible reasoning and multimodal input
- Composition and Interop: steps and subagents, capabilities and versioning, declarative generative UI, and AG-UI beside MCP and A2A
- Production: sessions and history, security, transports and scale, observability, testing and deployment
- Retrospective: patterns, anti-patterns and the road ahead
Every listing compiles and runs in the companion code: one .NET 11 solution with a checkpoint for each chapter and more than 2,000 tests. You can run it all without an API key.
This book is for you if
- You build with C# and ASP.NET Core, and your front end is Blazor/React or .NET MAUI
- You're putting an agent in front of real users, and the interface has to be safe, fast and testable
- You want to understand the protocol and the platform, not a framework's abstraction over them
It suits senior and mid-level .NET engineers, full-stack developers and architects adding agent-driven interfaces to real products.
About the authorNajaf A. Shaikh is a software architect with more than twenty years of experience building enterprise systems on .NET, including over a decade leading the architecture of wealth-management and financial-advice platforms used across multiple global regions. He is also the author of From Problems to Patterns: Generative AI in .NET and Domain-Driven Design and Event Sourcing in .NET