Universal.Operative.Sdk.Discrete 3.1.0

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

Universal.Operative.Sdk.Discrete

Provider-neutral conversations, model streams, tools, transforms, turn coordination, and durable conversation chronologies.

Install

dotnet add package Universal.Operative.Sdk.Discrete

Use a provider package such as Universal.Operative.Sdk.Discrete.OpenAI or Universal.Operative.Sdk.Discrete.Anthropic to supply an IModel.

Run a turn

using Universal.Operative.Sdk;
using Universal.Operative.Sdk.Discrete;

IEngine engine = EngineBuilder.FromDefaults(model)
    .AddBaselineToolSet()
    .Build();

var conversation = new Conversation
{
    Messages =
    {
        new Message
        {
            Role = MessageRoles.User,
            Content = { new TextBlock("Inspect this repository.") },
        },
    },
};

ConversationManager manager = await ConversationManager.CreateAsync(conversation);

await foreach (EngineEvent engineEvent in engine.ExecuteAsync(
    new ExecutionContext(new TurnContext()), manager))
{
    if (engineEvent is AssistantMessageEvent response)
        Console.WriteLine(response.Message);
}

Engine streams model output, dispatches tools, applies transforms, and records turn and model-call audit facts through the conversation manager.

Persist and resume

The host owns the repository and its lifetime. ConversationManager owns one mutable materialization and moves one named head.

var repositoryOptions = new FileSystemConversationRepositoryOptions
{
    Directory = conversationDirectory,
    ChronologyId = conversationId,
};

await using FileSystemConversationRepository repository =
    await FileSystemConversationRepository.OpenOrCreateAsync(repositoryOptions);

ConversationManager manager = await ConversationManager.OpenOrCreateAsync(
    repository,
    () => new Conversation { Id = conversationId });

IOperative operative = OperativeBuilder.Create(engine, manager)
    .WithChronologyCompactor(new SizeLimitedChronologyCompactor(new()
    {
        MaximumBytes = 256L * 1024 * 1024,
    }))
    .Build();

Use FileSystemConversationRepository.CreateAsync when the chronology must be new, OpenAsync when it must exist, and OpenOrCreateAsync for either state. A filesystem repository permits one open writer.

chronology.jsonl contains ordered audit facts. Immutable content-addressed objects store conversation snapshots and messages. Unchanged messages are shared across revisions.

Branch and restore

Every revision records its ordered parents and exact conversation snapshot. A named head may be reset or forked without changing earlier revisions.

ConversationManager alternative = await manager.ForkAsync(
    earlierRevisionId,
    headName: "alternative");

await alternative.ResetAsync(otherRevisionId);
Conversation restored = alternative.Current;

Use ReadChronologyAsync to inspect revisions, named heads, turn outcomes, model invocations, and host-defined CustomChronologyEvent values.

Host multiple sessions

Session is the durable host-level unit around one discrete Conversation. It is independent of authentication, tenancy, UI selection, and transport. ISessionStore is the persistence boundary: implement it over a database or remote service, or start with the included InMemorySessionStore and FileSystemSessionStore.

ISessionStore store = new FileSystemSessionStore(new()
{
    Directory = sessionDirectory,
});

var sessions = new SessionManager(store, () => new Conversation
{
    System = [new TextBlock("You are a helpful operative.")],
});

Session session = await sessions.CreateAsync();
IOperative operative = operativeFactory.Create(session.Conversation);
// Run turns, then persist the mutated conversation with optimistic concurrency.
session = await sessions.SaveAsync(session with { Conversation = operative.Conversation });

Store-issued Session.Version values are opaque optimistic-concurrency tokens. Reads are detached, creates reject duplicate identifiers, stale saves fail with SessionConflictException, and deletes may be conditional. A store instance defines its own isolation boundary; the host decides whether that means one user, tenant, application, connection, or a deliberately shared consciousness.

SessionManager supplies storage-neutral create, rename, fork, truncate, and title inference operations. It intentionally does not track an active session or perform authorization. Those are adapter responsibilities.

Bound storage

IChronologyCompactor defines lossy chronology compaction for repositories that implement ICompactableConversationRepository.

  • SizeLimitedChronologyCompactor retains the largest recent reachable revision window within a byte limit.
  • RevisionWindowChronologyCompactor retains a configured number of recent reachable revisions.
  • CheckpointChronologyCompactor retains only revisions referenced by named heads.
  • FileSystemConversationRepository.ApplyRetentionAsync deletes old payloads while retaining the audit graph.

Compactors preserve every named head. A result reports when the requested byte target cannot be met by the required heads alone.

Main abstractions

  • Conversation is mutable state supplied to a model.
  • ConversationManager materializes revisions and moves one named head.
  • Session and SessionManager model host-level conversation lifecycle.
  • ISessionStore persists sessions independently of transport and identity.
  • IConversationRepository stores immutable revisions and chronology events.
  • Chronology is the audit read model.
  • IModel maps a provider to provider-neutral stream events.
  • Engine runs one turn.
  • Operative coordinates concurrent submissions.
  • ITransformer derives replacement conversation or turn-context state.

License

Free for noncommercial use under the Universal.Operative Noncommercial License. Commercial use requires a separate license from Andrew Ong.

Product Compatible and additional computed target framework versions.
.NET 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 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 (16)

Showing the top 5 NuGet packages that depend on Universal.Operative.Sdk.Discrete:

Package Downloads
Universal.Operative.Sdk.Scheduling

Durably schedule a prompt to fire into a Universal.Operative.Sdk IOperative at a future time, either once or on a recurring cron schedule — it fires even if this process wasn't running when the schedule came due. ScheduleCreate/List/Cancel tools (backed by a shared ScheduleService, reusable from an HTTP-facing admin surface too) durably register atomically on creation, roll back on failure. IDurableScheduleBackend implementations: WindowsTaskSchedulerBackend/SystemdTimerBackend/CrontabBackend register with the OS's own scheduler; HttpDurableScheduleBackend registers against a remote HTTP dispatcher instead, for hosts (e.g. a sandboxed PaaS container) with no local OS scheduler reachable at all. Every backend is fully configured at construction — RegisterAsync just needs the schedule.

Universal.Operative.Sdk.Discrete.Anthropic.ClaudeAgentSdk

Claude Agent SDK model adapter for Universal.Operative.Sdk.Discrete.

Universal.Operative.Sdk.Discrete.Anthropic

Anthropic Messages API adapter for Universal.Operative.Sdk.Discrete.

Universal.Operative.Sdk.Discrete.OpenAI

OpenAI Chat Completions and Responses API adapters for Universal.Operative.Sdk.Discrete.

Universal.Operative.Sdk.Discrete.DeepSeek

DeepSeek extensions for the Universal.Operative.Sdk.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.0 59 9/17/2026
3.0.0 412 9/7/2026
2.4.1 107 9/5/2026
2.3.0 99 9/5/2026
2.2.1 174 9/4/2026
2.2.0 93 9/4/2026
2.1.0 221 9/3/2026
2.0.1 288 9/2/2026
2.0.0 433 9/1/2026
1.2.0 355 8/26/2026
1.1.0 181 8/24/2026
1.0.0 313 8/12/2026

Adds transport-neutral Session lifecycle and persistence contracts, optimistic concurrency, and in-memory and filesystem stores while retaining durable conversation chronologies.