Standard.Agents
1.5.0
See the version list below for details.
dotnet add package Standard.Agents --version 1.5.0
NuGet\Install-Package Standard.Agents -Version 1.5.0
<PackageReference Include="Standard.Agents" Version="1.5.0" />
<PackageVersion Include="Standard.Agents" Version="1.5.0" />
<PackageReference Include="Standard.Agents" />
paket add Standard.Agents --version 1.5.0
#r "nuget: Standard.Agents, 1.5.0"
#:package Standard.Agents@1.5.0
#addin nuget:?package=Standard.Agents&version=1.5.0
#tool nuget:?package=Standard.Agents&version=1.5.0

The Standard AI Agent Framework
Agent = Orchestration(Data, Decision, Direction)
The C# reference implementation of The Standard for Agents.
The mark is the thing itself: three arcs — Data, Decision, Direction — orbiting a single core. One brain at the center, the three natures turning around it.
- Data — what the agent has (skills, memory, knowledge) · verb: Recall
- Decision — what the agent thinks (one brain, wrapped in a Gate and a Judge) · verb: Think
- Direction — what the agent does (act internally, act externally, or return) · verb: Act
Orchestration is not a fourth nature. It is the composition operator — the loop.
Built for everyone who ships agents: the individual who wants the simplest thing that works, the small team that needs it reliable, and the enterprise that needs it accountable — the same agent grows all the way up, never a rewrite.
Watch
Install
dotnet add package Standard.Agents
One agent, three sizes
The Tri-Nature is the whole model at every size. An agent is always Data · Decision · Direction turning in a loop — so a ten-second one-liner and a bank's compliance agent are the same shape. You never learn a second framework to scale up: you add capability, one opt-in line at a time, to natures that are already there. Enterprise isn't harder — it's the same agent with more power and more detail.
Simple — an individual, one line, ten seconds
You have a brain (a URL, a key, a model). That is a working agent.
var agent = new StandardAgent(apiUrl: "https://api.peerllm.com/v1/", apiKey: key, model: "LLooMA2.0");
string answer = await agent.ProcessPromptAsync("What is 47 * 89?");
No skills, no tools, no guardians — all opt-in. Nothing to configure. It is already talking.
Medium — a small team, reliable, a handful of lines
A startup that needs something that works: a persona, the ability to act, a conscience on the way in and out, and a memory that survives restarts. Same builder, a few more lines.
var agent = new StandardAgent(url, key, "LLooMA2.0") // your brain
.Skills("Skills") // who it is — Markdown, not code
.Tool(new CalculatorTool()) // what it can *do*
.Gate(apiUrl: url, apiKey: key, model: "LLooMA2.0") // screen the request (Decision)
.Judge(apiUrl: url, apiKey: key, model: "LLooMA2.0") // review the answer (Decision)
.Memory("memory.txt"); // remember across runs (Data)
Enterprise — a regulated deployment, more power, same shape
A 20-year professional shipping into a bank. Every line above is still here — you added, you did not rewrite. What's new is power: data that never leaves in the clear, a person between the agent and anything irreversible, effects that cannot happen twice, and an audit trail a regulator can read.
using Standard.Agents.Models.Loggings; // TraceVerbosity
var agent = new StandardAgent(url, key, "LLooMA2.0")
.Skills("Skills")
.Tool(new WireTransferTool())
.Gate(apiUrl: url, apiKey: key, model: "LLooMA2.0")
.Judge(apiUrl: url, apiKey: key, model: "LLooMA2.0")
.Memory("memory.txt")
.Constitution("Constitution/ethics.md") // one law above both guardians
.Redact() // PII tokenized before the brain, restored after
.LogTo("log.txt", TraceVerbosity.Full) // full turn-by-turn decision trace
.Audit("audit.jsonl") // structured decision log → your SIEM
.Principal(() => currentUser.Id) // authorization has a subject
.OnPolicy(Authorize) // your rules decide, per act and per identity
.RequireApproval("wire_transfer") // a person, before the act — never after
.EffectLedger("ledger") // run once, even across a crash
.ScreenToolOutput() // tool results are untrusted input
.Sessions("sessions") // conversation that survives the process
.Budget(maxCostUsd: 0.25m) // bound what one prompt may spend — any protocol
.Resilience(retries: 3) // survive a blip without paying twice
.CompensateOnFailure(); // unwind a run that died halfway
Everything below the blank line is opt-in, each with a sane default and none of them a new concept. That is the collapsible substrate: the public API, the loop, and the Tri-Nature never change; power lives in the brokers and the deployment. Delete any line and the agent still runs, with that capability absent rather than half-configured.
The full walkthrough — one capability per step, every snippet runnable — is in docs/how-to.md.
The three ways to reach anything
Every capability answers Local, External and Custom, and the verbs say which:
.Knowledge("Knowledge") // Local — point at what you already have
.UseKnowledge(new PostgresKnowledgeBroker(cs)) // External — a provider package
.OnKnowledge(async query => await MyStore(query)) // Custom — your own code, inline
Sixteen capabilities, the same three verbs each. A capability offered fewer ways than that fails the build — it is a test, not a convention, because the erosion is otherwise invisible until there are six of them.
Streaming, and no DI
Stream the agent thinking and answering — each event is tagged, and the answer arrives live:
await foreach (AgentStreamEvent streamEvent in agent.StreamPromptAsync("What is 47 * 89?"))
{
switch (streamEvent.Type)
{
case AgentStreamEventType.Thinking: /* the model deliberating / tool reasoning */ break;
case AgentStreamEventType.Response: /* the answer, token by token */ break;
case AgentStreamEventType.Tool: /* a tool ran, and its result */ break;
case AgentStreamEventType.Status: /* lifecycle: turns, gate, judge */ break;
}
}
Streaming is not a lesser path. Budgets, cancellation, sessions, the perimeter and compensation all
hold here exactly as they do on ProcessPromptAsync — a control you can step around by changing
method is not a control. Pass a session id to stream inside a conversation:
agent.StreamPromptAsync(prompt, sessionId, cancellationToken).
No DI container. Compose() hand-wires the whole graph — SPEC.md §9: "DI is OPTIONAL. A
hand-wired composition root is fully conformant."
Provider packages — swap any nature to a real backend
The core Standard.Agents is deliberately
dependency-free: a hosted brain, and local-file skills, memory, and knowledge. Reach further with
an opt-in package — each one backs a single nature with a real provider through the same broker
seam, so it's one line and nothing else about your agent changes. Mix them freely: a local brain
with cloud data, a registry of skills with a Redis memory.
| Package | Backs | Provider |
|---|---|---|
Standard.Agents.Decision.Brains.LlamaSharp |
Brain · Decision | a local GGUF model via llama.cpp — no API, no network |
Standard.Agents.Data.Skills.PeerLLM |
Skills · Data | versioned skills from the PeerLLM registry, pulled at runtime |
Standard.Agents.Data.Memory.Redis |
Memory · Data | memory in Redis, keyed per agent / user / session |
Standard.Agents.Data.Knowledge.Postgres |
Knowledge · Data | knowledge in PostgreSQL, ranked tsvector full-text |
Standard.Agents.Data.Knowledge.MsSql |
Knowledge · Data | knowledge in SQL Server, FREETEXT full-text |
The Gate and Judge take your own delegate too —
.OnGate/.OnJudgedrive them with any in-process model, no package needed.
// fully local — one GGUF drives brain, gate and judge, no network anywhere
var llama = new LlamaSharpGeneratorBroker("model.gguf");
var agent = new StandardAgent()
.UseGenerator(llama)
.OnGate(llama.GenerateAsync)
.OnJudge(llama.GenerateAsync);
// production — skills from the registry, knowledge in Postgres, memory in Redis
var agent = new StandardAgent(url, key, "LLooMA2.0")
.UseSkills(new PeerLLMSkillBroker("hassanhabib/my-skills", SkillSync.Hybrid))
.UseKnowledgePostgres(pgConnectionString)
.UseMemoryRedis("localhost:6379", key: $"agent:{userId}");
Pick each nature's home independently; the code above doesn't change when you do — that's the whole promise of the broker seam.
The 1·3·9

