EntwineAgents.Runtime 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EntwineAgents.Runtime --version 0.1.0
                    
NuGet\Install-Package EntwineAgents.Runtime -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EntwineAgents.Runtime" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EntwineAgents.Runtime" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="EntwineAgents.Runtime" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EntwineAgents.Runtime --version 0.1.0
                    
#r "nuget: EntwineAgents.Runtime, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EntwineAgents.Runtime@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EntwineAgents.Runtime&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=EntwineAgents.Runtime&version=0.1.0
                    
Install as a Cake Tool

EntwineAgents

A lean, composable agent runtime for .NET — the shared substrate for building LLM agents that behave like software components: typed inputs and outputs, prompts managed as data, privacy by construction, and graceful degradation everywhere.

Extracted from a production system where the same agent loop had been hand-rolled fifteen times across three products. The loop lives here once; what varies stays yours.

The idea

An agent = a prompt (loaded by key, host-overridable) + input shaping + typed parsing + graceful degrade, riding a shell that owns the loop.

sealed class TaglineAgent(IAgentChat chat, IPromptSource? prompts = null) : Agent<string, string>(chat, prompts)
{
    protected override string Key => "quickstart.tagline.system";   // hosts can override by key
    protected override string FallbackPrompt =>
        "You write one short, punchy product tagline. Reply with the tagline only.";
    protected override bool Json => false;
    protected override string BuildUser(string product) => $"Product: {product}";
    protected override string Parse(string raw) => raw.Trim();
    protected override string OnFailure => "(the model was unavailable — try again)";
}

Four overrides carry everything that is domain-specific. The shell owns the loop: fetch the prompt by key (falling back to the built-in), run one turn, degrade to a typed failure value if the model or network fails, parse to a typed result. There is also a batched sibling, BatchAgent<TItem, TResult>, for classify-many-items work: chunking, per-batch retry, position-aligned parsing, and per-item degrade.

Run it:

set OPENAI_API_KEY=sk-...        # any OpenAI-compatible endpoint; OPENAI_BASE_URL / OPENAI_MODEL to override
dotnet run --project samples/QuickStart -- "a keyboard for cats"

Packages

Package What it gives you
EntwineAgents.Ai The provider seam: IChatProvider + ChatRequest, OpenAI-compatible and Anthropic-native providers, a routing registry (ChatRequest.ProviderKey), typed options.
EntwineAgents.Runtime The agent shells (Agent<TInput,TResult>, BatchAgent<TItem,TResult>), the ports agents consume (IAgentChat, IPromptSource), JSON un-fencing, and the bridge between the provider and agent seams.
EntwineAgents.Prompts Prompt management: versioned templates, per-client override, cached client→global fallback reads. Persistence is a port (IPromptRepository); post-save behaviour is a port (IPromptSavedHook); HttpPromptSource binds database-free hosts over a prompt-egress endpoint — failing open to built-in fallbacks.
EntwineAgents.Intake Turn messy sources into clean tables: XLSX/CSV/OCR-text reading with tolerant header detection, date normalisation, and PseudonymMap — typed, stable, session-local pseudonymisation so identities never reach a model.
EntwineAgents.Ocr Document OCR behind a port: IDocumentOcr with an Azure Document Intelligence implementation — structured text (paragraphs, tables as markdown, low-confidence word handling) plus per-page spatial data.
EntwineAgents.Tokenisation Tokenisation at rest (pseudonymisation with a separated key, GDPR Art. 4(5)): deterministic cross-run-stable tokens; real values live only as AES-GCM ciphertext in a tenant-scoped key store.

Each package stands alone; take what you need. Runtime depends on Ai; Prompts depends on Runtime; everything else is independent.

Design principles

  • Two seams, bridged once. IChatProvider is the SPI providers implement; IAgentChat is the API agents consume; ChatProviderAgentChat connects them. Your agents never know which model or vendor is behind them.
  • Agents propose; algorithms compute; humans decide. The shells make agent output typed and validated so deterministic code — and people — can act on it. Nothing here auto-persists a model's opinion.
  • Prompts are data. Loaded by key with a compiled fallback, so prompts can be versioned, per-client overridden, and served remotely — and a prompt-service outage can never take an agent down.
  • Fail open, degrade typed. A failed call returns your OnFailure value, not an exception across your pipeline; a batch the model mangles degrades per-item, never by discarding the batch.
  • Privacy by construction. Session-local pseudonyms for what reaches a model; separated-key tokenisation for what reaches a database.

Building

dotnet build entwine-agents.slnx
dotnet test  entwine-agents.slnx

Requires the .NET 10 SDK.

License

Apache-2.0

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EntwineAgents.Runtime:

Package Downloads
EntwineAgents.Prompts

Prompt management for .NET agents: versioned templates, per-client override, cached fallback reads, persistence behind a port, and an HTTP egress source for database-free hosts.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 122 7/15/2026
0.1.1 91 7/15/2026
0.1.0 89 7/15/2026