BringYourOwnAgent 0.0.7

Prefix Reserved
dotnet add package BringYourOwnAgent --version 0.0.7
                    
NuGet\Install-Package BringYourOwnAgent -Version 0.0.7
                    
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="BringYourOwnAgent" Version="0.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BringYourOwnAgent" Version="0.0.7" />
                    
Directory.Packages.props
<PackageReference Include="BringYourOwnAgent" />
                    
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 BringYourOwnAgent --version 0.0.7
                    
#r "nuget: BringYourOwnAgent, 0.0.7"
                    
#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 BringYourOwnAgent@0.0.7
                    
#: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=BringYourOwnAgent&version=0.0.7
                    
Install as a Cake Addin
#tool nuget:?package=BringYourOwnAgent&version=0.0.7
                    
Install as a Cake Tool

BringYourOwnAgent (.NET)

This is an early draft implementation of BYOA (Bring Your Own Agent), an open protocol that lets websites and apps use the visitor's own AI agents (their subscriptions, API keys, connected accounts, local models or home servers) within limits the visitor sets. Versions 0.0.x implement only the first rules: it checks a requester's manifest, and it decides whether one call may go ahead under the visitor's grant. The rules are a draft for discussion and will change. Targets .NET 8 (no dependencies) and .NET Standard 2.0, for desktop apps on .NET Framework 4.6.2 or newer (depends on System.Text.Json).

Install

dotnet add package BringYourOwnAgent

The package, the assembly and the namespace are all named BringYourOwnAgent.

Example

With the manifest shown on the BYOA site (sdk/examples/manifest.json: a family geography game, voice clips up to 15 seconds):

using BringYourOwnAgent;

var manifest = File.ReadAllText("manifest.json");
Console.WriteLine(Manifest.Validate(manifest).Ok);                 // True

var grant = """{"byoa": "0.1-draft", "skills": ["audio.transcribe"], "budget": {"perSession": "0.20 USD"}, "expiresAt": "2026-10-10T13:00:00Z"}""";
var call = """{"skill": "audio.transcribe", "at": "2026-10-10T12:00:00Z", "provider": "local-model", "estimatedCost": "0 USD", "input": {"clipSeconds": 42}}""";
var result = Gate.CheckCall(manifest, grant, call, """{"spent": "0.04 USD"}""");
Console.WriteLine($"{result.Decision} {result.Reasons[0].Code}");  // Blocked clip-too-long
  • Documents are JSON. Pass them as JsonElement (System.Text.Json) or as JSON text (string). Text that is not JSON makes that document invalid; it is reported, not thrown.
  • Manifest.Validate(manifest) returns a ValidationResult: Ok, Errors and Warnings; each Issue has a stable Code, a JSON Pointer Path and a Message. Problems are returned as data, never thrown.
  • Gate.CheckCall(manifest, grant, call, state) returns a CheckResult: a Decision (Allowed, Warn, Ask, Blocked) and Reasons, each with a stable Code. Invalid input blocks the call instead of throwing. A null state means nothing spent and no calls yet.
  • ToJson() on either result gives it in the JSON shape of the Python and Node.js libraries ({"decision": "blocked", "reasons": [...]}). Messages are for people and may change; programs should use the codes.
  • While a limit or warning needs a measurement, the call must state it: input.clipSeconds under a clip limit, input.textChars under a text limit or a "warn me if it sends text" condition. Use 0 when there is no such input; a missing value blocks the call.
  • CheckCall only evaluates. Your wallet runs the call, then records its time and real cost in the state, and must not check two calls of one grant against the same state at once (see "Execution contract" in the rules).
  • Money is handled as whole micro-units in a 64-bit integer, never as floating point: "0.1 USD" plus "0.2 USD" fits a budget of "0.3 USD" exactly.

The purpose judge hook

The hard limits are checked by code. Judging whether a call fits the declared purpose in words needs a model, and is not part of this library. It plugs in as a PurposeJudge: a function of the manifest, the grant and the call that returns an Opinion (Decision, optional Code and Message) or null. An opinion can only make the decision stricter; a judge that throws gives Ask.

var result = Gate.CheckCall(manifest, grant, call, state, judge: (m, g, c) => MySyncJudge(m, g, c));

A judge that calls a model is usually asynchronous. Check first, and ask the judge only if the call is not already blocked:

async Task<CheckResult> DecideAsync(JsonElement manifest, JsonElement grant, JsonElement call, JsonElement? state)
{
    var result = Gate.CheckCall(manifest, grant, call, state);
    if (result.Decision == Decision.Blocked) return result;
    Opinion? opinion;
    try { opinion = await MyAsyncJudge(manifest, grant, call); }
    catch (Exception) { opinion = new Opinion(Decision.Ask, "purpose-judge-error", "the purpose judge failed"); }
    return Gate.ApplyOpinion(result, opinion);
}

If the model answers in JSON, pass it as it is: Gate.ApplyOpinion(result, answer) with a JsonElement reads {"decision": ..., "code": ..., "message": ...}, and anything that is not an opinion gives Ask with the code purpose-judge-error.

Development

The tests are a small console program with no test framework. They run the shared test vectors in sdk/test-vectors/, which the Python and Node.js packages must pass identically, and some .NET-specific tests. From sdk/dotnet/ in the repository:

dotnet run --project tests/BringYourOwnAgent.Tests -c Release -f net8.0                            # the net8.0 build
dotnet run --project tests/BringYourOwnAgent.Tests -c Release -f net8.0 -p:TestNetStandard=true    # the netstandard2.0 build
dotnet run --project tests/BringYourOwnAgent.Tests -c Release -f net48                             # netstandard2.0 on .NET Framework (Windows)

There is no command line tool in this package; the Python and Node.js packages include one.

License

Apache License 2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.7 105 11/2/2026
0.0.6 105 11/1/2026
0.0.5 102 11/1/2026
0.0.4 107 10/31/2026
0.0.3 103 10/28/2026
0.0.2 303 10/10/2026