Skip to main content

Overview

This example demonstrates how to build a research team swarm that collaborates to produce comprehensive research reports. The team consists of specialized agents working in a hierarchical structure to gather information, analyze data, and synthesize findings into actionable insights.

Business Value

  • Accelerated Research: Complete comprehensive research in hours instead of days
  • Diverse Perspectives: Multiple specialized agents provide different analytical viewpoints
  • Quality Assurance: Built-in review and synthesis steps ensure accuracy
  • Scalability: Handle multiple research projects simultaneously
  • Cost Efficiency: Reduce manual research hours by 70-80%

Architecture Choice

We use HierarchicalSwarm because:
  • Research flows naturally from data gathering → analysis → synthesis
  • A director agent can coordinate specialist researchers
  • Each loop builds on the previous loop’s results
  • Clear separation of concerns (research vs analysis vs writing)

Complete Implementation

How It Works

HierarchicalSwarm creates a director (none is passed here) that reads the query and the team roster, then issues orders to the specialists:
  • Primary Researcher gathers initial information and sources
  • Data Analyst processes the research into structured insights
  • Critical Analyst reviews findings for quality and completeness
  • Report Writer synthesizes everything into a final report
Orders within a loop run in parallel, so agents in the same loop do not see each other’s answers. Each agent does see the shared conversation from earlier loops, which is why max_loops=2 lets the director give the report writer the first loop’s findings to synthesize.

Customization Tips

Add Domain Experts

Add Multi-Loop Research

For iterative research that digs deeper:

Configure Output Format

Add Memory for Long Projects

Set persistent_memory=True so the researcher picks up where it left off across sessions. Memory is keyed by agent_name and stored in MEMORY.md under the workspace directory.

Real-World Applications

  • Market Research: Competitive intelligence and market analysis
  • Due Diligence: Investment and M&A research
  • Academic Research: Literature reviews and meta-analysis
  • Policy Analysis: Regulatory impact assessments
  • Technology Evaluation: Vendor selection and technology assessments

Performance Optimization

Parallel Research Tasks

For independent research streams:

Cache Common Research

Next Steps