Slower, pricier, right: agent loops on multi-hop questions
On this page
TL;DR
Multi-hop questions need a chain of lookups. Each hop's answer contains findings that inform the next hop's question.
For example, this 3-hop question from the MuSiQue dev set:
Where do Greyhound buses leave from in the city where the band that recorded the album I'm Alive and on Fire formed?
Hop 1 Which band recorded I'm Alive and on Fire? → Danko Jones
Hop 2 In which city was Danko Jones formed? → Toronto
Hop 3 Where do Greyhound buses leave from in Toronto? → Toronto Coach Terminal
The question never names Danko Jones or Toronto, so no single search for it finds the paragraph about Toronto's bus terminal. Each hop has to be answered before the next can be searched.


The tradeoff: deciding after every result buys correctness on long chains with latency and tokens. On the held-out set Agent Loop matches the ceiling, the score the model gets when handed the right paragraphs. On the dev set it closes most of that gap.
Problem
Multi-hop question answering: each question takes a chain of 2 to 4 lookups, and each hop's answer is what the next hop searches for, as in the Danko Jones example above. A runtime gets only the question and a search over a corpus of Wikipedia paragraphs. It has to find every hop's evidence and answer with citations to the paragraphs it used.
Solution
Set up evaluation dataset and corpus
I used the MuSiQue dataset as it is built such that the hops cannot be skipped. Each question is composed from single-hop questions that depend on each other, and questions a model could answer by skipping a hop were filtered out (Trivedi et al., 2022).
The last post's eval used HotpotQA questions inside KILT. Only 6/15 were multi-hop in the sense that matters here, where a later search needs an entity or finding found earlier. MuSiQue guarantees that dependency, covers 2, 3 and 4 hops, and has a corpus that can be rebuilt exactly as published work did, so results stay comparable.

- Corpus: IRCoT's open-domain construction: every supporting and distractor paragraph of every train, dev and test question in both MuSiQue releases, deduplicated (corpus.py; the question sets are sampled by main.py: musique-v1, musique-v1-heldout). That gives 139,408 paragraphs in 114,719 articles; IRCoT reports 139,416. Trivedi et al. 2023, Interleaving Retrieval with Chain-of-Thought Reasoning for Knowledge-Intensive Multi-Step Questions, ACL 2023, Appendix A, doi:10.18653/v1/2023.acl-long.557.
- Checks: every gold paragraph of all 120 questions was found in the Elasticsearch index.
- License: MuSiQue v1.0 is CC BY 4.0.
Make runtimes configurable

Every runtime runs inside the same harness. The eval workflow loads the questions, sends each one to the chosen runtime, and judges the answer. Search, the model, the judge and tracing are shared, so between runs only the runtime changes.
Code: the MCP server starts the eval workflow, whose activities pick the runtime and judge each answer. Each runtime is a workflow in apps/agent/runtimes.
Runtime alternatives
Ceiling
The ceiling for this model. There is no search: the model gets exactly the gold paragraphs MuSiQue lists for the question and only has to synthesize them into an answer. Its misses are reasoning, not retrieval. Code: oracle_runtime.py.
Pipeline
The floor, and the production answer path from the last post. One search with the question as written, then one answer call over the best 12 paragraphs (up to 5,000 tokens). Nothing happens between the search and the answer, so whatever the first search misses stays missed. Code: pipeline_runtime.py.
Plan-Execute

The planner commits to the whole chain before it sees a single result. When a hop's answer abstains, every call after it is skipped. Code: plan_execute_runtime.py (the workflow) and planning.py (the planner's prompt, plan validation and repair).
Agent Loop

Each turn is one model call that returns a thought, its findings so far (each hop with the paragraph labels that support it), and one tool. The model sees the entire transcript (system, user, assistant messages) so that it can output an informed decision for the next turn.
A search turn takes 1 to 3 rewrites of the same lookup. Each rewrite's paragraphs are ranked by BM25, and reciprocal rank fusion combines the rankings, so a paragraph that several rewrites rank high rises. The model gets back the top 5 paragraphs it has not seen yet.

