Skip to main content

Research report agent

Prerequisite

This page applies patterns from Agent Design Patterns. Familiarity with Plan-and-Execute, Parallelization, and Pipeline/DAG helps, but the relevant concepts are linked inline throughout.

Source

This page documents mini-researcher, a scoped-down reimplementation of gpt-researcher's core loop. Give it a query; it plans sub-questions, researches them in parallel, and synthesizes a cited report.


The problem​

Answering an open research question well means searching multiple angles, opening a dozen pages, discarding the irrelevant ones, and writing up what's left with sources. A person does this in 30+ minutes of tab-juggling. A single LLM call can't do it at all: it has no live search, and pasting whole pages in blows the context window.

Before: one person, twenty tabs

After: pipeline fans the work out

Goal

Turn one query into a cited markdown report: plan sub-questions, search and scrape each in parallel, compress pages down to relevant chunks, synthesize once over the combined context.

Success criteria

A query returns a sourced report in seconds, not a half hour of tab-juggling. When the web returns nothing useful, the system says "not enough information" instead of fabricating an answer.


Why a fixed pipeline and not a ReAct agent?​

This is the opposite call from the data validation agent, and the contrast is the point.

The workflow shape is known upfront. Every run is plan β†’ research β†’ synthesize. No user instruction changes which stage runs or in what order. When the control flow is fixed, encoding it in code is more honest than asking a model to rediscover it every run. β†’ Pipeline / DAG

Only the inputs vary. The sub-questions, the URLs, the chunks β€” those differ per run. The model's judgment is needed in exactly two places: turning the query into sub-questions, and turning the research into a report. Both are single structured LLM calls, not open-ended loops. β†’ Plan-and-Execute

Workers don't need to think. Each sub-question follows the same search β†’ scrape β†’ compress path. The workers are plain functions, not agent instances deciding what to do next β€” fan-out doesn't require every worker to be a full agent. β†’ Parallelization

warning

A ReAct loop here would add latency, cost, and failure modes without adding capability. The rule from the data validation agent applies in reverse: when the tool sequence is predetermined, that's a chain β€” build a chain. ReAct earns its overhead only when tool order genuinely depends on runtime state. β†’ ReAct

Where the model's judgment actually lives​

DecisionMade byWhen
Which sub-questions to researchLLM (planner call)Once, at start
Which pages to fetchSearch provider rankingPer sub-query
Which chunks survive compressionBM25 + embedding scoring (code)Per page
What the report says, or whether to abstainLLM (synthesis call)Once, at end

Exactly two LLM calls surround the fan-out. Everything between them is deterministic code.


Architecture​

Four stages: plan, research in parallel, synthesize, return.

LayerWhat it does
PlannerOne LLM call turns the query into 2–4 independent sub-questions, with a defensive JSON-parse fallback chain
Workers (Γ— N, parallel)Per sub-question: search β†’ scrape each result β†’ chunk β†’ filter to relevant chunks
CompressionBM25 + embedding-similarity hybrid keeps the top-k chunks per sub-query, discards the rest
SynthesizerOne LLM call over the combined compressed context produces a cited report β€” or an explicit abstention

Run flow​

All N workers run concurrently. A 3-sub-query benchmark measured 27.1s sequential vs 8.3s parallel β€” a 3.3Γ— speedup, roughly the worker count, because the work is I/O-bound. β†’ Concurrency choice

Why compression is a load-bearing stage​

Scraping 3 results for each of 4 sub-queries yields ~12 full pages. Pasting them all into the synthesis prompt would blow the context window and bury the relevant paragraphs in navigation text and boilerplate.

Each page is chunked, then scored against its sub-question two ways: BM25 keyword match (weight 0.3) and embedding cosine similarity (weight 0.7). Only the top-k chunks per sub-query reach the synthesizer. This is context compression via relevance filtering β€” the same hybrid-search idea used for memory retrieval, applied statelessly to throwaway scraped content. β†’ Memory Management


Design patterns​

PatternUsed?How it applies here
Plan-and-ExecuteYesPlanner decomposes the query upfront; execution never revisits the plan mid-run. β†’ Plan-and-Execute
ParallelizationYesOne worker per sub-question, fanned out via thread pool, results joined before synthesis. β†’ Parallelization
Pipeline / DAGYesControl flow is a fixed DAG decided by code β€” the model never chooses the next step. β†’ Pipeline / DAG
GuardrailsYesOutput-side abstention: with empty context, the synthesis prompt instructs "not enough information" over fabrication. β†’ Guardrails
ReActNoNo LLM-driven tool selection at runtime. The pipeline shape is fixed; only its inputs vary per run.
Tool UseNoThe model is never handed a tool schema. Search, scrape, and compress are called by code, not chosen by the model.
Orchestrator-SubagentNoWorkers are plain functions with no model in the loop β€” subagents would add ceremony without capability.
Memory ManagementPartialCompression borrows hybrid-search scoring, but stateless: no persistence across runs, no conversational memory.
ReflectionNoOne synthesis pass. A critique loop is a real extension, but not part of the core shape.
warning

The abstention guard is the output-side counterpart of failure isolation. Both exist so partial or total pipeline failure degrades to an honest "I don't know" β€” never a confident wrong answer. β†’ Failure isolation


When to use this design​

SignalGood fitConsider different
Workflow shapeSame stages every runStages depend on intermediate results
Model's roleBounded, structured callsOpen-ended tool selection needed
Sub-tasksIndependent, parallelizableEach step feeds the next
Failure tolerancePartial results still usefulEvery source must succeed
StateStateless per runMulti-turn refinement sessions

Simpler alternatives

  • Single LLM call with web search tool: fine for questions one or two searches can answer. Fails when coverage needs multiple independent angles researched in depth.
  • Search + summarize per URL: works for "summarize this page" tasks. No decomposition, no cross-source synthesis.

When to go more complex

  • ReAct research agent: use when follow-up searches must depend on what earlier searches found β€” iterative deepening rather than upfront decomposition. β†’ ReAct
  • Orchestrator-Subagent team: use when sub-tasks need different specialists (a reviewer, an editor, a fact-checker) rather than N copies of the same worker. β†’ Orchestrator-Subagent
  • Reflection pass: use when report quality matters more than latency β€” critique and revise the draft before returning it. β†’ Reflection
One-shot question β†’ single LLM call + search tool
Fixed stages, independent legs β†’ this design
Next step depends on findings β†’ ReAct research agent
Specialist roles per sub-task β†’ Orchestrator-Subagent
Quality over latency β†’ add a Reflection pass

What was deliberately cut​

mini-researcher is a scoped-down port of gpt-researcher, and the cuts are as instructive as the keeps. The bar for adding anything back: does it teach a new concept, or just add surface area?

CutWhy
Multi-agent "team" modeA different architecture (agent-per-role) layered on top β€” the point here is the simpler fan-out shape
Per-subtopic synthesis + mergeOne synthesis call is the more instructive baseline
LLM-based source curationA re-ranking pass on top of the BM25 + embedding filter β€” real, but the hybrid filter alone is the teaching point
18 search providers / 8 scraper backendsOne of each is enough to demonstrate the abstraction; more are additive, not architecturally different
MCP integration, streaming frontendProduct surface, orthogonal to the core loop

The provider abstraction makes the cuts cheap to reverse: adding a second search provider is one class and one factory branch, with zero changes to the worker or pipeline. β†’ Provider abstraction