Architecture

This uses a two-agent design: a Research Planner that breaks the topic into sub-questions and a Research Worker that answers each sub-question from multiple sources.

User query
  ↓
Research Planner — generates 5 sub-questions
  ↓ (parallel)
Research Workers × 5 — each searches + reads 3 sources
  ↓
Synthesizer — merges, deduplicates, cites, formats report

Planner Agent

# research-planner.yaml
name: research-planner
llm:
  model: gpt-4o
  temperature: 0.4

system_prompt: |
  Break the user's research topic into exactly 5 focused sub-questions.
  Each question should explore a distinct angle: background, recent news,
  key players, technical details, and future outlook.
  Return as a JSON array of strings.

output:
  schema:
    type: array
    items: {type: string}
    minItems: 5
    maxItems: 5

Worker Agent

# research-worker.yaml
name: research-worker
llm:
  model: gpt-4o-mini
  temperature: 0.2

system_prompt: |
  Answer the given research question using web search.
  1. Search for the question
  2. Read the top 3 relevant sources
  3. Extract the key facts
  4. Return: {answer: "...", sources: [{title, url, date}]}

tools:
  - web_search
  - read_url

Orchestrator Pipeline

# research-pipeline.yaml
name: deep-research
steps:
  - id: plan
    agent: research-planner
    input: "{{ input.topic }}"
    
  - id: research
    type: parallel_for_each
    iterate_over: "{{ plan.output }}"
    as: question
    agent: research-worker
    max_parallel: 5
    collect_as: answers
    
  - id: synthesize
    agent: synthesizer
    input:
      topic: "{{ input.topic }}"
      answers: "{{ answers }}"

Synthesizer Agent

# synthesizer.yaml
name: synthesizer
llm:
  model: gpt-4o
  temperature: 0.3

system_prompt: |
  Write a comprehensive research report on: {{ topic }}
  
  Using the provided research answers, create:
  ## Executive Summary (2-3 paragraphs)
  ## Key Findings (bullet points)
  ## Detailed Analysis (sections)
  ## Sources (numbered list)
  
  Every factual claim must be followed by [n] citation number.
  
output:
  format: markdown

Running the Research Agent

openclaw pipeline run research-pipeline.yaml \
  --input '{"topic": "The impact of AI coding assistants on software developer productivity"}' \
  --output research-report.md

# Estimated: 2-3 minutes, ~$0.15 with GPT-4o + mini mix

What This Agent Does

This tutorial builds a research agent that can gather information from multiple sources, synthesize findings, identify contradictions, and produce well-structured research reports. The agent is useful for competitive analysis, literature summaries, technology evaluations, and any task that requires aggregating information from multiple web sources into a coherent document.

Step 1 — Agent Configuration

Create research-agent.yaml:

agent:
  name: research-agent
  description: Researches topics by gathering and synthesizing web sources
  system_prompt: |
    You are an expert research analyst. When given a research question
    or topic, you:
    1. Identify the key sub-questions that need answering
    2. Search for information using multiple queries from different angles
    3. Read and evaluate source quality and credibility
    4. Synthesize findings, noting where sources agree and disagree
    5. Produce a structured report with: Executive Summary, Key Findings,
       Supporting Evidence, Contradictions or Uncertainties, and Sources

    Always cite your sources with URLs. Distinguish between facts (supported
    by multiple sources), claims (from a single source), and speculations.
    Flag information that may be outdated and recommend the user verify it.

llm:
  model: claude-3-5-sonnet-20241022
  temperature: 0.3
  max_tokens: 8192

tools:
  - name: web_search
    enabled: true
    config:
      max_results: 10
  - name: web_fetch
    enabled: true
    config:
      timeout: 30
      max_content_length: 30000
  - name: file_write
    enabled: true
    config:
      allowed_dirs:
        - ./reports

Step 2 — Run a Basic Research Task

openclaw run --config research-agent.yaml   --task "Research the current state of open-source LLM inference optimization in 2024. Focus on quantization techniques, speculative decoding, and hardware acceleration approaches. Write a 500-word summary."   --output reports/llm-inference-research.md

Watch as the agent issues multiple search queries, fetches and reads source pages, and compiles its findings. The full research process typically takes 2–5 minutes for a thorough investigation.

Step 3 — Deep Research Mode

For more exhaustive research, instruct the agent to pursue leads iteratively:

