Overview
A semantic bridge that lets AI agents read and operate Klyroo forms, dashboards and spreadsheet imports from .NET code.
An agent that drives a UI through CSS selectors breaks whenever the markup changes. Klyroo.Agent skips the markup: you register the controllers behind your UI, and the agent works with their labels, values and named actions. The bridge is plain C# with no JavaScript interop, so it behaves the same in every Blazor render mode, in .NET MAUI and in a console app.
Prerequisites
To use the library in an app:
- The .NET 11 SDK, and an app that targets
net11.0. The packages are prereleases, so everydotnet add packagecommand needs--prerelease. - The controllers you expose:
Klyroo.references theAgent Klyroo.,Form. Core Klyroo.andDashboard. Core Klyroo.packages, so the bridge works with any app that builds aSpreadsheet. Core FormController(or a<TModel> Dynamic), aForm Controller Dashboardor aController Spreadsheet, rendered or not. Register it withImporter <TRow> AddKlyrooAgent(). - An AI host that calls your code: the bridge exposes
snapshot,queryandactas methods and tool definitions; your MCP server, chat endpoint or tool loop calls them. The library does not call a model itself. - For the browser runtime (
klyroo-agent.): a browser with ES modules, the static web assets of the app served (js MapStaticAssetsorUseStaticFiles), and, forregisterWebMcp, a browser that exposes the WebMCPmodelContextAPI, which is still experimental.
To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.) and clones of klyroo-dashboard, klyroo-form and klyroo-spreadsheet in the same parent folder: some projects reference them by relative path (../). See Contributing.
Installation
dotnet add package Klyroo.Agent --prereleaseRegister the bridge in Program. (Blazor) or MauiProgram. (.NET MAUI Blazor Hybrid):
using Klyroo.Agent;
builder.Services.AddKlyrooAgent();Agent is registered as a scoped service. The package has no stylesheet. If you only need the data
types, install Klyroo. instead.
Quick start
Register a form, then let a caller inspect it and change it:
using Klyroo.Agent;
using Klyroo.Form;
var agent = new AgentBridgeService();
var schema = FormSchema.For<Project>(s =>
{
s.FormKey = "project-settings";
s.Title = "Project settings";
s.Field(p => p.Name, f => f.Label("Project name"));
s.Field(p => p.Region, f => f.Options(
[
new FormOption<string>("us-east", "US East"),
new FormOption<string>("eu-west", "Europe West"),
]));
});
var form = new FormController<Project>(schema, new Project());
agent.RegisterForm(form);
foreach (var component in agent.Snapshot())
{
Console.WriteLine($"{component.Ref} {component.Component} \"{component.Label}\" = {component.Value?.ToDisplayString()}");
}
// c1 input "Project name" = Apollo
// c2 select "Region" = us-east
// c3 form "Project settings" = clean
var matches = agent.Query(new AgentQueryRequest { Within = "region", Text = "europe" });
Console.WriteLine(matches[0].Items[0].Value); // eu-west
var result = await agent.ActAsync(
[
new AgentActStep("Project name", "setValue", ["Atlas"]),
new AgentActStep("Region", "setValue", ["eu-west"]),
]);
Console.WriteLine(result.Ok ? "done" : result.Error);
Console.WriteLine(form.Get(schema.Field(p => p.Name))); // Atlas
public sealed class Project
{
public string Name { get; set; } = "Apollo";
public string Region { get; set; } = "us-east";
}In a Blazor component, inject the scoped service instead of creating one, as shown in Getting started.
Documentation
| Getting started | Step-by-step first integration |
| Guides | Task-oriented recipes |
| Concepts | How the library works |
| Platforms | Render modes, .NET MAUI, NativeAOT |
| API reference | Every public type and member |
| FAQ | Troubleshooting and limitations |
Compatibility
- .NET 11 SDK.
Klyroo.declaresAgent. Core IsAotCompatibleandIsTrimmable, so it works in NativeAOT and trimmed apps.Klyroo.declaresAgent IsTrimmableand the supported platformsbrowser,ios,android,maccatalystandwindows. It does not declareIsAotCompatible.Agenthas no dependency on a render mode: it works in Static SSR, Interactive Server, WebAssembly, Auto, .NET MAUI Blazor Hybrid and non-UI hosts.Bridge Service - The browser runtime needs a browser; WebMCP registration is skipped when the browser has no
modelContextAPI.
Contributing
Contributions are welcome. Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct. Report security issues privately as described in SECURITY.md.