Research agent with its own benchmark
A RAG service, a four-agent research loop and a benchmark that tests whether the loop beats a single LLM call. On 100 multi-hop questions it did: 86% correct against 74%.
See it work
5 steps · scroll to play- 1
One question, two contenders
The project asks a simple question: on the same questions, does a four-agent loop give better answers than a single LLM call?
- 2
The RAG service finds the evidence
ai-document-analyst runs keyword search (BM25) and semantic search (dense vectors), merges the candidates and reranks them with a cross-encoder.
- 3
Four roles work in a loop
A planner plans the research, a researcher gathers evidence through the RAG service, a critic reviews the findings, names what's missing and asks follow-up questions, and a synthesizer writes the answer.
- 4
The benchmark runs both
agent-benchmark sends the same questions to the agent loop and to a single-shot baseline, both searching the same local BM25 index, and scores every answer the same way. On 100 HotpotQA multi-hop questions the loop answered 86% correctly, the single call 74%.
- 5
Anyone can rerun it
CI and tests run without API keys, so anyone can clone the project and reproduce the setup.
One question, two contenders
The project asks a simple question: on the same questions, does a four-agent loop give better answers than a single LLM call?
The RAG service finds the evidence
ai-document-analyst runs keyword search (BM25) and semantic search (dense vectors), merges the candidates and reranks them with a cross-encoder.
Four roles work in a loop
A planner plans the research, a researcher gathers evidence through the RAG service, a critic reviews the findings, names what's missing and asks follow-up questions, and a synthesizer writes the answer.
The benchmark runs both
agent-benchmark sends the same questions to the agent loop and to a single-shot baseline, both searching the same local BM25 index, and scores every answer the same way. On 100 HotpotQA multi-hop questions the loop answered 86% correctly, the single call 74%.
Anyone can rerun it
CI and tests run without API keys, so anyone can clone the project and reproduce the setup.
Problem
Multi-agent systems are easy to demo. I wanted to know whether a multi-agent loop actually beats a single LLM call on the same questions.
Solution
Three parts that build on each other: ai-document-analyst, a RAG service with hybrid retrieval; research-agent, a four-role agent that uses it as a tool; and agent-benchmark, a harness that runs the agent and a single call on the same questions. In the benchmark both searched the same local BM25 index over the HotpotQA paragraphs, so the comparison isolates the agent loop from the RAG service.
Architecture
The agent loop
- Question
- PlannerPlans the research
- ResearcherCalls the RAG service
- CriticFinds gaps, asks follow-ups
- SynthesizerWrites the final answer
Inside the RAG service
- BM25Keyword match
- Dense vectorsSemantic match
- Cross-encoderReranks the merged results
- The gain is concentrated in bridge questions (70% to 90%), where one search finds only one of the two facts needed.
- A follow-up ablation of the RAG service found its BM25 tokenizer was the weak point: splitting on word characters lifted keyword recall@5 from 55% to 78%. Write-up: Does hybrid search plus reranking pay for itself? I measured my RAG pipeline
- The benchmark harness runs the agent loop and a single-shot baseline on the same questions.
- CI and tests run without API keys, so anyone can reproduce the setup.
Stack
Result
On 100 HotpotQA multi-hop questions, with the same model and search index for both, the agent answered 86% correctly against 74% for a single call (+12 points, 95% CI +4 to +20), at about 6× the LLM calls. A second evaluator agreed with the automatic grader on 39 of 40 answers. Write-up: Does a four-agent loop beat a single LLM call? I measured it