Back to Recipes

Multi-Agent Research System

Deploy multiple AI agents to research a topic in parallel, each with a different focus, then synthesize their findings.

Best for: Researchers, analysts, content creators who need comprehensive topic coverage

What You Get

  • -Parallel agent research execution
  • -Specialized focus areas per agent
  • -Cross-referencing and conflict detection
  • -Synthesized executive summary
  • -Source citation and verification

Step by Step

1. Define research focus areas

Create a focus area planner that takes a research topic and breaks it into 3-5 distinct angles: e.g., historical context, current state, key players, controversies, future outlook. Each area gets a custom system prompt with specific instructions.

2. Create specialized agents

For each focus area, instantiate an agent with: a custom system prompt tailored to that angle, web search tools (Playwright or Brave Search API), a PostgreSQL connection to save findings, and a 60-second timeout.

3. Run parallel research

Execute all agents concurrently using Promise.allSettled. Each agent searches the web, extracts relevant information, rates confidence, and saves findings with source URLs to PostgreSQL. Log agent status (running, completed, failed) in real time.

4. Cross-reference findings

After all agents complete, a cross-referencing agent reads all findings and detects: supporting evidence (same claim from multiple agents), conflicting claims, unique insights (claimed by only one agent), and gaps (important angles not covered).

5. Generate the synthesis report

A synthesis agent compiles everything into a structured report: executive summary (3 paragraphs), key findings with evidence strength, conflicting viewpoints and their sources, recommendations, and methodology notes.

Stack

OpenAI/ClaudePlaywrightPostgreSQLNext.jsSquish (memory)

Build This

Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to build this recipe.

Build a multi-agent research system that deploys specialized agents to research topics in parallel and synthesize findings. ROLE: You are a research orchestration system that decomposes topics into focus areas, spawns specialized agents, coordinates parallel research, and synthesizes findings into a structured report. CONSTRAINTS: - Maximum 5 focus areas per research topic; each area must have a distinct angle - Agent timeout: 60 seconds per agent; agents that exceed timeout are marked as incomplete - Each agent must cite at least 2 sources per claim; uncited claims are flagged in synthesis - Synthesis must explicitly identify conflicting viewpoints rather than resolving them - Total research budget: maximum 50 web searches across all agents TOOL CALLING: - Use function calling for: decompose_topic(topic, num_areas?), spawn_agent(focus_area, system_prompt), search_web(query, agent_id?), save_finding(agent_id, finding_data), cross_reference(finding_ids[]), generate_report(research_id) - Each tool returns structured JSON with research data and agent metadata STRUCTURED OUTPUT: - Focus areas must return JSON: { topic: string, areas: [{ id: string, name: string, description: string, agent_prompt: string }] } - Agent findings must return JSON: { agent_id: string, focus_area: string, findings: [{ claim: string, evidence: string, sources: [{ url: string, title: string }], confidence: number }], status: 'completed' | 'timeout' | 'error', searches_performed: number } - Synthesis report must return JSON: { executive_summary: string, key_findings: [{ finding: string, evidence_strength: 'strong' | 'moderate' | 'weak', sources: string[] }], conflicting_viewpoints: [{ claim_a: string, claim_b: string, sources_a: string[], sources_b: string[] }], recommendations: string[], methodology_notes: string } CHAIN OF THOUGHT: - Decomposition: analyze topic → identify distinct angles → ensure no overlap → assign focus areas - Agent execution: spawn agents in parallel → monitor progress → handle timeouts → collect findings - Cross-referencing: compare claims → identify agreements and conflicts → assess source reliability - Synthesis: organize findings → write executive summary → highlight conflicts → provide recommendations FEW-SHOT EXAMPLES: Topic: 'AI agents in enterprise' Areas: [{ name: 'Current adoption', description: 'How companies are deploying AI agents today' }, { name: 'Technical architecture', description: 'Common patterns and frameworks' }, { name: 'ROI and business case', description: 'Measurable benefits and costs' }] Agent Finding: { claim: 'Enterprise AI agent adoption grew 340% from 2024 to 2025', evidence: 'Gartner report and McKinsey survey data', sources: [{ url: 'gartner.com/...', title: 'Enterprise AI adoption report' }], confidence: 0.85 } Conflict: { claim_a: 'AI agents reduce operational costs by 40%', claim_b: 'Most AI agent deployments fail to show ROI within 12 months', sources_a: ['deloitte.com/...'], sources_b: ['hbr.org/...'] } EVALUATION CRITERIA: - Coverage: percentage of focus areas with completed research (not timed out) - Source quality: percentage of findings backed by authoritative sources - Conflict identification: percentage of genuine conflicts detected in the research - Synthesis coherence: readability and logical flow of the final report The system should: 1) Accept a research topic and break it into 3-5 focus areas (e.g., history, current state, key players, controversies, future outlook), 2) Spawn a specialized agent for each focus area with a custom system prompt and web search tools, 3) Run all agents in parallel using Promise.allSettled with 60-second timeout per agent, 4) Each agent saves its findings to a PostgreSQL database with source URLs and confidence scores, 5) After all agents complete, a synthesis agent reads all findings, cross-references for conflicts, and generates a structured report with executive summary, key findings, conflicting viewpoints, and recommendations, 6) Include a dashboard showing agent status, sources found, and synthesis progress.

Common Failure Modes

  • !Agents produce contradictory information
  • !Web search rate limiting slows research
  • !Synthesis becomes too verbose
  • !Source verification is unreliable

Implementation Notes

Use Squish memory so agents can share findings. Set strict timeouts per agent. The synthesis agent should flag conflicts rather than trying to resolve them automatically.

Related skill: multi agent orchestrator

Ship multi-agent research system in production with 4M Labs

4M Labs designs and ships applied AI systems -- connected to your tools, secured for your team, deployed with monitoring.

  • Connected to your tools and data sources
  • Secured for your team with proper access controls
  • Deployed with monitoring and error handling
  • Documented for handoff and future maintenance
Work With 4M Labs

Frequently Asked Questions

Can I use this recipe in production?
Yes. Every recipe is production-tested with error handling, logging, and deployment guidance.
Which LLM providers are supported?
Recipes support OpenAI, Anthropic Claude, Google Gemini, and open-source models via a unified interface.
How do I customize these recipes?
Each recipe includes a configuration section. Override model selection, API keys, and parameters without changing core logic.