Glacier.AgentDevKit.Adk
1.1.0
dotnet add package Glacier.AgentDevKit.Adk --version 1.1.0
NuGet\Install-Package Glacier.AgentDevKit.Adk -Version 1.1.0
<PackageReference Include="Glacier.AgentDevKit.Adk" Version="1.1.0" />
<PackageVersion Include="Glacier.AgentDevKit.Adk" Version="1.1.0" />
<PackageReference Include="Glacier.AgentDevKit.Adk" />
paket add Glacier.AgentDevKit.Adk --version 1.1.0
#r "nuget: Glacier.AgentDevKit.Adk, 1.1.0"
#:package Glacier.AgentDevKit.Adk@1.1.0
#addin nuget:?package=Glacier.AgentDevKit.Adk&version=1.1.0
#tool nuget:?package=Glacier.AgentDevKit.Adk&version=1.1.0
Agent Development Kit (ADK)
📖 Read the Deep-Dive: C# got left behind in the AI Agent hype. So I fixed it. (AgentDevKit)
Welcome to Glacier.AgentDevKit.Adk — a 100% pure C# (.NET 10), Native AOT-compatible library for building autonomous AI agents that think, plan, stream, and act using strongly typed C# tools, multi-agent workflows, and the Model Context Protocol (MCP).
Key Capabilities
- 100% Pure C# & Native AOT Compatible (
net10.0): Zero Python bridges, zero native SQLite dependencies, and fullJsonTypeInfo<T>+JsonSchemaExportersupport. - Dynamic Tool Schema Generation:
FunctionTool<TArgs, TResult>automatically derives accurate JSON Schemas (including[Description]attributes andrequiredproperties) directly from yourTArgsDTOs. - True Incremental SSE Streaming: Real-time token streaming and multi-chunk SSE tool-call delta reassembly across both
OpenAiService(OpenAI, Glacier.Serve, vLLM, Ollama) andGeminiService(?alt=ssewithx-goog-api-keyheader auth). - Fail-Closed Security & Guardrails:
SensitiveToolenforces mandatoryIApprovalServicehuman-in-the-loop (HITL) consent (denying execution automatically if unconfigured), paired withBeforeToolCallargument interceptors. - Composable Multi-Agent Orchestration: Built-in
DelegationTool,SequentialAgent,ParallelAgent, andLoopAgentprimitives. - Native OpenTelemetry: First-class
ActivitySourcetraces andMetercounters (Glacier.AgentDevKit.Adk).
Getting Started
using System.ComponentModel;
using Glacier.AgentDevKit.Adk;
// 1. Connect an LLM provider (Gemini or any OpenAI-compatible server)
var llm = new GeminiService(Environment.GetEnvironmentVariable("GEMINI_API_KEY")!);
// 2. Define a strongly typed C# tool (JSON Schema is generated automatically from WeatherArgs)
var weatherTool = new FunctionTool<WeatherArgs, string>(
name: "get_weather",
description: "Gets the current weather for a city.",
execute: args => $"Sunny and 22C in {args.City} ({args.Units})"
);
// 3. Create your Agent
var agent = new LlmAgent(
name: "TravelAssistant",
model: "gemini-2.5-flash",
description: "Helps travellers plan trips.",
instruction: "You are a concise travel assistant. Use tools when needed.",
tools: new List<ITool> { weatherTool }
);
// 4. Run or stream responses
string answer = await agent.RunAsync("What's the weather in Tokyo in metric?", llm);
public sealed class WeatherArgs
{
[Description("City name, e.g. Tokyo")]
public required string City { get; set; }
[Description("Temperature unit system (metric or imperial)")]
public string Units { get; set; } = "metric";
}
Session Memory (MemorySessionProvider & FileSessionProvider)
Give agents persistent multi-turn memory across requests or process restarts without any native C/C++ database libraries:
var sessions = new FileSessionProvider("./agent_sessions");
var agent = new LlmAgent(
name: "Concierge",
model: "gpt-4o-mini",
description: "Remembers user preferences.",
instruction: "Remember facts shared by the user.",
tools: new List<ITool>(),
sessionProvider: sessions
);
await agent.RunAsync("My favourite airline seat is aisle.", llm, sessionId: "user-42");
await foreach (var token in agent.RunStreamingAsync("Which seat should I book?", llm, sessionId: "user-42"))
{
Console.Write(token);
}
Multi-Agent Teams & Workflows
Manager-Worker Delegation
var researcher = new LlmAgent("Researcher", "gemini-2.5-flash", "Finds domain facts.", "Provide verified facts.");
var manager = new LlmAgent(
"Manager",
"gemini-2.5-flash",
"Coordinates tasks.",
"Delegate research questions to Researcher and summarize.",
new List<ITool> { new DelegationTool(researcher, llm) }
);
Orchestration Workflows
SequentialAgent: Pipes the output of stepiinto stepi + 1.ParallelAgent: Executes multiple specialist agents concurrently viaTask.WhenAll, with an optional consolidator agent.LoopAgent: Iteratively refines output until astopConditionpredicate succeeds ormaxTurnsis reached.
Model Context Protocol (MCP)
Discover and invoke external MCP servers natively via Glacier.Agent.Mcp:
await using var mcp = new McpService();
var mcpTools = await mcp.InitializeFromConfigAsync(configuration);
agent.Tools.AddRange(mcpTools);
Security: Guardrails & Fail-Closed HITL Approvals
Wrapping a tool in SensitiveTool guarantees fail-closed enforcement: if ApprovalService is missing or returns false, execution is blocked before the tool can run.
var deleteTool = new SensitiveTool(new DeleteDatabaseTool());
var agent = new LlmAgent("OpsAgent", "gpt-4o-mini", "Ops assistant", "Manage databases safely.", new List<ITool> { deleteTool })
{
ApprovalService = new ConsoleApprovalService(),
BeforeToolCall = (tool, argsJson) =>
{
if (argsJson.Contains("..", StringComparison.Ordinal))
{
throw new InvalidOperationException("Path traversal blocked.");
}
return Task.FromResult(argsJson);
}
};
Resilience & Self-Correction
When local or quantized models emit noisy JSON around tool arguments, OpenAiService extracts valid JSON blocks and LlmAgent feeds validation errors back to the model for automatic self-correction up to MaxRetries.
What's New in v1.1.0
- Dynamic JSON Schema Generation (
FunctionTool): Replaced static placeholder schemas with.NET 10JsonSchemaExporter([Description],required, and Native AOTJsonTypeInfo<T>overloads). - Streaming SSE Tool-Call Reassembly & True Gemini SSE:
OpenAiServicereassembles chunked SSEdelta.tool_callsfragments and correlatestool_call_ids;GeminiServicestreams real incremental SSE (?alt=sse+x-goog-api-keyheader). - Fail-Closed
SensitiveToolEnforcement:LlmAgentstrictly blocksSensitiveToolexecution whenever noIApprovalServiceis configured. - Full Native AOT Compatibility (
<IsAotCompatible>true</IsAotCompatible>): Source-generatedAdkJsonContext, AOT-safe MCP configuration binding, and zero build/trim warnings under<TreatWarningsAsErrors>true</TreatWarningsAsErrors>.
Credits
Developed by Ian Cowley and Antigravity (Google DeepMind).
❄️ Glacier Ecosystem & Support
Part of the Glacier Ecosystem — high-performance, zero-allocation developer tooling and data engines natively built for modern C# and .NET 10.
- 🌐 Website & Documentation: glaciersoftware.dev
- ☕ Buy Me a Coffee: buymeacoffee.com/glaciersoftware
- ❤️ GitHub Sponsors: github.com/sponsors/ian-cowley
- 🐙 All Repositories: github.com/ian-cowley
| 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
- Glacier.Agent (>= 1.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.Configuration.Json (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.Logging.Console (>= 10.0.0)
- OpenTelemetry (>= 1.15.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.