Code: agent_loop_runtime.py (the workflow, lifecycle states and limits) and agent_loop.py (prompts, response schemas and RRF fusion).
Limits that make a turn answer-only, checked in this order:
- Maximum turns reached (default: 8)
- Run deadline reached: not enough time left for this turn and an answer turn after it (default: 18 minutes per question)
- Maximum tokens in transcript reached (default: 16000)
- Maximum dollar amount per question reached, keeping enough for an answer turn
An answer-only turn also gets a response schema without search, so the model cannot ignore the limit.
Results


On the 60 held-out questions, Agent Loop answers 40 right (67%), the same as the ceiling runtime, against 15 for Plan-Execute and 6 for the pipeline. It gets there by answering almost everything: 18 wrong and 2 abstained, against 5 wrong and 15 abstained for the ceiling. When it answers, it is right 69% of the time, against 89% for the ceiling. It also uses 17.7k prompt tokens per question, against 6.4k for Plan-Execute, about 2.8×.
Plan-Execute fell from 40% on the dev set to 25%.
| Runtime | Change | Turn limit | Transcript limit | Dev set | Held-out set |
|---|---|---|---|---|---|
| Pipeline | one search | none | none | 18%, 8.7 s, 1 turn, 2.4k tokens (answer-baseline-ircot-no-verifier-001) | 10%, 12.8 s, 1 turn, 2.4k tokens (heldout-pipeline-001) |
| Ceiling | gold paragraphs, no search | none | none | 73%, 6.9 s, 1 turn, 0.9k tokens (answer-oracle-ircot-no-verifier-001) | 67%, 11.4 s, 1 turn, 0.8k tokens (heldout-oracle-001) |
| Plan-Execute | plan fixes | none | none | 30%, 25.9 s, 3.1 turns, 5.4k tokens (plan-execute-002) | not run |
| Plan-Execute | + plan repair turn | none | none | 33%, 28.0 s, 3.6 turns, 6.4k tokens (plan-execute-003) | not run |
| Plan-Execute | + cited partial answers | none | none | 40%, 25.2 s, 3.8 turns, 6.7k tokens (plan-execute-004) | 25%, 42.5 s, 3.5 turns, 6.4k tokens (heldout-plan-execute-001) |
| Agent Loop | first run | 8 | 8k tokens | 57%, 63.1 s, 5.7 turns, 16.6k tokens (agent-loop-001) | not run |
| Agent Loop | transcript cap 8k to 16k | 8 | 16k tokens | 63%, 60.8 s, 5.8 turns, 17.9k tokens (agent-loop-002) | 67%, 58.7 s, 5.8 turns, 17.7k tokens (heldout-agent-loop-001) |
| Agent Loop | turn cap 8 to 12 | 12 | 16k tokens | 60%, 73.4 s, 7.9 turns, 37.1k tokens (agent-loop-003) | not run |
The plan-execute-004 and agent-loop-002 rows are the settings carried forward. Each cell: correctness, then mean time, turns (model calls) and prompt tokens per question, over 60 questions. Each cell is a single run on a local model, so a difference of a few questions may be noise. Run ids omit the musique- prefix. Per-question results for every run are in apps/evals/reports.
Learnings
- Deciding after each result beats planning up front on long chains. Plan-Execute's planner writes the 4th hop's query before it knows the 3rd hop's answer. Agent Loop writes it after. On held-out 4-hop questions, Plan-Execute got 1 of 20 right and Agent Loop 13.
- Traces are a great tool to identify tuning opportunities. My first guess was that Agent Loop wasted turns: it found the answer, then kept searching instead of answering. Looking at the traces, I found that the issue was that almost every wrong run hit a limit before the last hop, and 11 of 25 hit the 8,000-token transcript cap. Raising the cap immediately led to more correct answers.
- Partial answers trade abstentions for wrong answers. They are fairer to report, since an abstention hides how far a runtime got, but they lower right-when-answered.
- Agent transcripts are big payloads. Storing every turn's paragraphs pushed 60 answers past Temporal's 2 MB result limit; I had to recover some eval runs from workflow history.