AnointedAutomation.Concepts.Anthropic
1.1.0
dotnet add package AnointedAutomation.Concepts.Anthropic --version 1.1.0
NuGet\Install-Package AnointedAutomation.Concepts.Anthropic -Version 1.1.0
<PackageReference Include="AnointedAutomation.Concepts.Anthropic" Version="1.1.0" />
<PackageVersion Include="AnointedAutomation.Concepts.Anthropic" Version="1.1.0" />
<PackageReference Include="AnointedAutomation.Concepts.Anthropic" />
paket add AnointedAutomation.Concepts.Anthropic --version 1.1.0
#r "nuget: AnointedAutomation.Concepts.Anthropic, 1.1.0"
#:package AnointedAutomation.Concepts.Anthropic@1.1.0
#addin nuget:?package=AnointedAutomation.Concepts.Anthropic&version=1.1.0
#tool nuget:?package=AnointedAutomation.Concepts.Anthropic&version=1.1.0
AnointedAutomation.Concepts.Anthropic
Jesus is King ✝️
An optional adapter for AnointedAutomation.Concepts:
it implements the core ILanguageModel port with Claude through the official
Anthropic .NET SDK (13.8.0). The core package has no AI SDK and never
references this one; install this package only when the language engine should talk to Claude.
Install
dotnet add package AnointedAutomation.Concepts.Anthropic
Configure
Every setting is required. There are no defaults and no fallback model: a missing value throws
AnthropicConfigurationException at startup. Keep the API key in user secrets, environment variables or a secret
store, never in source control. The key is never logged.
{
"Anthropic": {
"ApiKey": "<from your secret store>",
"Model": "claude-opus-5-5",
"MaxTokens": 16000,
"TimeoutSeconds": 120,
"MaxAttempts": 3,
"RetryBaseDelayMilliseconds": 1000
}
}
using AnointedAutomation.Concepts.Anthropic;
builder.Services.AddAnthropicLanguageModel(builder.Configuration.GetSection("Anthropic"));
// ILanguageModel now resolves to AnthropicLanguageModel over the named HttpClient
// AnthropicServiceCollectionExtensions.HttpClientName (add proxies or handlers there).
Build a HybridReasoner
The deterministic CanonReasoner answers first. Only when it returns Unknown does the LanguageReasoner ask Claude,
once per owner, query and model; the answer is kept in the owner's private InterpretationLedger (which also caches
by prompt and model, so this adapter does not cache).
using AnointedAutomation.Concepts.Reasoning;
using AnointedAutomation.Concepts.Reasoning.Hybrid;
using AnointedAutomation.Concepts.Reasoning.Language;
ILanguageModel claude = services.GetRequiredService<ILanguageModel>();
LanguageReasoner language = new LanguageReasoner(claude, new InterpretationParser(parserLogger), TimeProvider.System);
InterpretationLedger ledger = new InterpretationLedger(new InMemoryInterpretationStore(), ownerOnlyPolicy, TimeProvider.System);
HybridReasoner reasoner = new HybridReasoner(new CanonReasoner(TimeProvider.System), language, ledger, new OwnerScope("chat-123"));
Answer answer = await reasoner.Ask(query, cancellationToken);
Language answers are always Unverified and private to the owner's chat. Only the owner can promote an AI
interpretation into a permanent fact: InterpretationLedger.Promote asks the injected IPromotionPolicy, and your
policy must allow only the owner's Reviewer (there is no default policy).
How a call works
- One Messages API request per question. The core prompt asks for every field at once, and the reply is constrained
with structured outputs (
output_config.format, a JSON schema built fromPromptComposer.ReplySchema). The coreInterpretationParserstill validates every reply and throwsInterpretationRejectedfor anything malformed. - 429, 408, 5xx, overload, network errors and timeouts are retried with exponential backoff (starting at
RetryBaseDelayMilliseconds, capped at 30 seconds) for at mostMaxAttemptscalls in total, then raised asAnthropicTransientException. ARetry-Afterheader on any retried response (429, 408, overloaded, 5xx) wins over the local backoff (still capped). The SDK's own retries are off so there is one bounded policy. - 401 and 403 raise
AnthropicConfigurationExceptionimmediately and are logged at Critical. - Other API errors (for example 400) are logged at Error with the request id and rethrown as the SDK exception.
- Cancellation is rethrown quietly and never retried.
License
MIT. Copyright © Anointed Automation Corporation. Stewarded by Alexander Fields.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AnointedAutomation.Concepts (>= 2.4.0)
- Anthropic (>= 13.8.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.15)
- Microsoft.Extensions.Http (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.