VoyageAI.AgentFramework 1.0.1

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

VoyageAI.AgentFramework

Microsoft Agent Framework integration for the Voyage AI .NET SDK.

Composes a search stage (IVoyageRagSearcher<T>) with the Voyage reranker (IVoyageReranker) and hands the result to the Agent Framework's TextSearchProvider, so you get two-stage retrieval (vector search → rerank) on any agent with a few lines of wiring.

Why

The Agent Framework's TextSearchProvider is sealed and takes a single Func<string, CancellationToken, Task<IEnumerable<TextSearchResult>>> delegate in its constructor. Building that delegate by hand — embed the query, run a vector search, score candidates with the reranker, map indices back to records, project to TextSearchResult — is ~80 lines of orchestration that gets copy-pasted into every RAG sample.

This package factors that into a search/rerank split: you implement only the transport-specific search (MongoDB, pgvector, Redis, Qdrant, …), and the package handles the rerank composition and the three framework wiring paths.

Install

dotnet add package VoyageAI.AgentFramework

References VoyageAI.Sdk, Microsoft.Agents.AI, and Microsoft.Agents.AI.Abstractions (1.10.0).

Quick start

using VoyageAI;

// 1. Implement the search stage (transport-specific — this one knows about MongoDB).
//    Lives in your app, not in this package.
public sealed class MongoSearcher : IVoyageRagSearcher<KBDocument> { ... }

var searcher = new MongoSearcher(mongoCollection, queryEmbedder, limit: 10);

// 2. Build a reranker from the Voyage SDK client.
var reranker = new VoyageReranker(rerankClient, new VoyageRerankerOptions { TopK = 3 });

// 3. Wire RAG into your agent — pick one of the three paths:

ChatClientAgentOptions (mutator)

AIAgent agent = chatClient.AsAIAgent(new ChatClientAgentOptions
{
    ChatOptions = new() { Instructions = "Answer using the provided context; cite sources." }
}.UseVoyageRag(searcher, reranker, o => o.RerankerOptions.TopK = 3));

AIAgentBuilder (pipeline)

AIAgent agent = chatClient.AsAIAgent()
    .UseVoyageRag(searcher, reranker, o => o.RerankerOptions.TopK = 3);

ChatClientBuilder (MEAI pipeline)

ChatClientBuilder builder = new(openAiClient)
    .UseVoyageRag(searcher, reranker);

Dependency injection

// Registers IVoyageReranker as a singleton. AddVoyageAI must already be registered so
// IRerankClient can be resolved.
builder.Services.AddVoyageAI(o => o.ApiKey = apiKey);
builder.Services.AddVoyageReranker(o => o.Model = VoyageAIModels.Rerank2);

Skipping reranking

Pass reranker: null to use the searcher's ordering as-is (single-stage retrieval):

chatClient.AsAIAgent().UseVoyageRag(searcher, reranker: null);

Result mapping

By default the provider builds TextSearchResult entries with Text always set, plus SourceName/SourceLink populated if your record type implements IVoyageSearchResultMetadata, and RawRepresentation set to the record.

For record types that don't fit that shape, supply a custom mapper. The mapper receives a strongly-typed candidate — no cast, no per-candidate wrapper allocation:

.UseVoyageRag(searcher, reranker, o => o.ResultMapper = c => new()
{
    Text = c.Text,
    SourceName = c.Record.Title
});

Or skip a searcher class entirely with the ad-hoc delegate factory:

var provider = VoyageRagContextProvider.Create<KBDocument>(
    (query, ct) => SearchAsync(query, ct),
    reranker);

Design notes

  • Does not subclass TextSearchProvider — it's sealed; we compose with it.
  • No transport dependency — the package references only the Voyage SDK and Agent Framework abstractions. MongoDB/pgvector/Redis live in your app.
  • Reranking is optional — reranker: null preserves the searcher's order.
  • RerankerOptions is non-nullable — defaults to new() so consumers never need !.
Product 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 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.

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.1 182 6/21/2026
1.0.0 118 6/21/2026