.NET
The Adjudon .NET SDK is the integration path for ASP.NET Core
backends and Microsoft-shop deployments — the dominant
stack at large insurers and the public-sector tenants that
shape Adjudon's Frankfurt eu-central-1 footprint. The package
targets .NET 8 and .NET 9 and ships as Adjudon on NuGet,
with a Adjudon.AspNetCore companion that registers the client
into the dependency-injection container and a Adjudon.HostedService
extension for background workers. Runtime dependencies are
limited to System.Text.Json and HttpClient; no Newtonsoft,
no RestSharp, no transitive surprises in a regulated build.
The .NET SDK is on the published roadmap with a NuGet release
target of Q3 2026. Until then, .NET integrations call the
Traces API directly with HttpClient
System.Text.Json; the wire contract is identical and a hand-rolled client ports cleanly to the SDK once it ships. This page documents the SDK shape as it will land.
Install
dotnet add package Adjudon
dotnet add package Adjudon.AspNetCore
<PackageReference Include="Adjudon" Version="0.1.0" />
<PackageReference Include="Adjudon.AspNetCore" Version="0.1.0" />
First call
using Adjudon;
var adjudon = new AdjudonClient(new AdjudonOptions {
ApiKey = Environment.GetEnvironmentVariable("ADJUDON_API_KEY")!, // adj_agent_<48-hex>
AgentId = "customer-support-bot"
});
var trace = await adjudon.TraceAsync(new TraceRequest {
InputContext = new { prompt = "Can I get a refund for order #1234?" },
OutputDecision = new { action = "initiate_refund", confidence = 0.91 }
});
if (trace.Status == TraceStatus.Blocked)
{
return Results.StatusCode(403);
}
// Program.cs
builder.Services.AddAdjudon(opts => {
opts.ApiKey = builder.Configuration["Adjudon:ApiKey"]!;
opts.AgentId = "customer-support-bot";
});
// RefundEndpoint.cs
public static async Task<IResult> Refund(
RefundRequest req,
IAdjudonClient adjudon)
{
var trace = await adjudon.TraceAsync(new TraceRequest {
InputContext = req.ToInputContext(),
OutputDecision = new { action = "initiate_refund", amount = req.Amount }
});
return trace.Status switch {
TraceStatus.Blocked => Results.StatusCode(403),
TraceStatus.Flagged => Results.Accepted(value: trace),
_ => Results.Ok(trace)
};
}
AddAdjudon() registers IAdjudonClient as a singleton, configures
the underlying HttpClient via IHttpClientFactory (so a Polly
policy or mTLS handler can be layered), and wires the standard
configuration binding from appsettings.json.
Versions
| Runtime | Supported |
|---|---|
| .NET 8 LTS | ✓ (minimum) |
| .NET 9 | ✓ (current) |
| ASP.NET Core 8 / 9 | ✓ |
| .NET 6 / 7 | — (out of upstream support) |
| .NET Framework 4.x | — (use the HTTP API directly) |
Configuration
{
"Adjudon": {
"ApiKey": "${ADJUDON_API_KEY}",
"AgentId": "customer-support-bot",
"FailMode": "Open",
"Timeout": "00:00:10",
"MaxRetries": 3
}
}
| Field | Default | Description |
|---|---|---|
ApiKey | (required) | adj_agent_<48-hex> |
AgentId | (required) | Stable agent identifier |
BaseUrl | https://api.adjudon.com | Override for self-hosted Adjudon |
FailMode | Open | Open returns Passthrough on failure; Closed raises |
Timeout | TimeSpan.FromSeconds(10) | HTTP timeout |
MaxRetries | 3 | Retry attempts on 429 / 5xx |
The .NET configuration system binds Adjudon:* from
appsettings.json, environment variables (with __ separator),
Azure Key Vault, or any IConfigurationProvider — the SDK
does not care which.
Idempotency
adjudon.TraceAsync(req, idempotencyKey) accepts a string. If
omitted, the SDK generates a Guid per call. Duplicate keys
within the 24-hour window
return the cached response, so retry storms during a transient
network hiccup never inflate the org's metered trace count.
Errors
| Exception | Cause |
|---|---|
AdjudonAuthException | Invalid API key; never retried |
AdjudonRateLimitException | Retries exhausted on 429 (only when FailMode = Closed) |
AdjudonTimeoutException | Retries exhausted on timeout (only when FailMode = Closed) |
AdjudonBlockedException | Policy returned block; always propagated as a compliance signal |
AdjudonConfigException | Options invalid at registration |
FailMode = Open returns TraceResponse.Passthrough() for every
exception except AdjudonBlockedException and
AdjudonAuthException — the first is a compliance signal you
must not swallow, the second is a configuration bug.
Native AOT & trimming
The package targets .NET 8's Native AOT compilation path: every
public type is annotated with DynamicallyAccessedMembers where
the JSON serialiser needs reflection, and the source generators
in System.Text.Json produce trim-safe contexts at build time.
A PublishAot=true ASP.NET Core deployment links the Adjudon
SDK without trim warnings; the resulting single-file binary
runs on Azure Container Apps and AWS Lambda with cold-start
times measured in milliseconds.
Resources
- Quickstart — first trace in 60 seconds
- Authentication — API key formats and rotation
- Traces API — the underlying HTTP surface this SDK calls (use this directly until the NuGet release lands)
- Error Codes — HTTP-level errors this SDK raises
- GitHub:
github.com/adjudon/adjudon-dotnet(target repository for source, issues, and releases when the SDK ships)