Chapter 25 of 32 · ~16 min read & lab+70 XP
Chapter 25 · Agentic AI

Deep Research Agents: Fan-Out Search, Source Verification & Long-Horizon Synthesis

Architect autonomous deep-research systems that decompose complex queries, fan out parallel sub-researchers, verify conflicting claims, and compile inline-cited reports

What Is It?

A Deep Research Agent is a long-horizon multi-step agent that plans a research agenda, dispatches parallel search sub-agents across dozens of sources, cross-checks contradictions, and synthesizes a deeply cited report over several minutes.

Why Is It Required?

Standard RAG fetches 5–10 chunks in 1 second—great for quick lookup, terrible for comprehensive due diligence, market analysis, or literature reviews where facts are scattered across 50+ pages and sources contradict each other.

Everyday Analogy: Standard RAG is Googling a quick trivia fact; a Deep Research Agent is hiring a lead analyst who assigns 4 junior researchers to investigate different angles, reconciles conflicting spreadsheets, and delivers a footnoted briefing memo.
Why ML Engineers & Data Scientists Actually Need This

Deep Research (OpenAI Deep Research, Gemini Deep Research, Perplexity Deep Research) is one of the defining agentic product breakthroughs—and a favorite system design interview prompt.

ML / AI Engineer

You design the orchestrator-worker fan-out, URL deduplication, content compression/summarization workers (so 50 web pages don't overflow context), and strict citation-binding pipelines.

Data Scientist

You evaluate research reports on factual precision, citation faithfulness (does URL X actually support claim Y?), breadth of coverage, and cost per report.

Interview & Debug Edge

Highlighting the Context Explosion Problem—and solving it with a Map-Reduce Evidence Store where sub-agents return compressed, source-linked claim cards instead of raw HTML—immediately impresses senior interviewers.

Step 0 · Test Your Gut Before Any Math!

Your Deep Research agent visits 40 web pages averaging 4,000 tokens each (160,000 tokens total). What happens if you dump all 40 raw pages directly into the final writer LLM's prompt?

What You Will Master in This Chapter
  • Plan-and-Execute & Dynamic Replanning
  • Agentic RAG: Query Rewriting & Corrective RAG (CRAG)
Story-First Intuition, Visual Diagrams & Interactive Walkthroughs

Deep Research is iterative Map-Reduce with a Planner: (1) Clarify & Plan sub-questions, (2) Fan-Out parallel search workers, (3) Compress & Verify findings into cited evidence cards, (4) Gap-Check whether another search round is needed, and (5) Synthesize the final report.

1. The 5-Stage Deep Research Pipeline

  1. Scope Clarification & Plan: Break a broad request ("Compare solid-state battery commercialization timelines across top 5 automakers") into 5–8 orthogonal sub-questions.
  2. Parallel Fan-Out Workers: Spawn independent sub-agents with isolated context windows so each worker searches, opens primary PDFs/pages, and follows citations without polluting the lead agent's context.
  3. Evidence Card Extraction: Every worker returns structured JSON claims: {claim, verbatim_quote, url, publish_date, confidence}.
  4. Gap & Contradiction Check: The lead planner inspects the evidence pool—if Source A says 2027 and Source B says 2029, it spawns a targeted verification query to check which report is newer or primary.
  5. Grounded Synthesis + Citation Audit: Write the report strictly from the evidence pool, then run an automated citation verifier confirming every [n] link actually supports its sentence.

2. Guardrails Against Long-Horizon Drift

Because Deep Research runs for 2–10 minutes and dozens of tool calls, production systems enforce:

  • URL Deduplication & Domain Authority Weighting: Prefer primary filings, peer-reviewed papers, and official docs over SEO content farms.
  • Dimishing-Returns Stopping Rule: Stop spawning new search rounds once new unique facts per query drop below a threshold (or hard time/dollar budget is hit).
  • Progress Streaming: Emit live status updates ("Reading 12 sources on Toyota pilot lines...") so users trust the multi-minute wait.
“Wait, I'm Confused...” · Teacher Office Hours Q&A

The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.

Agentic RAG usually runs 1–3 query rewrites over a private knowledge base in a few seconds. Deep Research plans a multi-branch research tree, fans out parallel workers across dozens of documents over minutes, and reconciles conflicting evidence into a long-form report.

Interactive Visual Lab
Lab Challenge: Trace how a Planner decomposes a goal into parallel subtasks and dynamically replans when gaps appear.
Interactive Animation • 4.1 Deep Lab

Plan-and-Execute + Dynamic Re-Planner Recovery Studio

Watch the Executor hit an unexpected 404 on Step 2 and the Re-Planner dynamically splice a recovery step.

1. Planner
[1. Planner]Emits [S1: Fetch CSV, S2: Stripe API, S3: Report]
[2. Execute S1]S1 Fetch CSV → ✓ 1,240 rows loaded
[3. Execute S2]S2 Stripe API → ✗ HTTP 404 (Endpoint Deprecated)
[4. Re-Planner]Splices S2b: Query Billing Postgres → ✓ $1.42M ARR
[5. Complete]S3 Report generated & verified ✓
0%
1. Planner
Intuition Takeaway: Deep Research succeeds by combining parallel sub-agent fan-out, isolated context compression into cited evidence cards, contradiction checks, and hard time/budget stopping rules.
Production NumPy & PyTorch Code Patterns
# Deep Research Map-Reduce Evidence Pool & Contradiction Detector
EVIDENCE_CARDS = [
    {"topic": "battery_launch", "claim": "2027 pilot", "url": "https://primary.example/2026-q1", "year": 2026, "primary": True},
    {"topic": "battery_launch", "claim": "2025 mass", "url": "https://blog.example/rumor", "year": 2024, "primary": False},
    {"topic": "energy_density", "claim": "450 Wh/kg", "url": "https://paper.example/2026", "year": 2026, "primary": True},
]

def reconcile_evidence(cards: list[dict]) -> dict:
    by_topic = {}
    for c in cards:
        by_topic.setdefault(c["topic"], []).append(c)
    resolved = {}
    for topic, items in by_topic.items():
        # Prefer primary sources and newer publication years
        ranked = sorted(items, key=lambda x: (x["primary"], x["year"]), reverse=True)
        conflict = len({x["claim"] for x in items}) > 1
        resolved[topic] = {"winner": ranked[0]["claim"], "source": ranked[0]["url"], "had_conflict": conflict}
    return resolved

for topic, res in reconcile_evidence(EVIDENCE_CARDS).items():
    print(f"{topic}: {res['winner']} (conflict={res['had_conflict']}, src={res['source']})")
Common ML Interview Traps & Numerical Pitfalls
Trap #1: Running all 20 search queries sequentially in a single loop
Best Practice: parallel fan-out cuts wall-clock latency by 4–6×.
Trap #2: Allowing the final writer to invent URLs from parametric memory instead of restricting citations to canonical IDs present in the verified evidence pool.
Best Practice: Design deterministic guardrails and verify with offline trajectory evals.
Chapter Mastery Check (+70 XP)
Score: 0 / 1
1Why do production Deep Research agents compress each visited web page into structured evidence cards inside isolated sub-agents?

Apply What You Learned — Solve Matching Coding Problems