Table of Contents

Class AgenticRagExtensions

Namespace
Mythosia.AI.Rag
Assembly
Mythosia.AI.Rag.dll

Extension methods for enabling Agentic RAG on AIService. Registers the RAG pipeline as a callable tool within the agent's ReAct loop.

public static class AgenticRagExtensions
Inheritance
AgenticRagExtensions
Inherited Members

Methods

WithAgenticRagTracing<TService>(TService, Action<AgenticRagSearchTrace>, string)

Registers a structured trace observer for Agentic RAG tool executions.

public static TService WithAgenticRagTracing<TService>(this TService service, Action<AgenticRagSearchTrace> onTrace, string toolName = "search_documents") where TService : IAIService, IFunctionRegisterable

Parameters

service TService
onTrace Action<AgenticRagSearchTrace>
toolName string

Returns

TService

Type Parameters

TService

WithAgenticRag<TService>(TService, RagStore, Func<AgenticRagQueryContext, RagQueryOptions?>, string, string?)

Registers the RAG pipeline as a search tool for use with RunAgentAsync with per-tool-call query overrides.

public static TService WithAgenticRag<TService>(this TService service, RagStore ragStore, Func<AgenticRagQueryContext, RagQueryOptions?> queryOptions, string toolName = "search_documents", string? toolDescription = null) where TService : IAIService, IFunctionRegisterable

Parameters

service TService
ragStore RagStore
queryOptions Func<AgenticRagQueryContext, RagQueryOptions>
toolName string
toolDescription string

Returns

TService

Type Parameters

TService

WithAgenticRag<TService>(TService, RagStore, string, string?)

Registers the RAG pipeline as a search tool for use with RunAgentAsync.

In Agentic RAG mode the agent autonomously decides when to search and what query to use. The RagStore's QueryRewriter is intentionally bypassed for this tool because the agent itself is responsible for formulating a clear, self-contained query.

The configured retrieval strategy (vector-only or hybrid) and pipeline options of the RagStore are respected as-is.

public static TService WithAgenticRag<TService>(this TService service, RagStore ragStore, string toolName = "search_documents", string? toolDescription = null) where TService : IAIService, IFunctionRegisterable

Parameters

service TService
ragStore RagStore
toolName string
toolDescription string

Returns

TService

Type Parameters

TService