Last updated: 2026-09-19
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.
This is a private, independently maintained fork of AgentBlazor by Aris Nguyen.
Credits & origin. The original AgentBlazor project was created by Ash Peterson (upstream repository). Ash Peterson retains copyright over the original work, which remains MIT-licensed. See LICENSE for the dual copyright notice and DIVERGENCE.md for the history of this fork's changes. Upstream changes are pulled in on demand only; this fork no longer tracks upstream on a fixed schedule.
This fork ships packages to a private NuGet feed rather than the public nuget.org gallery. Register the feed, then install:
# Register the private feed source (local path or URL), then:
dotnet add package AgentBlazor --source agentblazor-localUse 0.2.27-internal.1 or later. Fork builds carry an -internal.N suffix so they never collide with upstream public versions. For local-feed setup and the per-version folder layout, see Private feed publishing.
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 - 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.25-internal.4 release notes (private/internal build)
- 0.2.25-internal.2 release notes (private/internal build)
- 0.2.24-internal.1 release notes (private/internal build)
- 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 (from the same private feed) to expose selected entity shapes as planning context:
dotnet add package AgentBlazor.EntityFrameworkCore --source agentblazor-localThis 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: