AgenticRAG.NET 1.0.0

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

AgenticRAG.NET

NuGet Version License: MIT .NET 9.0 Buy Me a Coffee

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

  1. AgentController: Orchestrates the reasoning loop (Plan โ†’ Retrieve โ†’ Generate โ†’ Reflect โ†’ Act)
  2. RetrieverManager: Manages multiple retrievers and selects appropriate ones
  3. ToolManager: Handles tool registration and execution
  4. ReflectionEngine: Evaluates response quality and suggests improvements
  5. 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

  1. Clone the repository
  2. Install .NET 9.0 SDK
  3. Run dotnet restore
  4. Run dotnet build
  5. 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

๐Ÿ’ 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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