Microsoft has introduced experimental Blazor AI components that turn streamed AI-agent interactions into observable state and renderable content blocks. Available through the prerelease Microsoft.AspNetCore.Components.AI package for the .NET 11 RC1 SDK, the components are designed to place agent output, tool activity and user decisions inside conventional Razor interfaces rather than confining them to an opaque chat window.
From Agent Streams to Razor Components
The package centers on UIAgent, which wraps an IChatClient from Microsoft.Extensions.AI and maps streaming ChatResponseUpdate values into ContentBlock objects. Those blocks carry identity, role, lifecycle state and change notifications, allowing Blazor components to update as output arrives. Developers can start with ChatPage, which includes messages, input, streaming status and retry behavior, or assemble custom layouts from lower-level components such as AgentBoundary, MessageList, MessageInput and BlockRenderer<TBlock>.
Typed Tools and Remote Agents
Tool calls can become application-specific UI instead of raw conversational text. Source-generated FunctionInvocationContentBlock types expose arguments and results in a typed form, while BlockRenderer<TBlock> selects the Razor presentation. The same model covers server-side tools and frontend tools that perform application-owned work, including navigation, dialogs or local interface changes.
For remote agents, the components can use AGUIChatClient from the stable AG-UI .NET SDK. AG-UI standardizes event exchange between agents and user-facing applications but does not prescribe their visual presentation. Microsoft's AgenticUI sample combines a Blazor Web App, an ASP.NET Core agent server, Microsoft Agent Framework, Microsoft Foundry and Aspire, with events transported over HTTP and Server-Sent Events.
Approval and Shared State
The architecture gives applications explicit control over consequential operations. An agent can request a tool action, but a FunctionApprovalBlock can pause execution until the user approves or rejects it. Applications can also expose cancellation while a response is streaming.
UIAgent<TState> extends the approach beyond message lists by exposing typed application state that users, agents and ordinary components can edit. Predictive state keeps an agent's proposed revision separate from committed data, enabling a UI to show a comparison and require acceptance before replacing the user's current document.
Preview Limitations
The included MessageInput is currently text-focused. Applications may send images, files, audio or other Microsoft.Extensions.AI content through a custom input component, but capture, transcription and model-specific media processing remain the application's responsibility. The package also leaves structured text parsing choices to developers rather than selecting a Markdown parser.
AI-generated editorial illustration; not a documentary photograph.
Source: Build Agentic UI with the new Blazor AI components

Leave a Reply