Skip to content

Add a first-party .NET client (proposal)#206

Draft
joshmouch wants to merge 1 commit into
microsoft:mainfrom
joshmouch:pr/dotnet-client
Draft

Add a first-party .NET client (proposal)#206
joshmouch wants to merge 1 commit into
microsoft:mainfrom
joshmouch:pr/dotnet-client

Conversation

@joshmouch

@joshmouch joshmouch commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

A complete .NET / NuGet client for AHP 0.3.0, at full cross-language parity with the Rust / Kotlin / Swift / TypeScript / Go clients — including the annotations channel (#195).

Opening as a draft: a 6th first-party client is a maintenance + ownership commitment only you can sign off on, so I'd love a scope decision before you spend review time. I'm happy to keep it updated as the protocol evolves.

What's here

  • Microsoft.AgentHostProtocol.Abstractions (generated wire types + transport/serializer interfaces), Microsoft.AgentHostProtocol (reducers + AhpClient + MultiHostClient), Microsoft.AgentHostProtocol.WebSockets.
  • Codegen-derived from the TS protocol via a new scripts/generate-csharp.ts (wired into generate.ts + the CI generated-source-freshness check) — a protocol change is one regen, not N hand-edits.
  • 356 tests on net8.0, driving the shared cross-language reducer + round-trip fixtures (same vectors as the other clients), incl. the full annotations channel.

Design notes

  • Unknown union discriminants must round-trip verbatim, so the client hand-factors a union converter rather than using [JsonPolymorphic] (which drops unknown variants).
  • It favors a single JsonNamingPolicy + records over per-property attributes for concision.

Notes for review

  • Publishing: the package IDs are Microsoft.AgentHostProtocol.* (yours). I'll wire the pack-and-publish workflow to match your TS/Kotlin lane, leaving the signing key on your side. (Ownership and publishing are the scope questions in A .NET client for AHP #214.)
  • Shared fixtures: this branch bundles the round-trip fixtures so it builds standalone; they're byte-identical to Add a shared round-trip corpus + fix the wire-fidelity bugs it caught (SessionStatus bitset, changeset range, origin) #204 (now merged), so they deduplicate cleanly against main. This PR's unique change is clients/dotnet/ + the codegen / CI / release wiring.
  • No per-client gate infra: the earlier .NET-only test-parity gate is gone — the suite is data-driven off the shared fixtures, same as the other clients.

The scope decision lives in #214: if you want a first-party .NET client, I'll own it, maintain it, and wire the publishing under Microsoft.AgentHostProtocol.*.

@joshmouch joshmouch force-pushed the pr/dotnet-client branch 6 times, most recently from b72eeed to ca6e1a3 Compare June 10, 2026 14:07
@joshmouch joshmouch force-pushed the pr/dotnet-client branch 4 times, most recently from ef382ab to 5cc1e43 Compare June 16, 2026 08:13
@joshmouch joshmouch force-pushed the pr/dotnet-client branch 9 times, most recently from 3c206df to 422ff6b Compare June 18, 2026 04:29
@joshmouch joshmouch force-pushed the pr/dotnet-client branch 3 times, most recently from 790ae4d to 3b49289 Compare June 20, 2026 13:16
First-party .NET client for the Agent Host Protocol: a hand-written JSON-RPC
client + multi-host runtime over a pluggable ITransport (WebSocket transport
included), generated wire types, and DI integration.

Includes OpenTelemetry-native self-instrumentation (a single ActivitySource +
Meter named from the generated AhpTelemetryNames holder), the host-* dropped-
event stream values from the shared telemetry contract, reconnect-supervisor
metrics, an OtelExport example, and recorder-based telemetry tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant