{"id":49564390,"url":"https://github.com/23min/a2ui-blazor","last_synced_at":"2026-05-03T11:03:43.179Z","repository":{"id":337342277,"uuid":"1152770539","full_name":"23min/a2ui-blazor","owner":"23min","description":".NET/Blazor implementation of the A2UI (Agent‑to‑UI) protocol: agents send declarative JSON component trees; the client renders approved widgets. Works with any A2UI backend. Supports Blazor WASM + Server; includes component catalog, data binding, streaming, and samples.","archived":false,"fork":false,"pushed_at":"2026-02-09T02:05:28.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-09T08:10:53.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/23min.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-08T12:08:48.000Z","updated_at":"2026-02-09T02:05:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/23min/a2ui-blazor","commit_stats":null,"previous_names":["23min/a2ui-blazor"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/23min/a2ui-blazor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23min%2Fa2ui-blazor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23min%2Fa2ui-blazor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23min%2Fa2ui-blazor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23min%2Fa2ui-blazor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/23min","download_url":"https://codeload.github.com/23min/a2ui-blazor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23min%2Fa2ui-blazor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32566450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-03T11:03:40.317Z","updated_at":"2026-05-03T11:03:43.173Z","avatar_url":"https://github.com/23min.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A2UI Blazor\n\nA .NET implementation of Google's [A2UI (Agent-to-UI)](https://a2ui.org/) protocol for Blazor.\n\nAgents describe UIs as declarative JSON. A2UI Blazor renders them as native Blazor components — in WebAssembly or Server mode — against any A2UI-compliant backend, in any language.\n\n## Why This Exists\n\nGoogle's A2UI protocol lets AI agents generate rich, interactive UIs without sending executable code. The agent sends a component tree; the client renders it with trusted, pre-approved widgets.\n\nOfficial renderers exist for [Lit](https://github.com/google/A2UI), [Angular](https://github.com/google/A2UI), and [Flutter](https://docs.flutter.dev/ai/genui). Enterprise .NET teams building agentic applications had no first-class option — until now.\n\n**A2UI Blazor brings A2UI to the .NET ecosystem.** Same protocol, same security model, native Blazor components.\n\n## What's In This Repo\n\n### Libraries (the deliverables)\n\n| Package | Description |\n|---------|-------------|\n| **`A2UI.Blazor`** | Core renderer library. Install this in any Blazor app to render A2UI surfaces. Parses JSONL/SSE streams, manages surface state, resolves data bindings, renders 16 standard components. |\n| **`A2UI.Blazor.Server`** | Optional server-side helpers for .NET backends. Fluent builders, stream writer, ASP.NET Core middleware. Not required — the client works with any A2UI server. |\n\n### Samples\n\n| Sample | Purpose |\n|--------|---------|\n| **`samples/dotnet-server/`** | .NET Minimal API serving A2UI streams using `A2UI.Blazor.Server` |\n| **`samples/python-server/`** | Python FastAPI server (~50 lines) proving protocol agnosticism |\n| **`samples/blazor-wasm-spa/`** | Standalone Blazor WebAssembly SPA consuming A2UI |\n| **`samples/blazor-server-app/`** | Blazor Server app — same library, server-side rendering |\n\n\u003e The Blazor SPA renders identically whether pointed at the Python server or the .NET server. That's the point.\n\n## Standard Component Catalog\n\n| Category | Components |\n|----------|-----------|\n| Display | Text, Image, Icon, Divider |\n| Layout | Row, Column, Card, List, Tabs |\n| Input | Button, TextField, CheckBox, ChoicePicker, DateTimeInput, Slider |\n| Media | Video, AudioPlayer |\n\nCustom components can be registered at startup:\n\n```csharp\nbuilder.Services.AddA2UIBlazor(registry =\u003e\n{\n    registry.Register(\"MyWidget\", typeof(MyCustomWidget));\n});\n```\n\n## Getting Started\n\n### Prerequisites\n\n- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)\n- [uv](https://docs.astral.sh/uv/) + Python 3.10+ (only for the Python server sample)\n\n### Build\n\n```bash\ngit clone https://github.com/23min/a2ui-blazor.git\ncd a2ui-blazor\ndotnet build\n```\n\n### Run the Samples\n\n**Option A: .NET server + Blazor WASM SPA** (two terminals)\n\n```bash\n# Terminal 1 — .NET A2UI server on port 5050\ndotnet run --project samples/dotnet-server\n\n# Terminal 2 — Blazor WASM SPA (dev server)\ndotnet run --project samples/blazor-wasm-spa\n```\n\n**Option B: Python server + Blazor WASM SPA** (two terminals)\n\n```bash\n# Terminal 1 — Python A2UI server on port 8000\ncd samples/python-server\nuv run uvicorn server:app --port 8000\n\n# Terminal 2 — update the SPA to point at the Python server\n# Edit samples/blazor-wasm-spa/wwwroot/appsettings.json:\n#   \"A2UIServerUrl\": \"http://localhost:8000\"\ndotnet run --project samples/blazor-wasm-spa\n```\n\n**Option C: Blazor Server app** (enterprise SSR model)\n\n```bash\n# Start the .NET A2UI server, then:\ndotnet run --project samples/blazor-server-app\n# Open http://localhost:5100\n```\n\n\u003e All three Blazor clients render the same A2UI surfaces.\n\u003e The Python and .NET servers serve the same agents.\n\u003e Mix and match freely.\n\n### Use A2UI.Blazor in Your Own App\n\n**1. Add the package:**\n\n```bash\ndotnet add package A2UI.Blazor\n```\n\n**2. Register services in `Program.cs`:**\n\n```csharp\nbuilder.Services.AddA2UIBlazor();\n```\n\n**3. Add the CSS to your `index.html` (WASM) or `_Host.cshtml` (Server):**\n\n```html\n\u003clink href=\"_content/A2UI.Blazor/a2ui.css\" rel=\"stylesheet\" /\u003e\n```\n\n**4. Render a surface in any page or component:**\n\n```razor\n@using A2UI.Blazor.Components\n\n\u003cA2UISurface SurfaceId=\"my-surface\" OnAction=\"HandleAction\" /\u003e\n```\n\n**5. Connect to any A2UI endpoint and stream messages:**\n\n```csharp\n// In your page's OnInitializedAsync:\nvar response = await Http.SendAsync(\n    new HttpRequestMessage(HttpMethod.Get, \"https://my-agent/stream\"),\n    HttpCompletionOption.ResponseHeadersRead);\n\nvar stream = await response.Content.ReadAsStreamAsync();\nawait foreach (var message in streamReader.ReadMessagesAsync(stream))\n{\n    dispatcher.Dispatch(message);\n}\n```\n\nThe `SurfaceManager` updates automatically. The `\u003cA2UISurface\u003e` component re-renders.\n\n### Build an A2UI Server in .NET\n\n```csharp\n// Program.cs\nbuilder.Services.AddA2UIServer();\nbuilder.Services.AddA2UIAgent\u003cMyAgent\u003e();\n\napp.UseA2UIAgents();\n```\n\n```csharp\n// MyAgent.cs\npublic class MyAgent : IA2UIAgent\n{\n    public string Route =\u003e \"/agents/my-agent\";\n\n    public async Task HandleAsync(A2UIStreamWriter writer, CancellationToken ct)\n    {\n        await writer.WriteCreateSurfaceAsync(\"main\");\n\n        var components = new List\u003cDictionary\u003cstring, object\u003e\u003e\n        {\n            new ComponentBuilder(\"root\", \"Column\")\n                .Children(\"greeting\")\n                .Build(),\n            new ComponentBuilder(\"greeting\", \"Text\")\n                .Text(\"Hello from A2UI!\")\n                .UsageHint(\"h1\")\n                .Build()\n        };\n\n        await writer.WriteUpdateComponentsAsync(\"main\", components);\n    }\n\n    public Task HandleActionAsync(A2UIStreamWriter writer,\n        UserActionRequest action, CancellationToken ct)\n        =\u003e Task.CompletedTask;\n}\n```\n\n## Architecture\n\n```\n  Agent (Python, .NET, any language)\n    │\n    │  A2UI JSONL/SSE stream over HTTP\n    ▼\n  ┌─────────────────────────────────────┐\n  │           A2UI.Blazor               │\n  │                                     │\n  │  JsonlStreamReader → MessageDispatcher → SurfaceManager\n  │                                              │\n  │  ComponentRegistry ◄─── DataBindingResolver  │\n  │       │                                      │\n  │  ┌────▼──────────────────────────────────┐   │\n  │  │    Blazor Component Catalog           │   │\n  │  │    Text │ Button │ Card │ List │ ...  │   │\n  │  └───────────────────────────────────────┘   │\n  └─────────────────────────────────────────┘\n```\n\n**A2UI.Blazor** is the client library. It:\n1. Reads a JSONL/SSE stream from any HTTP endpoint\n2. Dispatches messages by type (`createSurface`, `updateComponents`, `updateDataModel`, `deleteSurface`)\n3. Maintains surface state (components + data model)\n4. Resolves data bindings via JSON Pointer (RFC 6901)\n5. Renders components through Blazor's `DynamicComponent`\n\n**A2UI.Blazor.Server** is an optional companion for .NET backends. Fluent builders and ASP.NET Core middleware for producing A2UI streams.\n\n## Protocol Compliance\n\nTargets [A2UI specification v0.9](https://github.com/google/A2UI/blob/main/specification/0.9/docs/a2ui_protocol.md).\n\n| Message Type | Direction | Supported |\n|-------------|-----------|-----------|\n| `createSurface` | Server → Client | Yes |\n| `updateComponents` | Server → Client | Yes |\n| `updateDataModel` | Server → Client | Yes |\n| `deleteSurface` | Server → Client | Yes |\n| `action` | Client → Server | Yes |\n\n## Technology Stack\n\n- **.NET 10** (current LTS)\n- **Blazor** (WebAssembly and Server)\n- **System.Text.Json** (zero third-party dependencies in the core library)\n- **ASP.NET Core** (server library only)\n\n## Project Structure\n\n```\nsrc/\n  A2UI.Blazor/                   # Core renderer library (NuGet deliverable)\n  A2UI.Blazor.Server/            # Server helpers for .NET (NuGet deliverable)\n\nsamples/\n  python-server/                 # Python FastAPI A2UI server\n  dotnet-server/                 # .NET Minimal API A2UI server\n  blazor-wasm-spa/               # Standalone Blazor WebAssembly SPA\n  blazor-server-app/             # Blazor Server app (enterprise SSR)\n\ntests/\n  A2UI.Blazor.Tests/             # bUnit component tests (273 tests)\n  A2UI.Blazor.Playwright/        # Playwright E2E browser tests (46 tests)\n```\n\n## Project Status\n\nUnder active development. Core renderer and server libraries are functional with all 17 standard components, accessibility (WCAG 2.1 AA), dark mode, local actions, optimistic updates, and validation error rendering. Four samples demonstrate the full matrix of server (Python, .NET) and client (WASM, Server) combinations. See the [Roadmap](ROADMAP.md) and [Changelog](CHANGELOG.md) for details.\n\n## Documentation\n\n- [Changelog](CHANGELOG.md) — release notes for every version\n- [Roadmap](ROADMAP.md) — planned milestones and progress\n- [Specification Compliance](SPECIFICATION.md) — A2UI v0.9 protocol coverage\n\n## References\n\n- [A2UI Official Site](https://a2ui.org/)\n- [A2UI Protocol Specification (v0.9)](https://github.com/google/A2UI/blob/main/specification/0.9/docs/a2ui_protocol.md)\n- [A2UI GitHub Repository](https://github.com/google/A2UI)\n- [A2UI Renderer Development Guide](https://a2ui.org/renderers/)\n- [A2UI Agent Development Guide](https://a2ui.org/guides/agent-development/)\n- [Google Developers Blog — Introducing A2UI](https://developers.googleblog.com/introducing-a2ui-an-open-project-for-agent-driven-interfaces/)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F23min%2Fa2ui-blazor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F23min%2Fa2ui-blazor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F23min%2Fa2ui-blazor/lists"}