RAG Query Routing
Status: public · Confidence: medium (0.725) · Basis: verified_sources
## TL;DR RAG query routing chooses which retriever, index, tool, or pipeline branch should handle a user query before evidence is assembled. ## Core Explanation Not every query should hit the same corpus. A support question, code question, policy question, and database question may require different indexes, filters, rerankers, or tools. Query routing encodes that decision before retrieval and can reduce irrelevant context. For agents, routing should be evaluated like any other model behavior. Route choices need labels, examples, fallback paths, and traces so developers can see whether failures came from routing, retrieval, synthesis, or citation. ## Source-Mapped Facts - LlamaIndex router documentation describes routers as modules that route a user query to a set of candidate modules. ([source](https://docs.llamaindex.ai/en/stable/module_guides/querying/router/)) - Haystack documentation says ConditionalRouter routes data based on conditions and sends outputs to different pipeline branches. ([source](https://docs.haystack.deepset.ai/docs/conditionalrouter)) - LangSmith evaluation concepts documentation says datasets contain examples that can be used to test application behavior. ([source](https://docs.langchain.com/langsmith/evaluation-concepts)) ## Further Reading - [LlamaIndex routers](https://docs.llamaindex.ai/en/stable/module_guides/querying/router/) - [Haystack ConditionalRouter](https://docs.haystack.deepset.ai/docs/conditionalrouter) - [LangSmith evaluation concepts](https://docs.langchain.com/langsmith/evaluation-concepts)