NTG.Adk
1.8.8
dotnet add package NTG.Adk --version 1.8.8
NuGet\Install-Package NTG.Adk -Version 1.8.8
<PackageReference Include="NTG.Adk" Version="1.8.8" />
<PackageVersion Include="NTG.Adk" Version="1.8.8" />
<PackageReference Include="NTG.Adk" />
paket add NTG.Adk --version 1.8.8
#r "nuget: NTG.Adk, 1.8.8"
#:package NTG.Adk@1.8.8
#addin nuget:?package=NTG.Adk&version=1.8.8
#tool nuget:?package=NTG.Adk&version=1.8.8
NTG.Adk - Agent Development Kit for .NET
Production-ready C# implementation of Google's Agent Development Kit with 99% feature parity
NTG.Adk is a complete C# port of Google ADK Python, following strict Abstract Driven Development (A.D.D) V3 architecture principles for enterprise-grade agent systems.
β¨ Key Features
- ποΈ A.D.D V3 Architecture - Five-layer fractal design with zero coupling
- π€ Multi-Agent Orchestration - Sequential, parallel, and loop workflows
- π Session Management - Multi-user with app/user/session state hierarchy
- πΎ Artifact & Memory Services - File storage and long-term agent memory
- βοΈ RunConfig - Configurable limits and streaming (MaxLlmCalls: 500, StreamingMode)
- π‘ Token Streaming - Real-time SSE streaming with partial event detection
- π A2A Protocol - Seamless interoperability with Google Agent ecosystem
- π MCP Protocol - Connect to MCP servers and use their tools (stdio, SSE, HTTP)
- π OpenAPI Toolset - Auto-generate tools from any REST API (JSON/YAML specs)
- π Runner Pattern - Production-ready orchestration with integrated services
- π§© LLM Adapters - Gemini, OpenAI, and OpenAI-compatible endpoints (Ollama, LocalAI, vLLM)
- π οΈ Tool Ecosystem - Function calling, custom tools, and built-in tools (Google Search, Code Execution)
π Status
Version: 1.8.8 Target Framework: .NET 8.0 LTS (supported until Nov 2026) Production Readiness: 100% β Core Feature Parity with Python ADK: 99% β (Retrieval/RAG: 50%) A2A Interoperability: 100% β MCP Protocol Support: 100% β OpenAPI Toolset: 100% β
See docs/STATUS.md for detailed metrics.
β‘ Quick Start
Basic Agent
using NTG.Adk.Implementations.Models;
using NTG.Adk.Operators.Agents;
using NTG.Adk.Operators.Runners;
// Create agent with LLM
var llm = new GeminiLlm("gemini-2.0-flash-exp");
var agent = new LlmAgent(llm, "gemini-2.0-flash-exp")
{
Name = "Assistant",
Instruction = "You are a helpful assistant"
};
// Run with InMemoryRunner
var runner = new InMemoryRunner(agent, appName: "MyApp");
await foreach (var evt in runner.RunAsync("user001", "session001", "Hello!"))
{
if (evt.Content?.Parts != null)
{
foreach (var part in evt.Content.Parts)
{
if (part.Text != null)
Console.WriteLine($"[{evt.Author}] {part.Text}");
}
}
}
OpenAI-Compatible Endpoints (Ollama, LocalAI, vLLM)
using NTG.Adk.Implementations.Models;
using NTG.Adk.Operators.Agents;
using NTG.Adk.Operators.Runners;
// Use Ollama local models
var llm = new OpenAILlm(
modelName: "llama3",
apiKey: "ollama", // Any string works
endpoint: new Uri("http://localhost:11434/v1")
);
var agent = new LlmAgent(llm, "llama3")
{
Name = "LocalAssistant",
Instruction = "You are a helpful assistant running locally"
};
var runner = new InMemoryRunner(agent, appName: "LocalApp");
await foreach (var evt in runner.RunAsync("user001", "session001", "Hello!"))
{
// Handle events
}
Supports: Ollama, LocalAI, vLLM, LM Studio, and any OpenAI-compatible endpoint.
Multi-Agent Workflow
using NTG.Adk.Operators.Workflows;
// Define agents
var validator = new LlmAgent(llm, "gemini-2.0-flash-exp")
{
Name = "Validator",
Instruction = "Validate input data",
OutputKey = "validation"
};
var processor = new LlmAgent(llm, "gemini-2.0-flash-exp")
{
Name = "Processor",
Instruction = "Process validated data",
OutputKey = "result"
};
// Sequential pipeline
var pipeline = new SequentialAgent("DataPipeline", [validator, processor]);
var runner = new InMemoryRunner(pipeline, appName: "PipelineApp");
await foreach (var evt in runner.RunAsync("user001", "session001", "Process this data"))
{
// Handle events
}
A2A Interoperability
using NTG.Adk.Operators.A2A;
// Create ADK agent
var agent = new LlmAgent(llm, "gemini-2.0-flash-exp")
{
Name = "A2AAgent",
Instruction = "Answer questions via A2A protocol"
};
var runner = new InMemoryRunner(agent, appName: "A2AApp");
// Wrap with A2A executor
var a2aExecutor = new A2aAgentExecutor(runner);
// Handle A2A messages
var a2aMessage = new A2A.AgentMessage
{
MessageId = Guid.NewGuid().ToString(),
Role = A2A.MessageRole.User,
Parts = [new A2A.TextPart { Text = "Hello from A2A!" }]
};
await foreach (var a2aEvent in a2aExecutor.ExecuteAsync(
a2aMessage,
taskId: Guid.NewGuid().ToString(),
contextId: "ADK/A2AApp/user001/session001"))
{
// Handle A2A events (TaskStatusUpdateEvent, TaskArtifactUpdateEvent)
}
MCP Protocol Integration
using NTG.Adk.Boundary.Mcp;
using NTG.Adk.Implementations.Mcp;
// Connect to MCP server via stdio
var connectionParams = new StdioConnectionParams
{
Command = "npx",
Arguments = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
};
var mcpToolset = new McpToolset(connectionParams);
// Connect and get tools
await mcpToolset.ConnectAsync();
var tools = await mcpToolset.GetToolsAsync();
// Use MCP tools with agent
var agent = new LlmAgent(llm, "gemini-2.0-flash-exp")
{
Name = "McpAssistant",
Instruction = "You have access to MCP tools",
Tools = tools.ToList()
};
var runner = new InMemoryRunner(agent, appName: "McpApp");
await foreach (var evt in runner.RunAsync("user001", "session001", "List files"))
{
// Handle events
}
OpenAPI Toolset
using NTG.Adk.Implementations.Tools.OpenApi;
using NTG.Adk.Boundary.Tools.Auth;
// Load OpenAPI spec (JSON or YAML)
var openApiSpec = File.ReadAllText("petstore-openapi.json");
// Create toolset from spec
var toolset = new OpenAPIToolset(openApiSpec, "json");
// Optional: Add authentication
var authScheme = new ApiKeyAuthScheme
{
In = "header",
Name = "X-API-Key"
};
var authCredential = new ApiKeyCredential
{
ApiKey = Environment.GetEnvironmentVariable("API_KEY")!
};
toolset = new OpenAPIToolset(openApiSpec, "json", authScheme, authCredential);
// Get all tools from spec
var tools = toolset.GetTools();
// Use with agent
var agent = new LlmAgent(llm, "gemini-2.0-flash-exp")
{
Name = "ApiAgent",
Instruction = "You can interact with the API using these tools",
Tools = tools
};
var runner = new InMemoryRunner(agent, appName: "ApiApp");
await foreach (var evt in runner.RunAsync("user001", "session001", "List all pets"))
{
// Handle events
}
βοΈ Advanced Configuration
RunConfig - Execution Control
Configure agent execution limits and streaming (matches Python ADK):
using NTG.Adk.CoreAbstractions.Agents;
// Default configuration (matches Python ADK defaults)
var runConfig = new RunConfig
{
MaxLlmCalls = 500, // Max LLM calls per invocation (prevents infinite loops)
StreamingMode = StreamingMode.None // No streaming by default
};
var runner = new Runner(agent, "MyApp", sessionService, runConfig: runConfig);
Token Streaming
Enable real-time token-by-token streaming:
// Enable SSE streaming
var runConfig = new RunConfig
{
StreamingMode = StreamingMode.Sse // Server-sent events streaming
};
var runner = new Runner(agent, "MyApp", sessionService, runConfig: runConfig);
await foreach (var evt in runner.RunAsync("user001", "session001", "Hello"))
{
if (evt.Partial)
{
// Streaming chunk - arrives in real-time as tokens are generated
Console.Write(evt.Content?.Parts?.FirstOrDefault()?.Text ?? "");
}
else
{
// Complete response
Console.WriteLine("\n[Complete]");
}
}
Streaming Modes:
StreamingMode.None- Buffer complete response (default, matches Python ADK)StreamingMode.Sse- Server-sent events, token-by-token streamingStreamingMode.Bidi- Bidirectional streaming (reserved for future use)
LLM Call Limits
Prevent infinite loops with configurable limits:
var runConfig = new RunConfig
{
MaxLlmCalls = 100 // Custom limit
};
try
{
await foreach (var evt in runner.RunAsync("user001", "session001", "Complex task"))
{
// Process events
}
}
catch (LlmCallsLimitExceededError ex)
{
Console.WriteLine($"Limit exceeded: {ex.Message}");
// Output: "Max number of LLM calls limit of 100 exceeded"
}
Default: 500 calls per invocation (matches Python ADK)
π Documentation
- Getting Started Guide - Detailed setup and usage
- Architecture - A.D.D V3 five-layer design
- Features - Complete feature list with examples
- Compatibility - Python ADK API mapping
- Status - Current implementation status
- Changelog - Version history
ποΈ Architecture Overview
NTG.Adk follows A.D.D V3 strict five-layer architecture:
NTG.Adk/
βββ Boundary/ # Layer 1: DTOs, Events (no dependencies)
βββ CoreAbstractions/ # Layer 2: Interfaces/Ports (no dependencies)
βββ Implementations/ # Layer 3: Adapters (depends on CoreAbstractions)
βββ Operators/ # Layer 4: Business Logic (depends on CoreAbstractions + Boundary)
βββ Bootstrap/ # Layer 5: Composition Root (depends on all)
Key Principles:
- β Operators call ports (interfaces), never implementations
- β Zero coupling between layers (except explicit dependencies)
- β Dependency inversion at all boundaries
- β Technology-agnostic core abstractions
See docs/ARCHITECTURE.md for details.
π Python ADK Compatibility
NTG.Adk maintains 99% feature parity with Google ADK Python (100% core features):
| Python ADK | C# NTG.Adk | Layer |
|---|---|---|
google.adk.agents.BaseAgent |
IAgent |
Port (CoreAbstractions) |
google.adk.agents.LlmAgent |
LlmAgent |
Operator |
google.adk.runners.Runner |
Runner |
Operator |
google.adk.events.Event |
Event |
Boundary DTO |
google.adk.tools.BaseTool |
ITool |
Port (CoreAbstractions) |
See docs/COMPATIBILITY.md for complete mapping.
π¦ Project Structure
E:\repos\adk-csharp/
βββ src/
β βββ NTG.Adk.Boundary/ # Layer 1: DTOs
β βββ NTG.Adk.CoreAbstractions/ # Layer 2: Ports
β βββ NTG.Adk.Implementations/ # Layer 3: Adapters
β βββ NTG.Adk.Operators/ # Layer 4: Orchestration
β βββ NTG.Adk.Bootstrap/ # Layer 5: DI/Entry
βββ samples/
β βββ HelloWorldAgent/ # Basic agent demo
β βββ GeminiAgent/ # Gemini LLM integration
β βββ OpenAIAgent/ # OpenAI integration
β βββ AutoFlowAgent/ # AutoFlow orchestration
β βββ StoryFlowAgent/ # Multi-agent workflow
β βββ A2AInteropSample/ # A2A protocol demo
β βββ McpToolsSample/ # MCP Protocol integration
β βββ OpenApiToolsSample/ # OpenAPI Toolset demo
β βββ BuiltInToolsSample/ # Built-in tools demo
βββ docs/ # Documentation
βββ README.md # This file
π§ͺ Samples
Explore working examples in the samples/ directory:
- HelloWorldAgent - Simple echo agent with InMemoryRunner
- GeminiAgent - Google Gemini 2.0 Flash integration
- OpenAIAgent - OpenAI GPT-4 integration
- AutoFlowAgent - Dynamic multi-agent routing
- StoryFlowAgent - Sequential story generation workflow
- A2AInteropSample - A2A protocol interoperability
- McpToolsSample - MCP Protocol integration (stdio, SSE, HTTP transports)
- OpenApiToolsSample - OpenAPI Toolset with REST API integration
- BuiltInToolsSample - Built-in tools (Google Search, Code Execution)
Run a sample:
cd samples/HelloWorldAgent
dotnet run
π§ Requirements
- .NET 8.0 LTS (supported until November 2026)
- C# 12 language features
- Visual Studio 2022 or VS Code with C# Dev Kit
π οΈ Build
# Clone repository
git clone <repository-url>
cd adk-csharp
# Restore packages
dotnet restore
# Build solution
dotnet build
# Run tests (if available)
dotnet test
# Run a sample
cd samples/HelloWorldAgent
dotnet run
πΊοΈ Roadmap
Phase 1 - Core Infrastructure β COMPLETE
- β Multi-Agent Orchestration (Sequential, Parallel, Loop)
- β Session/Artifact/Memory Services (In-Memory)
- β A2A Protocol Integration
- β MCP Protocol Support (stdio, SSE, HTTP)
- β OpenAPI Toolset (REST API auto-integration)
- β Built-in Tools (Google Search, Code Execution)
- β LLM Adapters (Gemini, OpenAI)
- β .NET 8.0 LTS Migration
Phase 2 - Persistent Storage (In Progress)
- β³ DatabaseSessionService - SQL persistence for sessions
- PostgreSQL, MySQL, SQLite support
- Production-ready session storage
- Multi-instance deployment support
- β³ FileArtifactService - Local file system storage
- File-based artifact persistence
- Blob storage support (Azure, AWS S3, GCP)
- Artifact versioning and cleanup
Phase 3 - Advanced Features (Planned)
- π Planner System - Agent reasoning and planning
- BuiltInPlanner with extended thinking
- PlanReActPlanner for ReAct pattern
- Custom planner support
- π FilesRetrieval - RAG and document search
- Directory-based retrieval
- Semantic search capabilities
- LlamaIndex integration
- π AgentEvaluator - Testing and quality assurance
- Automated agent testing
- Benchmark framework
- Performance metrics
Phase 4 - Cloud Integration (Future)
- π Cloud Storage Services
- GCS Artifact Service (Google Cloud Storage)
- Azure Blob Artifact Service
- AWS S3 Artifact Service
- π Vertex AI Integration
- Vertex AI RAG Retrieval
- Vertex AI Search Tool
- Vertex AI Example Store
- π Enterprise Features
- Authentication & Authorization
- Rate limiting and quotas
- Audit logging and monitoring
Community Contributions Welcome! π€
We welcome contributions for:
- New LLM adapters (Anthropic Claude, Cohere, etc.)
- Additional built-in tools
- Cloud provider integrations
- Performance optimizations
- Documentation improvements
See CONTRIBUTING.md for guidelines.
π Version Update Checklist
When bumping version, update these files:
README.md- Version field in Status sectiondocs/CHANGELOG.md- Add new version entrydocs/FEATURES.md- Version + Last Updateddocs/STATUS.md- Version + Last Updatedllms-full.txt- Version (line 12) + VERSION INFORMATION sectionsrc/NTG.Adk.*/NTG.Adk.*.csproj- All 4 package Version properties
π License
Apache 2.0 License - see LICENSE file.
π Credits
- Based on Google ADK Python
- Architecture: Abstract Driven Development (A.D.D) V3
- A2A Protocol: a2a-dotnet SDK
Built with Abstract Driven Development (A.D.D) V3 π
| Product | Versions 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 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.10)
- Microsoft.Extensions.Logging (>= 9.0.10)
- NTG.Adk.Boundary (>= 1.8.8)
- NTG.Adk.CoreAbstractions (>= 1.8.8)
- NTG.Adk.Implementations (>= 1.8.8)
- NTG.Adk.Operators (>= 1.8.8)
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 |
|---|---|---|
| 1.8.8 | 248 | 12/19/2025 |
| 1.8.7 | 289 | 12/8/2025 |
| 1.8.6 | 165 | 12/5/2025 |
| 1.8.5 | 182 | 12/5/2025 |
| 1.8.4 | 184 | 11/24/2025 |
| 1.8.3 | 399 | 11/20/2025 |
| 1.8.2 | 395 | 11/18/2025 |
| 1.8.1 | 396 | 11/18/2025 |
| 1.8.0 | 391 | 11/17/2025 |
| 1.7.0 | 270 | 11/12/2025 |
| 1.6.3 | 279 | 11/11/2025 |
| 1.6.2-alpha | 158 | 11/2/2025 |
| 1.6.1-alpha | 154 | 11/2/2025 |
| 1.6.0-alpha | 177 | 10/28/2025 |
| 1.5.6-alpha | 179 | 10/27/2025 |
| 1.5.5-alpha | 159 | 10/26/2025 |
| 1.5.4-alpha | 132 | 10/26/2025 |
| 1.5.3-alpha | 130 | 10/26/2025 |
| 1.5.2-alpha | 131 | 10/26/2025 |
| 1.5.1-alpha | 136 | 10/26/2025 |
| 1.5.0-alpha | 130 | 10/26/2025 |