openclaw run --config research-agent.yaml   --task "Do a deep research on [TOPIC]. Start with an overview search, then drill into the top 5 most important subtopic areas you find. For each subtopic, read at least 2 sources. Produce a comprehensive report of at least 1000 words."   --max-steps 50

The --max-steps 50 flag gives the agent enough steps to perform thorough multi-level research. For standard tasks, the default max_steps is sufficient.

Step 4 — Competitive Analysis

The research agent excels at structured competitive analysis. Create a task template:

COMPETITOR=Acme Corp
openclaw run --config research-agent.yaml   --task "Perform a competitive analysis of $COMPETITOR vs our product OpenClaw.
  Cover: (1) their pricing and tiers, (2) key features they offer that we don't,
  (3) their community size and activity, (4) customer sentiment from reviews,
  (5) their recent product announcements. Format as a comparison table plus narrative."

Step 5 — Source Quality Filtering

Add source credibility criteria to the system prompt for research that requires higher factual reliability:

    Prefer sources from: academic institutions (.edu), peer-reviewed publications,
    official documentation, established news organizations, and verified company blogs.
    Deprioritize: anonymous forums, sites without clearly identified authors,
    and content older than 2 years unless discussing historical context.
    Always note the source type and publication date when citing.

Troubleshooting

If the agent's reports are too shallow, it may be hitting max_steps limits before completing thorough research — increase the limit. If reports contain hallucinated facts, strengthen the factual accuracy instructions in the system prompt and add: "Do not include any claim that you cannot support with a URL from your research." If research on a niche technical topic returns poor results, provide seed URLs in the task: "Start your research from these authoritative sources: [URL1], [URL2]."

Improving Research Quality with Structured Queries

The quality of web search results depends heavily on the queries used. Train the agent to use diverse query strategies by including query planning instructions in the system prompt: "Before searching, generate 5 different search queries that approach the topic from different angles — include one overview query, one looking for recent developments, one seeking expert opinions, one looking for criticism or limitations, and one seeking quantitative data or statistics." This diversity of queries dramatically improves the breadth and quality of sources found compared to a single broad search.

Instruct the agent to evaluate source credibility before quoting from it. A Reddit comment and a peer-reviewed paper can both appear in search results — they shouldn't be weighted equally. Add source quality criteria to the system prompt that match your research context. For technical research, prioritize official documentation, academic papers, and posts from recognized practitioners. For market research, prioritize primary data providers and established industry analysts. For competitive intelligence, prioritize the company's own communications and verified news sources.

Handling Contradictory Information

When sources contradict each other, the agent should surface the contradiction rather than arbitrating it. Add an instruction: "When sources present conflicting information, present both views with their respective sources and note the nature of the disagreement. Do not resolve the contradiction by choosing one over the other — flag it for human judgment." Contradictions often reveal important nuance: one source may describe an older version of a product, different regional market conditions, or a genuinely contested factual claim that requires domain expertise to assess.

Research Output Formats for Different Audiences

Parameterize the output format based on who will read the research. An executive summary needs 3-5 sentences of key findings and a recommendation. A technical deep-dive needs full methodology, source list, and detailed findings. A comparison report needs a standardized rubric applied to each option. A briefing document needs background context, current state, and implications. Create named output templates in your research agent configuration and select them by name in the task — this keeps task prompts short while ensuring output format matches the audience's needs.

Integrating Research into Larger Workflows

The research agent is most powerful when embedded as a component in larger workflows. A content pipeline can use the research agent as its first stage, feeding its output to a writing agent and then a review agent. A competitive monitoring workflow can schedule weekly research runs, diff the findings against the previous week's results, and summarize what changed. A technical due diligence workflow can run structured research across multiple dimensions — codebase, documentation quality, community health, security track record — and compile the findings into a standardized report. The research agent's ability to systematically gather and synthesize information makes it a broadly useful foundational component.

Citation Formatting

Specify the citation format you need in the task. For internal reports, a simple "[Source Title](URL)" inline link is usually sufficient. For formal research outputs, ask for numbered footnote citations: all claims in the text reference a footnote number, and a numbered reference list appears at the end of the document. For academic-style outputs, request APA or Chicago format. The agent handles the formatting correctly when you specify it explicitly — without specification, it uses whatever format seems most natural for the output style, which may not match what you need.