AgenticRAG.NET
1.0.0
dotnet add package AgenticRAG.NET --version 1.0.0
NuGet\Install-Package AgenticRAG.NET -Version 1.0.0
<PackageReference Include="AgenticRAG.NET" Version="1.0.0" />
<PackageVersion Include="AgenticRAG.NET" Version="1.0.0" />
<PackageReference Include="AgenticRAG.NET" />
paket add AgenticRAG.NET --version 1.0.0
#r "nuget: AgenticRAG.NET, 1.0.0"
#:package AgenticRAG.NET@1.0.0
#addin nuget:?package=AgenticRAG.NET&version=1.0.0
#tool nuget:?package=AgenticRAG.NET&version=1.0.0
AgenticRAG.NET
AgenticRAG.NET is a cutting-edge .NET framework that brings state-of-the-art Agentic Retrieval-Augmented Generation (RAG) capabilities to the .NET ecosystem. Unlike traditional RAG systems, AgenticRAG.NET enables intelligent agents that can plan, reason, reflect, and dynamically adapt their retrieval and response strategies.
Created by AgiCodes - Sajjad | ๐ง asajjad308@gmail.com | โ Buy Me a Coffee
๐ง What is Agentic RAG?
Agentic RAG represents the next evolution of retrieval-augmented systems, combining:
- Dynamic Retrieval: Agents decide what to retrieve, when to stop, and how to refine their search
- Multi-step Reasoning: Complex queries are broken down into logical steps
- Tool Integration: Seamless use of external tools (calculators, web search, APIs)
- Self-Reflection: Agents evaluate and improve their own responses
- Memory & Context: Persistent memory across conversations and sessions
๐ Key Features
Core Capabilities
- Intelligent Planning: Agents create and execute multi-step plans for complex queries
- Dynamic Retrieval: Multiple retriever types (vector, keyword, API) with context-aware selection
- Tool Ecosystem: Pluggable tool system with built-in utilities and easy extensibility
- Reflection Engine: Self-evaluation and response improvement capabilities
- Memory Management: Multiple storage backends (in-memory, Redis, SQLite)
- Explainable AI: Complete reasoning traces for transparency and debugging
Built-in Components
- Retrievers: Vector similarity, keyword search, API-based retrieval
- Tools: Web search, calculator, summarizer, and more
- Memory Stores: In-memory, Redis, and SQLite implementations
- LLM Adapters: Support for OpenAI, Azure OpenAI, Ollama, and local models
๐ฆ Package Structure
| Package | Description |
|---|---|
AgenticRAG.Core |
Core abstractions and orchestration |
AgenticRAG.Retrievers |
Built-in retrievers (vector, keyword, API) |
AgenticRAG.Tools |
Built-in tools (search, calculator, summarizer) |
AgenticRAG.Memory |
Memory providers (Redis, SQLite, in-memory) |
AgenticRAG.UI |
Blazor dashboard for monitoring (coming soon) |
๐ Quick Start
Installation
dotnet add package AgenticRAG.Core
dotnet add package AgenticRAG.Retrievers
dotnet add package AgenticRAG.Tools
dotnet add package AgenticRAG.Memory
Basic Usage
using AgenticRAG.Core.Builders;
using AgenticRAG.Core.Interfaces;
using AgenticRAG.Memory;
using AgenticRAG.Retrievers;
using AgenticRAG.Tools;
// Create a RAG agent
var agent = new RagAgentBuilder()
.UseModel(new OpenAIChatModel("gpt-4o", apiKey))
.UseRetriever("VectorRetriever", new QdrantRetriever(apiKey))
.UseTool(new WebSearchTool(httpClient, options))
.UseTool(new CalculatorTool())
.UseMemoryStore(new RedisMemoryStore(database))
.UseReflectionEngine()
.Build();
// Ask a question
var response = await agent.AskAsync("What are the latest developments in quantum computing?");
Console.WriteLine($"Answer: {response.Content}");
Console.WriteLine($"Confidence: {response.ConfidenceScore:F2}");
Console.WriteLine($"Retrieved Documents: {response.RetrievedDocuments.Count}");
Advanced Configuration
var agent = new RagAgentBuilder()
.UseModel(chatModel)
.UseRetriever("VectorRetriever", vectorRetriever)
.UseRetriever("KeywordRetriever", keywordRetriever)
.UseRetriever("ApiRetriever", apiRetriever)
.UseTool(webSearchTool)
.UseTool(calculatorTool)
.UseTool(customTool)
.UseMemoryStore(memoryStore)
.UseReflectionEngine()
.WithOptions(new RagAgentOptions(
EnableReflection: true,
MaxRetrievalSteps: 5,
MaxToolExecutions: 3,
ResponseTemperature: 0.7,
MaxResponseTokens: 2000,
MinConfidenceThreshold: 0.6))
.Build();
๐งฉ Architecture
User Query
โ
[Agent Controller]
โ (plans approach)
[Tool Manager] โโ [Retriever Manager]
โ (retrieves context)
[Reflection Engine] โโ [LLM/Completion Model]
โ
Final Answer + Reasoning Trace
Core Components
- AgentController: Orchestrates the reasoning loop (Plan โ Retrieve โ Generate โ Reflect โ Act)
- RetrieverManager: Manages multiple retrievers and selects appropriate ones
- ToolManager: Handles tool registration and execution
- ReflectionEngine: Evaluates response quality and suggests improvements
- MemoryStore: Persists conversations, queries, and retrieved documents
๐ง Customization
Creating Custom Retrievers
public class CustomRetriever : IRetriever
{
public string Name => "CustomRetriever";
public async Task<IReadOnlyList<RetrievedDocument>> RetrieveAsync(
string query,
RetrievalOptions? options = null,
CancellationToken cancellationToken = default)
{
// Your custom retrieval logic
return retrievedDocuments;
}
}
Creating Custom Tools
public class CustomTool : IAgentTool
{
public string Name => "CustomTool";
public string Description => "Description of what this tool does";
public JsonElement InputSchema => JsonSerializer.SerializeToElement(new
{
type = "object",
properties = new
{
input = new { type = "string", description = "Input parameter" }
},
required = new[] { "input" }
});
public async Task<ToolResult> ExecuteAsync(
JsonElement input,
CancellationToken cancellationToken = default)
{
// Your custom tool logic
return new ToolResult(true, result);
}
}
Custom Memory Stores
public class CustomMemoryStore : IMemoryStore
{
// Implement IMemoryStore interface
// with your custom storage backend
}
๐ Example Scenarios
1. Research and Analysis
var response = await agent.AskAsync(
"Research the current state of renewable energy and calculate the potential cost savings for a household");
2. Mathematical Problem Solving
var response = await agent.AskAsync(
"Calculate the compound interest for $10,000 invested at 5% for 10 years, then summarize the key financial concepts");
3. Multi-step Information Gathering
var response = await agent.AskAsync(
"Find the latest AI safety research papers, summarize the key findings, and identify the most important recommendations");
๐ Reasoning and Transparency
AgenticRAG.NET provides complete transparency into the agent's reasoning process:
var response = await agent.AskAsync("Your question here");
// Access the complete reasoning trace
foreach (var step in response.ReasoningTrace)
{
Console.WriteLine($"{step.StepType}: {step.Description}");
Console.WriteLine($"Input: {step.Input}");
Console.WriteLine($"Output: {step.Output}");
Console.WriteLine($"Timestamp: {step.Timestamp}");
}
๐ Performance and Scalability
- Async/Await: Full async support for high-performance scenarios
- Caching: Built-in caching for retrieved documents and responses
- Memory Management: Efficient memory usage with configurable retention policies
- Concurrent Processing: Support for concurrent agent operations
- Resource Pooling: Connection pooling for external services
๐ Security and Privacy
- Input Sanitization: Automatic sanitization of user inputs
- Tool Security: Safe execution environment for custom tools
- Data Encryption: Support for encrypted storage backends
- Access Control: Configurable access controls for different components
๐งช Testing
[Test]
public async Task Agent_Should_Handle_Complex_Query()
{
// Arrange
var agent = CreateTestAgent();
// Act
var response = await agent.AskAsync("Complex query here");
// Assert
Assert.That(response.ConfidenceScore, Is.GreaterThan(0.7));
Assert.That(response.RetrievedDocuments, Is.Not.Empty);
Assert.That(response.ReasoningTrace, Is.Not.Empty);
}
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
- Clone the repository
- Install .NET 9.0 SDK
- Run
dotnet restore - Run
dotnet build - Run
dotnet test
๐ Roadmap
- v1.1: Blazor UI Dashboard
- v1.2: Advanced Vector Stores (Pinecone, Weaviate)
- v1.3: Multi-Agent Collaboration
- v1.4: Knowledge Graph Integration
- v1.5: Advanced Reflection Strategies
- v2.0: Production-Ready Enterprise Features
๐ Documentation
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
๐ Support the Project
Created by AgiCodes - Sajjad
If you find AgenticRAG.NET useful, please consider supporting the project:
- โ Buy Me a Coffee - Support ongoing development
- ๐ง Email: asajjad308@gmail.com - Direct contact for questions
- โญ Star the Repository - Help others discover the project
- ๐ Report Issues - Help improve the framework
- ๐ก Suggest Features - Contribute to the roadmap
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Inspired by research in Agentic RAG and multi-agent systems
- Built on top of the .NET ecosystem and Microsoft's Semantic Kernel
- Community feedback and contributions
AgenticRAG.NET - Bringing the future of intelligent retrieval to .NET developers. ๐
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- AgenticRAG.Core (>= 1.0.0)
- AgenticRAG.Memory (>= 1.0.0)
- AgenticRAG.Retrievers (>= 1.0.0)
- AgenticRAG.Tools (>= 1.0.0)
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.0.0 | 216 | 10/9/2025 |
Initial release of AgenticRAG.NET - Complete intelligent RAG framework with planning, reflection, and tool integration