AgentsSdk 0.0.1

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

AgentsSdk

CI License

An agent framework for .NET. Build LLM-driven agents with tools, compose them into multi-agent trees and workflows, and run them with streaming events, sessions and state — provider-agnostic.

using AgentsSdk.Agents;
using AgentsSdk.Models.Anthropic;
using AgentsSdk.Runners;
using AgentsSdk.Tools;
using AgentsSdk.Types;

var agent = new LlmAgent
{
    Name = "assistant",
    Model = new AnthropicLlm("claude-sonnet-4-5", new AnthropicOptions { ApiKey = key }),
    Instruction = "You are a helpful assistant.",
    Tools = [FunctionTool.Create(GetWeather)],
};

var runner = new InMemoryRunner(agent);
var session = await runner.CreateSessionAsync("user-1");

await foreach (var e in runner.RunAsync("user-1", session.Id, Content.UserText("weather in Melbourne?")))
{
    if (e.IsFinalResponse())
        Console.WriteLine(e.Content?.JoinText());
}

[Description("Gets the current weather for a city.")]
static string GetWeather([Description("City name")] string city) => $"{city}: 21C, sunny";

Installation

dotnet add package AgentsSdk                    # core — zero dependencies
dotnet add package AgentsSdk.Models.OpenAI      # OpenAI-compatible (OpenAI, Azure, Ollama, vLLM, OpenRouter)
dotnet add package AgentsSdk.Models.Anthropic   # Anthropic Messages API
dotnet add package AgentsSdk.Models.Gemini      # Google Gemini
dotnet add package AgentsSdk.Models.Bedrock     # AWS Bedrock (Converse)

Features

  • LlmAgent — instruction (with {stateKey} templating), tools, callbacks, structured config; runs the full model ⇄ tool loop with parallel tool execution.
  • Function tools — wrap any C# delegate; JSON Schema is derived by reflection ([Description] attributes, optional/nullable parameters, enums, POCOs). ToolContext/CancellationToken parameters are injected automatically.
  • Multi-agent — sub-agents are offered to the model as transfer_to_agent targets; AgentTool wraps an agent as a callable tool instead.
  • Workflow agentsSequentialAgent, ParallelAgent (isolated branches, merged streams), LoopAgent (escalation-driven).
  • Sessions & state — event-sourced sessions; state deltas carried on events; app: / user: / temp: scoped keys; in-memory implementation included, interface ready for persistent stores.
  • StreamingIAsyncEnumerable<Event> end to end; partial text events with RunConfig.StreamingMode = StreamingMode.Sse.
  • Callbacks — before/after agent, model and tool hooks that can mutate, short-circuit or replace behavior (guardrails, caching, redaction).
  • Providers — OpenAI-compatible (OpenAI, Azure OpenAI, Ollama, vLLM, OpenRouter), Anthropic, Google Gemini, AWS Bedrock (Converse). The core library has zero dependencies; each provider is its own package.

Solution layout

Project Purpose
src/AgentsSdk Core: agents, tools, events, sessions, runner, model abstraction (no dependencies)
src/AgentsSdk.Models.OpenAI OpenAI-compatible chat-completions adapter
src/AgentsSdk.Models.Anthropic Anthropic Messages API adapter
src/AgentsSdk.Models.Gemini Google Gemini adapter
src/AgentsSdk.Models.Bedrock AWS Bedrock Converse adapter (AWSSDK.BedrockRuntime)
tests/* xUnit test suites (scripted FakeLlm, fake HTTP handlers)
samples/AgentsSdk.Samples.Console Streaming chat, sequential pipeline, coordinator demos

Core concepts

  • Event — one entry in a conversation: user message, model response (or streaming chunk), tool results, or control signals (TransferToAgent, Escalate, state delta). Agents are IAsyncEnumerable<Event> producers.
  • Runner — loads the session, appends the user message, picks the agent to run (resuming the last-responding LlmAgent after a transfer), streams events and persists every non-partial event.
  • InvocationContext / CallbackContext / ToolContext — progressively richer views of the current run; state writes through a context are delta-tracked and persist with the event that carried them.
  • ILlm / LlmRequest / LlmResponse — the provider abstraction. Agents can hold a model instance directly or a model-name string resolved through an ILlmRegistry (registry.AddAnthropic(...), .AddOpenAi(...), .AddGemini(...), .AddBedrock(...)).

Multi-agent example

var coordinator = new LlmAgent
{
    Name = "coordinator",
    Model = "claude-sonnet-4-5",          // resolved via ILlmRegistry
    Instruction = "Route requests to the right specialist.",
    SubAgents =
    [
        new LlmAgent { Name = "billing", Description = "Billing and invoices." },
        new LlmAgent { Name = "tech_support", Description = "Technical problems." },
    ],
};
// sub-agents inherit the coordinator's model and are reachable via transfer_to_agent

Sequential pipeline example

var pipeline = new SequentialAgent
{
    Name = "pipeline",
    SubAgents =
    [
        new LlmAgent { Name = "researcher", Model = m, OutputKey = "research" },
        new LlmAgent { Name = "writer", Model = m, Instruction = "Write from: {research}" },
    ],
};

Samples

# Ollama (default, no key needed)
dotnet run --project samples/AgentsSdk.Samples.Console chat

# Anthropic
$env:AGENTS_PROVIDER = "anthropic"; $env:ANTHROPIC_API_KEY = "sk-ant-..."
dotnet run --project samples/AgentsSdk.Samples.Console coordinator

# Bedrock (ambient AWS credentials)
$env:AGENTS_PROVIDER = "bedrock"; $env:AWS_REGION = "ap-southeast-2"
dotnet run --project samples/AgentsSdk.Samples.Console pipeline

Demos: chat (streaming + tools), pipeline (sequential + OutputKey), coordinator (agent transfer).

Building & testing

dotnet build
dotnet test

Requires the .NET 10 SDK. All tests run offline: model behavior is scripted through FakeLlm, HTTP adapters are tested against canned SSE/JSON via a fake handler, and Bedrock against a mocked IAmazonBedrockRuntime.

Roadmap (designed-for, not yet implemented)

  • Persistent session services (ISessionService is the seam)
  • Memory (IMemoryService) and artifacts (IArtifactService)
  • MCP tool support
  • Structured output enforcement (GenerateContentConfig.ResponseSchema is plumbed)
  • A2A remote agents, code executors, planners

Contributing

Contributions are welcome — see CONTRIBUTING.md. Security issues should be reported privately per SECURITY.md.

License

Licensed under the Apache License 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.
  • net10.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on AgentsSdk:

Package Downloads
AgentsSdk.Models.OpenAI

OpenAI-compatible chat-completions model adapter for AgentsSdk (OpenAI, Azure OpenAI, Ollama, vLLM, OpenRouter...).

AgentsSdk.Models.Gemini

Google Gemini model adapter for AgentsSdk.

AgentsSdk.Models.Anthropic

Anthropic (Claude) Messages API model adapter for AgentsSdk.

AgentsSdk.Models.Bedrock

AWS Bedrock (Converse API) model adapter for AgentsSdk.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1 156 7/23/2026