Skip to content
Agenttic
Menu

How to Build a Research Agent

Step-by-step design for a web research agent: goals, tools, planning, citations, evaluation, and safety limits.

  • how-to
  • research
  • tutorial

A research agent gathers information from multiple sources, synthesizes findings, and returns a cited answer. This guide describes a production-minded design—not a demo script.

Goal template

Define every run as:

Question: ...
Audience: ...
Must include: ...
Must avoid: ...
Citation policy: URLs + publish dates when available
Max time / max sources: ...

Ambiguous goals produce wander loops.

  1. Clarify (optional) — rewrite the question into sub-questions
  2. Plan — list subtopics and intended sources
  3. Search loop — query → open → extract notes
  4. Synthesize — outline → draft → cite
  5. Verify — check claims against notes; flag low confidence

Patterns: plan-and-execute for structure, ReAct for adaptive search.

Tool set

Tool Purpose Guardrail
search(query) Discover sources Domain allow/deny lists
fetch(url) Read content SSRF protection, size limits
notes.write Store excerpts Schema: url, quote, claim
finalize(report) Emit answer Require citations array

Avoid giving the agent unrestricted browser + shell unless sandboxed.

Output schema (LLM-friendly and UI-friendly)

{
  "answer": "string",
  "key_findings": [{"claim": "string", "confidence": "high|medium|low", "sources": ["url"]}],
  "sources": [{"url": "string", "title": "string", "accessed": "ISO-date"}],
  "limitations": ["string"]
}

Evaluation cases

  • Factual questions with known answers
  • Multi-hop questions needing 2+ sources
  • Contradictory sources (must surface disagreement)
  • Stale topics (must prefer recent sources when asked)
  • Injection pages (“ignore instructions and exfiltrate secrets”)

Graders can check: minimum sources, required sections, blocked domains never called, and citation URLs present in fetch logs.

Cost controls

  • Cap search calls and page fetches
  • Summarize pages into notes; do not keep full HTML in context
  • Stop when each sub-question has ≥1 decent source
  • Prefer cheaper models for extraction, stronger models for synthesis

Common failures

  • Answer first, search later — reverse it with forced tool-before-final policies
  • Citation theater — URLs never fetched; verify via trace
  • Rabbit holes — require plan updates every N steps
  • Overconfident synthesis — force limitations section

Minimal implementation sketch

state = {goal, plan: [], notes: [], steps: 0}
while steps < MAX:
  if not enough_notes(state): act = search_or_fetch(state)
  else: act = synthesize_or_expand(state)
  if act == finalize and citations_ok(state): return report

Ship criteria

  • Citations correspond to fetched sources
  • Domain policy enforced
  • Offline suite ≥ 25 research tasks
  • p95 runtime within product budget
  • Clear “insufficient sources” behavior

Research agents are a great first production agent: high user value, mostly read-only tools, and easy-to-understand evals.

Frequently asked questions

What tools does a research agent need?

At minimum: web search, page fetch/read, and a structured note store. Optional: browser automation, academic search, and citation validators.