Last updated: 2026-05-28
Add an agent chat surface and deterministic app actions to a Blazor app.
AgentBlazor gives a Blazor route a chat surface, explicit capabilities, approval-gated actions, and deterministic UI execution without replacing the normal app UI.
Try the hosted demo:
dotnet add package AgentBlazorUse 0.2.5 or later. This release includes the CLI Windows MSBuild fallback and first-run API-key prompt, CLI v1 analyze package refresh, mobile chat input stability fix, corrected EF package shape, and tool-friendly schemas for DateOnly, TimeOnly, DateTime, DateTimeOffset, and Guid workflow parameters.
The CLI is optional. Keep it out of the critical path unless you want scaffold help for an existing app.
AgentBlazor builds on the Microsoft Agent Framework packages rather than a custom agent runtime. The core package currently depends on four GA packages: Microsoft.Agents.AI, Microsoft.Agents.AI.Abstractions, Microsoft.Agents.AI.OpenAI, and Microsoft.Agents.AI.Workflows.
Two hosting packages are still preview dependencies: Microsoft.Agents.AI.Hosting and Microsoft.Agents.AI.Hosting.AGUI.AspNetCore. AgentBlazor keeps those behind its own registration and endpoint surface so app code does not need to bind directly to the preview hosting APIs for normal setup. Expect preview-version churn around hosted AG-UI transport before 1.0; the component/capability model is the stable surface this package is trying to protect.
Register the runtime in Program.cs:
using AgentBlazor;
using MudBlazor.Services;
builder.Services.AddMudServices();
builder.Services.AddAgentBlazor(options =>
{
options.UseOpenAI(
apiKey: builder.Configuration["OpenAI:ApiKey"]!,
model: builder.Configuration["OpenAI:Model"]!);
// Optional: pin provider-level ChatOptions. E.g. GPT-5.6-family models reject
// function tools with HTTP 400 (reasoning_effort) unless effort is pinned to none:
// options.ConfigureChatOptions(o => o.Reasoning = new ReasoningOptions { Effort = ReasoningEffort.None });
options.ConfigureBuilder(agentBuilder =>
{
agentBuilder.AddWorkflow<SupportInboxCapabilities>("support-inbox", agent =>
{
agent.WithRoutePrefixes("/support");
});
});
});
var app = builder.Build();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.MapAgentBlazorEndpoints();Add one capability class:
[AgentCapability("support_inbox")]
public sealed class SupportInboxCapabilities
{
[AgentAction("Draft a reply for the highlighted tickets", RequiresApproval = true)]
public Task<CapabilityResult> DraftReplyAsync(string[] ticketIds)
{
return Task.FromResult(
CapabilityResult.Success("Prepared the reply draft.")
.WithWarning("One ticket still needs escalation evidence.")
.WithNextActions("Review the reply", "Approve the reply draft"));
}
}Render one chat surface:
@using AgentBlazor.Components
<AgentChatWidget
Title="Support inbox"
Placeholder="Show open tickets, explain the queue, or draft a reply..."
Width="30rem"
Height="68vh" />- Home quickstart:
/ - Docs:
/docs - Live demo:
/demo - Hosted demo: https://demo.agentblazor.com/demo/workflows/support-inbox
- Starter sample:
samples/AgentBlazor.Starter - Starter sample route:
/ops-review
Run the starter sample:
dotnet run --project samples/AgentBlazor.Starter/AgentBlazor.Starter.csproj- Quickstart
- CLI v1 announcement
- 0.2.23-internal.1 release notes (private/internal build)
- 0.2.18 release notes
- 0.2.17 release notes
- 0.2.16 release notes
- 0.2.15 release notes
- 0.2.14 release notes
- 0.2.13 release notes
- 0.2.12 release notes
- 0.2.11 release notes
- 0.2.10 release notes
- 0.2.9 release notes
- 0.2.8 release notes
- 0.2.7 release notes
- 0.2.6 release notes
- 0.2.5 release notes
- 0.2.3 release notes
- 0.2.2 release notes
- 0.2.1 release notes
- 0.2.0 release notes
- Recoverable capability errors
- Entity Framework Core schema exposure
- Beta testing
- Starter sample
- Advanced CLI
If your app uses EF Core, install AgentBlazor.EntityFrameworkCore to expose selected entity shapes as planning context:
dotnet add package AgentBlazor.EntityFrameworkCoreThis is schema-only. It helps an agent understand safe entity fields, but it does not execute queries, generate LINQ or SQL, scan every DbSet, or grant write access. Data access still goes through your typed [AgentAction] methods.
If you are doing a first-pass install review, use the narrow beta path:
- install the package
- wire one support route
- submit one prompt
- report the first point of friction
Start here: