# Agentic RAG: Multi-hop questions should not go through a fixed pipeline

Date: 2026-02-24
Category: Technology
Tags: Agents, Retrieval Augmentation, Architecture
Summary: Fixed pipelines cannot answer multi-hop questions. This article breaks down query decomposition, iterative retrieval, evidence ledgers, self-correction, and routing, and offers engineering practices for budgets and stopping conditions

Someone once asked: "Compare the differences in the reranking strategies between v2 and v3, then find the discussion record from when the redesign decision was made."

This is not a question that a single retrieval pass can answer well. First you have to confirm what v2 and v3 each refer to, find material on both sides, judge whether the evidence is sufficient, then use the new clue—"discussion record"—to run a second round.

The chain built across the first eleven posts is a hard-coded pipeline: rewrite, recall, fuse, rerank, construct, generate, run once per request, with globally consistent parameters. It is very stable for "ask a fact, answer with a piece of material," and its cost is predictable. But a pipeline has no second round, and no judgment node for "is the evidence sufficient." When the opening question comes in, the chain can only hand the whole compound question to recall, then hope the generation stage fills in the rest itself.

> Post 12/15 of this series · [Previous: RAG evaluation: no test set, no optimization](/2026/01/01/rag-evaluation-metrics-and-testset/) · [Next: Read, write, and forgetting in agent memory systems](/2026/02/25/agent-memory-read-write-and-forgetting/)

## Wrapping RAG as a tool changes more than the interface

When post 3 broke tool calling down into a protocol, it left a hook: one of the most common tools is "retrieve from the knowledge base." Wrapping the entire RAG chain as a tool lets the agent-side interface stay thin. The tool needs only three parameters: `query` is an independent, complete, separately retrievable sub-question; `scope` selects among handbook, changelog, tickets, all; `top_k` is limited to 3–20. The tool description must state clearly that it suits questions needing factual grounding, and does not suit computation, format conversion, or chit-chat.

The change is not just "one more function." The most direct one is that the number of retrievals goes from fixed to model-decided: 0 times, no external knowledge needed; 1 time, an ordinary factual question; N times, multi-hop, comparison, or questions needing verification. The query also changes from the user's original words to a sub-question constructed by the model. The line in the tool description—"an independent, complete sub-question"—is a hard requirement; if the model passes the whole compound question in verbatim, recall will be poor. Retrieval results then change from an endpoint into an observation, returning to the loop as input for the next decision rather than being spliced directly into the answer.

This architecture—registering retrieval as a tool and letting the agent decide how many times to query—is usually called Agentic RAG. Retrieval is no longer a fixed segment in the pipeline, but an action the agent can call repeatedly.

## Several approaches to query decomposition

Multi-query rewrites one query into 3–5 variants from different angles, recalls them in parallel, then merges and deduplicates. It mainly addresses wording sensitivity; cost is low and implementation is simple. The drawback is obvious: still only one round, and it does not handle dependencies.

Step-back prompting first generates a more abstract question, such as "what factors are generally considered in this kind of redesign," and recalls abstract-level material together with concrete-level material. It helps with questions that need background knowledge to understand specific clauses.

HyDE first has the model write a "hypothetical answer" from impression, then uses the vector of that hypothetical answer to retrieve, rather than the original query vector. The idea is to align the query side and the document side in style. It sometimes works on short queries, and the risk is very clear: details the model fabricates will steer retrieval off course. So I use it only when the original query is extremely short and explicitly requires recalling conceptual material, and never for precise-identifier queries.

Sub-question decomposition is the core of multi-hop. It splits a compound question into a sequence of sub-questions with dependencies, where the result of a previous one may become a parameter of the next. This also connects to the planning layer in post 2: that plan with `depends_on` has, here, each step as one retrieval action.

The opening question would roughly split into three steps: first look up v2's reranking strategy, then look up v3's reranking strategy, finally use the version identifiers obtained from the first two steps to find the redesign discussion record in tickets. The third step's parameters depend on the outputs of the first two—exactly the usage of explicit references in post 2's `$sN.field`. Having the model remember "that identifier from earlier" itself and fill it into the parameter is far more reliable than having it verbally declare a dependency.

## The iteration loop: ledger, gaps, and stopping conditions

A usable loop is not complicated; what is hard is a few design points. The skeleton is roughly this:

```python
def agentic_retrieve(question, budget):
    state = EvidenceLedger(question=question, claims=[], gaps=[])
    for step in range(budget.max_retrieval_rounds):
        decision = model.decide(
            system=ROUTER_PROMPT,
            context=state.view(),
            tools=[search_knowledge, calc, finish],
        )
        if decision.type == 'finish':
            return state
        if decision.type == 'search':
            hits = search_knowledge(decision.args)
            state.add(hits, provenance=decision.args)
            state.gaps = find_gaps(question, state)
        budget.consume(decision)
        if budget.exhausted() or no_new_evidence(state, lookback=2):
            return state.partial(reason='budget_or_plateau')
    return state.partial(reason='round_limit')
```

First look at the evidence ledger (EvidenceLedger). It is not message history. Each piece of evidence must record `chunk_id`, source, date, which sub-question it supports, and whether it conflicts with other evidence. The citation validation from post 10 can be done early here: only material registered in the ledger is allowed into the final context. The most common problem in multi-round retrieval is that the model mixes what it saw in round 1 with what it saw in round 3, and all sources are lost. The ledger is what prevents this.

Gaps must also be made explicit. `find_gaps` writes "what is still missing" as a structured list, which is more reliable than letting the model feel in the conversation that it is "about enough." It can be a rule, such as which items in the sub-question list are not yet marked complete; or it can be a model judgment. Either way, it must end up as checkable data.

Stopping conditions must include both a cap and plateau detection. `max_retrieval_rounds` I usually set 3–5, plus a total token budget, a total wall-clock timeout, and "stop when two consecutive rounds bring no new evidence." Without plateau detection, the model will keep retrieving with the same slightly reworded question. Every round in the log is querying, and not a single piece of evidence is added.

Retrieval ending does not mean you can answer arbitrarily. The ledger snapshot at `finish` must be handed to the context construction layer from post 10, which orchestrates, wraps, and adds citation requirements. If the ledger contains uncovered gaps, the instruction must explicitly say "state that material is insufficient for the following questions," rather than letting the model fill in the blanks.

## Correction: results that should be dropped must actually be dropped

What Self-RAG, CRAG, and similar approaches share is: before or during generation, add a quality judgment on retrieval results, then decide the action accordingly. In engineering I reduce it to three tiers:

- correct: the evidence directly supports the answer; proceed to generation.
- ambiguous: partially relevant; rewrite the query, change scope, or add a retrieval round.
- incorrect: entirely irrelevant; discard this round's results, switch retrieval channel or rewrite strategy.

Base the judgment on observable signals as much as possible, rather than having the model score and say "relevance 0.6." You can look at the score gap between the top1 candidate and the median, whether the key entities of the query appear in the hit snippets, and whether different rewrites of the same sub-question recall the same batch of documents. High consistency means stability; low consistency means the query is not pinned down. Also check whether `scope` chose wrong—for example, the changelog store simply has no tickets-type content.

The `incorrect` tier has an easily overlooked action: discard. Many implementations leave unqualified retrieval results in the context "for reference," and the model will still use them to fabricate answers. Correction must actually delete, including removing from the ledger.

Here's another cheap but effective trick: make the "retrieval sufficiency" judgment at the stage where you only look at material titles and abstracts. The two-stage approach to refusal discussed in Post 10 applies here as well. Deciding whether to keep searching by first looking at the table of contents saves far more than reading all the chunks before judging.

## Routing: not every question deserves retrieval

The easiest place for Agentic RAG to go to waste is running the full pipeline on every question. I put a thin routing layer in front of the loop that judges only three things: whether to retrieve, which store to retrieve from, and whether to use another tool.

Whether to retrieve depends on question type. Chitchat, format conversion, pure computation, and cases where the context already contains the material—answer directly. Which store to retrieve from, `scope`, is chosen by rules or a model. Picking the wrong store is the real cause of many "can't find it" cases, more common than badly tuned parameters. Whether to use another tool depends on question type. Structured statistical questions, like "how many tickets in the past three months," should go through SQL or an API, not retrieve a few passages of text and have the model count them.

The routing decision itself should not call another large model. Keyword rules plus a small few-shot model are enough, and the latency and cost saved are substantial. As Post 3 said, unconditional rewriting washes out exact literal cues, and routing is the same: queries containing error codes or IDs skip rewriting entirely and go into the sparse-first channel.

## Benefits, costs, and when not to use it

The benefits are concrete. It handles multi-hop, comparison, and questions that need verification and follow-up retrieval; retrieval count and budget are allocated by difficulty, so simple questions actually get cheaper; every round's query, material, and judgment are in the trace, giving better explainability than a fixed pipeline; and when one retrieval channel fails, the agent can switch `scope` or switch tools instead of failing the whole request.

The costs are just as real. Multiple model calls and multiple retrievals turn latency from one pass into several, and the long tail looks bad. Cost variance grows—simple and complex questions through the same entry point can differ by an order of magnitude. Failure modes multiply: bad decomposition, bad routing, bad gap judgment, infinite loops, inconsistency between recorded evidence and the final context. Evaluation gets harder too: beyond the layered metrics from Post 11, you need "retrieval-round distribution," "platform hit rate," and "cost per answer."

Some scenarios shouldn't use it at all. When the query distribution is mostly single-hop factual questions, the latency budget is strict, or costs must be predictable—such as per-call billed products—a fixed pipeline is more stable, cheaper, and easier to evaluate. My actual practice is hybrid: default to the fixed pipeline, and only escalate to the Agentic loop when routing classifies the question as "multiple sub-questions, comparison, or needs verification," with its own budget cap and fallback path. Don't replace everything just because the architecture is more "advanced."

Multi-round retrieval keeps writing into the record, and on long tasks this evidence quickly fills the window. What should stay in context, what should be externalized, and when to compress or forget is the topic of the next post. With your current retrieval tool, when one round fails to find evidence, do you keep trying different searches, or do you just stuff irrelevant material into the answer?