The diagram is generated from
assets/the-standard-agent-architecture.svg
— edit the SVG, re-render the PNG.
The 1·3·9 is the shape of an agent. One loop, three natures, and beneath them the foundations — the nine that have been there since the beginning:
| Data | Skill, Knowledge, Memory |
| Decision | Brain, Gate, Judge |
| Direction | InternalTool, ExternalTool, Return |
ReturnService has no broker. It is the dead end — the terminal Direction hands the result back
and touches nothing.
The 1·3·6·14
Fourteen is what actually ships. Five foundations joined the nine, and the reason each one had to be a foundation is the same: it is a distinct resource with its own failures, and a resource reached without a foundation has no validation, no exception mapping, and its failures get blamed on the caller.
| Tier | Count | Members |
|---|---|---|
| Management | 1 | RunManagementService — the only loop: Recall → Think → Act |
| Coordination | 3 | Data · Decision · Direction — the three natures |
| Orchestration | 6 | Retrieval, Recollection / Inference, Guardian / Perimeter, Execution |
| Foundation | 14 | the nine, plus Usage, and Session, Policy, Approval, EffectLedger |
| Broker | 13 + 5 | thirteen nature brokers, three utility, two decorating |
Ten of the fourteen are always there — the agent proper, the nine plus Usage. The other four
arrive with the enterprise capabilities; leave them off and it is the same shape with less in it.
Six foundations under Direction alone breaks the 2–3 rule, and a nature holding six is a nature holding two concepts. So each nature splits into two regions, named for concepts rather than contents: Retrieval is what was authored and ranked, Recollection is what accumulated; Inference asks the model and reads its answer, Guardian is the conscience on either side of it; Perimeter asks may this happen, Execution does it.
Usage is why Decision has two regions rather than one. Measuring what a model call cost is the
same concept as making it — and without it, .Budget() could only bound a run whose provider
volunteered its own numbers, which is to say not the text protocol at all.
Every tier holds two or three of the tier directly below it. Management over coordinations, coordination over orchestrations, orchestration over foundations, foundation over exactly one broker. Both bounds cost something when broken: more than three means the service is doing too much; fewer than two means it composes nothing and is a layer for its own sake.
The rest of the placement rule, all of it enforced by
TierDisciplineTests
rather than by convention:
A foundation wraps exactly one nature broker. The role may be versioned —
IGeneratorBrokerV1is the same seam asIGeneratorBrokerunder a newer contract — but it is one role. A second broker in a foundation is a capability that wants its own foundation.Nothing above the foundation tier takes a broker at all, beyond the three utilities.
Utility brokers — logging, time, audit — are held by any tier. None of them can change what the agent decides or does, which is exactly why they are exempt from the count. Usage is not one of them: a budget stops a run.
Decorating brokers — redaction, resilience — are wrapped around another broker at composition, so no service holds them.
Every tier composes the tier directly below it — management over coordinations, coordination over orchestrations, orchestration over foundations. Adjacency is a rule of its own, not a by-product of the count: a service reaching past the tier below it borrows another nature's internals, and no test of counts or brokers will ever see that.
Flow is forward only. A tier never calls the tier above it, no foundation calls a sibling, and
there are no exceptions. Screening a tool result — .ScreenToolOutput() — is the loop asking
Decision for a verdict, because what may re-enter the context between turns is the loop's question
and the loop is the only place that sees both natures.
Governance
Two rulebooks, and they compose:
- SPEC.md owns contracts and behavior. Normative, language-neutral.
- The Standard owns structure, exceptions,
and process — brokers, foundations, orchestrations, the
Xeptionmodel, FAIL/PASS TDD.
They do not collide: SPEC.md §1 states that "conformance is about contracts and behavior, not file layout or language idiom."
The theory is settled in THE-TRI-NATURE-OF-AGENT.md before any code is written. Build to it.
Structure
Standard.Agents/ the library
|-- Brokers/{Data,Decision,Direction,Loggings}
|-- Brokers/{Audits,Policies,Approvals,Effects,Sessions,Resiliences,Redactions}
|-- Models/Foundations/{Entity}/Exceptions
|-- Models/Orchestrations/Agents AgentContext, AgentStatus, ToolExchange
|-- Models/Orchestrations/Effects AgentEffect, AgentPrincipal, CompensationOutcome
|-- Models/Brokers/Generators/V1 the native tool-calling contract
|-- Services/Foundations/{Entity}s thirteen, one broker each
|-- Services/Orchestrations/{Nature}/... six regions, grouped by nature
|-- Services/Coordinations/{Nature} Data, Decision, Direction
|-- Services/Managements RunManagementService — the loop
|-- Tools/ ITool, AgentTool — the fractal bridge
Standard.Agents.Tests.Unit/ unit tests, mirroring the service tree
Standard.Agents.Conformance/ the vector runner
Standard.Agents.Demo/ a console agent you can run
conformance/vectors/ language-neutral behavioral vectors
conformance/profiles/ what each readiness level requires
docs/how-to.md one capability per step, every snippet runnable
docs/support.md stability, deprecation, supply chain
docs/generator-contracts.md text protocol vs native tool calls
Conformance
Agent behavior involves an LLM and is non-deterministic, so it cannot be asserted directly.
conformance/ instead pins the deterministic contracts — the
loop, reply interpretation, tool routing, and the feed-back of results into Data — by scripting
the Brain. Every double replaces a broker, never a service: the whole 1·3·6·14 under test is the
real library.
dotnet test # unit tests
dotnet run --project Standard.Agents.Conformance # spec certification; exit 0 = conformant
Readiness is claimed per profile, and the claim is checkable by anyone from a clone:
dotnet run --project Standard.Agents.Conformance -- --profile Critical
| Profile | What an agent at this level has |
|---|---|
| Core | conversation, skills, knowledge, memory, simple tools |
| Reliable | guardians that see what they guard, durable decision log, run isolation, cancellation, timeouts |
| Enterprise | identity-aware authorization, approval before irreversible acts, run-once effects, budgets, ranked retrieval |
| Critical | conversation and effects that survive a process, compensation, native tool calls that round-trip |
All four certify. Exit 0 means certified; the runner is the authority, not this table.
The fractal
An agent satisfies ITool, so an agent can be a tool of another agent. Theory Ch.4 — turtles up:
var researcher = new AgentTool("researcher", innerAgent);
var outerAgent = new StandardAgent().Brain(...).Tool(researcher);
Nesting needs no new machinery because the shapes already agree. It is also how a guardian scales: a compliance sub-agent is a distinct conscience, rather than the same brain grading itself.
Contributing
This repo follows The Standard's practices:
- One issue per method. One branch per issue.
- Branch:
users/[username]/[CATEGORY]-[entity]-[action], where the action speaks the language of its layer — brokersinsert/select, foundationsadd/retrieve. - Foundations and up are test-driven, two commits per test:
[TestName] -> FAIL, then[TestName] -> PASS. A FAIL commit must have been run and observed failing. - Brokers carry no unit tests — they are thin and hold no logic. Commit as
BROKERS: [Description]. - PR title:
[CATEGORY]: [Description Of Work Completed].
License
| 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
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- RESTFulSense (>= 3.2.0)
- Xeption (>= 2.9.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Standard.Agents:
| Package | Downloads |
|---|---|
|
Standard.Agents.Decision.Brains.LlamaSharp
An optional in-process local-inference brain (the Decision nature) for Standard.Agents, backed by LLamaSharp (llama.cpp). Runs GGUF models locally with no HTTP and no API key. The core Standard.Agents package stays dependency-free; add a LLamaSharp backend package (LLamaSharp.Backend.Cpu, .Cuda12, .Vulkan, …) to run. |
|
|
Standard.Agents.Data.Skills.PeerLLM
A PeerLLM skills registry source (the Data nature) for Standard.Agents. Pulls versioned skills from skills.peerllm.com through the same ISkillBroker seam as the built-in file skills — wired with .UseSkills(new PeerLLMSkillBroker(...)). Three sync modes: Live (fetch every request), Local (pull once to a cache), and Hybrid (cache, then re-pull only when a newer version ships). The core Standard.Agents package stays dependency-free; this package only uses HttpClient. |
|
|
Standard.Agents.Data.Knowledge.Postgres
A PostgreSQL knowledge source (the Data nature) for Standard.Agents. Grounds an agent on a Postgres table using full-text search — the same IKnowledgeBroker seam as the built-in file knowledge, swapped in with .UseKnowledgePostgres(...). The core Standard.Agents package stays dependency-free; this package brings Npgsql. |
|
|
Standard.Agents.Data.Memory.Redis
A Redis memory store (the Data nature) for Standard.Agents. Persists an agent's memory as a Redis list keyed per agent/user/session — the same IMemoryBroker seam as the built-in file memory, swapped in with .UseMemoryRedis(...). The core Standard.Agents package stays dependency-free; this package brings StackExchange.Redis. |
|
|
Standard.Agents.Data.Knowledge.MsSql
A SQL Server knowledge source (the Data nature) for Standard.Agents. Grounds an agent on a SQL Server table using full-text search — the same IKnowledgeBroker seam as the built-in file knowledge, swapped in with .UseKnowledgeMsSql(...). The core Standard.Agents package stays dependency-free; this package brings Microsoft.Data.SqlClient. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 312 | 10/10/2026 |
| 5.1.0 | 119 | 10/4/2026 |
| 5.0.0 | 136 | 9/28/2026 |
| 4.0.0 | 125 | 9/27/2026 |
| 3.0.0 | 115 | 9/27/2026 |
| 2.0.0 | 205 | 9/6/2026 |
| 1.16.0 | 134 | 8/29/2026 |
| 1.15.0 | 136 | 8/28/2026 |
| 1.14.0 | 134 | 8/28/2026 |
| 1.13.0 | 141 | 8/28/2026 |
| 1.12.1 | 133 | 8/27/2026 |
| 1.12.0 | 136 | 8/27/2026 |
| 1.11.0 | 146 | 8/27/2026 |
| 1.10.0 | 131 | 8/26/2026 |
| 1.9.0 | 140 | 8/24/2026 |
| 1.8.0 | 130 | 8/24/2026 |
| 1.7.0 | 139 | 8/24/2026 |
| 1.6.1 | 136 | 8/23/2026 |
| 1.5.0 | 140 | 8/23/2026 |
| 1.4.0 | 168 | 8/18/2026 |