Skip to content
All projects
AgentsLead Developer2025

DeepResearch-Agent

A research assistant that plans its own investigation: decompose a question, search and read across sources, then synthesise a cited answer you can verify.

PythonLangChainLLMRAGAgents

The problem#

Ask a chatbot a research-heavy question and you get a confident paragraph with no idea where any sentence came from. Ask a search engine and you get ten links and no synthesis. DeepResearch-Agent sits in the middle: give it a question, get back a structured answer where every claim carries a citation to the source it came from.

How it works#

The agent runs a plan → research → synthesise loop:

  1. Decompose — an LLM planner splits the question into 3–6 sub-questions ("what", "how", "what's the counter-argument").
  2. Research — each sub-question runs an independent search-and-read cycle, pulling documents and extracting the relevant passages.
  3. Aggregate — an evidence store collects claims alongside their source spans, de-duplicating overlapping text.
  4. Synthesise — the writer model composes a final report from the evidence store only, with inline citations.
  5. Verify — a cheap critic pass flags sentences in the draft that no evidence supports, and the loop retries just those.
plan = planner.decompose(question)          # -> list[SubQuestion]
for sub in plan:
    hits = retriever.search(sub)             # hybrid retrieval
    evidence.extend(reader.extract(sub, hits))
draft = writer.compose(question, evidence)   # evidence-only grounding
draft = critic.repair(draft, evidence)       # strip unsupported claims

Design decisions that mattered#

  • Evidence-only writing. The writer never sees raw search results, only the curated evidence store. This single constraint killed most citation hallucination.
  • Bounded autonomy. The planner has a step budget. Without it, the agent happily researches forever — "deep research" becomes "expensive research".
  • Citations as data, not prose. Citations live as structured entries (source id, span, quote) and are rendered last, so the answer's readability never fights its verifiability.

Failure modes I hit#

FailureFix
Planner asks vague sub-questionsFew-shot examples of specific research questions
Reader extracts whole paragraphsSentence-level extraction with relevance scoring
Duplicate evidence inflates confidenceHash-based dedup before aggregation
Critic too aggressive, strips everythingCap removals per pass, track a diff

What's next#

Streaming the evidence store to the UI so users can watch claims accumulate, and swapping the critic for a lightweight entailment model to make verification cheaper and stricter at the same time.