Universal.Operative.Sdk
5.0.1
See the version list below for details.
dotnet add package Universal.Operative.Sdk --version 5.0.1
NuGet\Install-Package Universal.Operative.Sdk -Version 5.0.1
<PackageReference Include="Universal.Operative.Sdk" Version="5.0.1" />
<PackageVersion Include="Universal.Operative.Sdk" Version="5.0.1" />
<PackageReference Include="Universal.Operative.Sdk" />
paket add Universal.Operative.Sdk --version 5.0.1
#r "nuget: Universal.Operative.Sdk, 5.0.1"
#:package Universal.Operative.Sdk@5.0.1
#addin nuget:?package=Universal.Operative.Sdk&version=5.0.1
#tool nuget:?package=Universal.Operative.Sdk&version=5.0.1
About
Universal.Operative.Sdk is the shared kernel for the Universal.Operative.Sdk family: the provider-neutral content model (Block and its subtypes, Source, Citation), the tool-calling contract (ITool, Tool<TArgs>, ToolResult, ToolDefinition, ToolChoice), token accounting (Usage, ITokenEstimator), and cross-cutting infrastructure (IDiagnosticSink). It also ships a baseline tool set (Tools/BaselineTools.cs: Read, Write, Edit, Glob, Grep, a shell, TodoWrite, NotebookEdit) built on those contracts.
None of this assumes a particular execution model — it's reused unchanged by both Universal.Operative.Sdk.Discrete (turn-based: Conversation, Engine, Operative) and Universal.Operative.Sdk.Realtime (live duplex sessions). Install this package alongside whichever of those two matches what you're building; you won't normally install it alone.
How to Use
Installation
dotnet add package Universal.Operative.Sdk
dotnet add package Universal.Operative.Sdk.Discrete # turn-based agents
# or
dotnet add package Universal.Operative.Sdk.Realtime # duplex-stream / voice agents
Core concepts
Block— the provider-neutral content unit (TextBlock,ImageBlock,AudioBlock,DocumentBlock,VideoBlock,ToolCallBlock,ToolResultBlock,ReasoningBlock,RefusalBlock,ServerToolUseBlock/ServerToolResultBlock,RawJsonBlock). Both execution models build their message/event shapes out of these.Source(Base64Source,UrlSource,FileIdSource,TextSource,ContentSource) backs any media-bearing block;Citation(DocumentCitation,UrlCitation) attaches source attribution to aTextBlock.ITool/Tool<TArgs>— a callable the model can invoke. SubclassTool<TArgs>with a typed argument record and aDefinitionwhoseParametersschema is generated straight from that record viaBuildParametersSchema(), so the schema the model sees and the typeExecuteAsyncdeserializes into can't drift apart; the base class handles (de)serialization and turns malformed arguments into a model-readable error instead of an exception. SeeTools/BaselineTools.csandTools/FileSystem/GlobTool.csfor worked examples.ToolResult— a tool's output: aBlocklist plusIsError. FactoriesText,Json<T>,Image; implicit conversions fromstring/Block.ToolDefinition— a tool's name, description, and JSON Schema parameters, as sent to a provider;ToolChoice(Auto/Required/None/Tool) controls whether/which tool the model must call.Usage— token accounting (InputTokens,OutputTokens, provider-specificExtensions), reused by both a turn-basedMessage.Usageand a realtime session's usage events.ITokenEstimator(default:CharHeuristicTokenEstimator) estimates the token footprint of aBlock/text for budget-aware transformers.IDiagnosticSink— a seam for the SDK to surface internal notices (a dropped stream block, an abandoned tool call) without taking a dependency on any particular logging library.
Writing a custom tool
using System.ComponentModel;
using System.Text.Json.Serialization;
using Universal.Operative.Sdk.Tools;
public sealed class WeatherTool : Tool<WeatherTool.Args>
{
public override string Name => "get_weather";
public override bool IsConcurrencySafe => true;
public override ToolDefinition Definition { get; } = new()
{
Name = "get_weather",
Description = "Get the current weather for a city.",
Parameters = BuildParametersSchema(),
};
public sealed record Args
{
[JsonPropertyName("city")]
[Description("The city to get the weather for.")]
public required string City { get; init; }
}
protected override async Task<ToolResult> ExecuteAsync(Args args, CancellationToken cancellationToken)
=> ToolResult.Json(new { city = args.City, tempF = 72 });
}
BuildParametersSchema() reflects over Args: [JsonPropertyName] controls each parameter's wire name, [Description] becomes the text the model sees for it, and required string/[Required] marks it mandatory. Use a real C# enum (not a loosely-typed string) for any parameter with a closed set of valid values. Parameters is a Universal.Common.Json.JsonSchema, so a hand-authored schema still works when reflection can't express the shape you need (e.g. oneOf/$ref). IsConcurrencySafe = true marks a read-only tool as safe to run in parallel with other calls in the same turn/session; mutating tools default to false.
A tool whose work can outlive a single call implements IBackgroundTool (most conveniently via BackgroundTool<TArgs>) — see ShellTool for a worked example.
HTTP proxy tools
A tool that just calls an external REST API can subclass HttpProxyTool<TArgs> instead of hand-rolling ExecuteAsync — it owns the build → send → format template; a subclass overrides BuildRequestAsync and, optionally, FormatResponseAsync. HttpClientProxyTool<TArgs> is the plain-HttpClient implementation. Pair this with Universal.Operative.Sdk.Http's HttpServiceClientProxyTool<TServiceClient, TArgs> when the target API already has a Universal.Common.Net.Http.HttpServiceClient.
References
ReferenceTool fetches whatever content a reference URI points to, via a registered IReferenceResolver (InMemoryReferenceResolver is the built-in default). It's deliberately generic — the tool carries no opinion about what a reference is; it only resolves a URI to IReadOnlyList<Block> content.
License
Free for noncommercial use under the Universal.Operative Noncommercial License. Source is closed; commercial use requires a separate license from Andrew Ong.
| 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
- Universal.Common.Json (>= 1.9.0)
NuGet packages (35)
Showing the top 5 NuGet packages that depend on Universal.Operative.Sdk:
| Package | Downloads |
|---|---|
|
Universal.Operative.Sdk.Discrete
Turn-based agent runtime for Universal.Operative.Sdk: Conversation/Message, IModel, Engine, and Operative. |
|
|
Universal.Operative.Sdk.Tavily
Tavily-backed web search and web fetch tools for the Universal.Operative.Sdk. |
|
|
Universal.Operative.Sdk.Discrete.OpenAI
OpenAI Chat Completions and Responses API adapters for Universal.Operative.Sdk.Discrete. |
|
|
Universal.Operative.Sdk.Discrete.Anthropic
Anthropic Messages API adapter for Universal.Operative.Sdk.Discrete. |
|
|
Universal.Operative.Sdk.Discrete.Anthropic.ClaudeAgentSdk
Claude Agent SDK model adapter for Universal.Operative.Sdk.Discrete. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.1.3 | 562 | 10/2/2026 |
| 6.1.2 | 1,172 | 9/7/2026 |
| 6.1.1 | 142 | 9/5/2026 |
| 6.0.3 | 330 | 9/4/2026 |
| 6.0.2 | 302 | 9/3/2026 |
| 6.0.1 | 328 | 9/2/2026 |
| 6.0.0 | 868 | 9/1/2026 |
| 5.2.0 | 778 | 8/26/2026 |
| 5.1.1 | 125 | 8/25/2026 |
| 5.1.0 | 289 | 8/24/2026 |
| 5.0.1 | 546 | 8/19/2026 |
| 5.0.0 | 422 | 8/12/2026 |
| 4.2.0 | 262 | 8/5/2026 |
| 4.1.3 | 136 | 8/4/2026 |
| 4.1.2 | 148 | 7/31/2026 |
| 4.1.1 | 141 | 7/31/2026 |
| 4.1.0 | 220 | 7/30/2026 |
| 4.0.0 | 372 | 7/28/2026 |
| 3.3.0 | 146 | 7/28/2026 |
| 3.2.0 | 369 | 7/27/2026 |
Made Block have a null-safe construction.