Skip to main content

Advanced Multi-Agent Research System - Enhanced implementation of Anthropic's orchestrator-worker pattern with 90.2% performance improvement over single-agent systems

Project description

Anthropic Multi-Agent Architecture

Advanced Research System (Based on Anthropic's Paper)

Join our Discord Subscribe on YouTube Connect on LinkedIn Follow on X.com

PyPI version Python 3.10+ License: MIT

An enhanced implementation of the orchestrator-worker pattern from Anthropic's paper, "How we built our multi-agent research system", built on top of the bleeding-edge multi-agent framework swarms. Our implementation of this advanced research system leverages parallel execution, LLM-as-judge evaluation, and professional report generation with export capabilities.

๐Ÿ“ฆ Installation

pip3 install -U advanced-research

# Or 
# uv pip install -U advanced-research

Environment Setup

Create a .env file in your project root:

# Claude API Key (Primary LLM)
ANTHROPIC_API_KEY="your_anthropic_api_key_here"

# Exa Search API Key
EXA_API_KEY="your_exa_api_key_here"

# Optional: OpenAI API Key (alternative LLM)
OPENAI_API_KEY="your_openai_api_key_here"

๐Ÿš€ Quick Start

Basic Usage

from advanced_research import AdvancedResearch

# Initialize the research system
research_system = AdvancedResearch(
    name="AI Research Team",
    description="Specialized AI research system",
    max_loops=1,
)

# Run research and get results
result = research_system.run(
    "What are the latest developments in quantum computing?"
)
print(result)

With Export Functionality

from advanced_research import AdvancedResearch

# Initialize with export enabled
research_system = AdvancedResearch(
    name="Quantum Computing Research",
    description="Research team focused on quantum computing advances",
    max_loops=1,
    export_on=True,  # Enable JSON export
)

# Run research - will automatically export to JSON file
research_system.run(
    "What are the latest developments in quantum computing?"
)
# Results will be saved to a timestamped JSON file

Advanced Configuration

from advanced_research import AdvancedResearch

# Initialize with custom settings
research_system = AdvancedResearch(
    name="Medical Research Team",
    description="Specialized medical research system",
    director_model_name="claude-3-5-sonnet-20250115",  # Use latest Claude model
    worker_model_name="claude-3-5-sonnet-20250115",
    director_max_tokens=10000,
    max_loops=2,  # Multiple research iterations
    output_type="all",  # Include full conversation history
    export_on=True,
)

# Run research with image input (if applicable)
result = research_system.run(
    "What are the most effective treatments for Type 2 diabetes?",
    img=None  # Optional image input
)

Batch Processing Multiple Queries

from advanced_research import AdvancedResearch

# Initialize the system
research_system = AdvancedResearch(
    name="Batch Research System",
    max_loops=1,
    export_on=True,
)

# Process multiple research tasks
tasks = [
    "Latest advances in renewable energy storage",
    "Current state of autonomous vehicle technology",
    "Recent breakthroughs in cancer immunotherapy"
]

# Run batch processing
research_system.batched_run(tasks)

Using Different Output Formats

from advanced_research import AdvancedResearch

# Initialize with specific output type
research_system = AdvancedResearch(
    name="Research System",
    output_type="json",  # Options: "all", "json", "markdown"
    export_on=False,  # Get results directly instead of exporting
)

# Run research and get formatted output
result = research_system.run(
    "What are the key challenges in AGI development?"
)

# Check available output methods
available_formats = research_system.get_output_methods()
print(f"Available output formats: {available_formats}")

๐Ÿ“‹ Quick Reference

Task Code Documentation
Basic Research AdvancedResearch().run("query") Basic Usage โ†’
Export Results AdvancedResearch(export_on=True) Export Config โ†’
Batch Processing system.batched_run([queries]) Batch Processing โ†’
Custom Models AdvancedResearch(director_model_name="model") Advanced Config โ†’
Output Formats AdvancedResearch(output_type="json") Output Types โ†’

โœจ Key Features

Feature Description
Orchestrator-Worker Architecture A Director Agent coordinates research strategy while specialized worker agents execute focused search tasks with Exa API integration.
Advanced Web Search Integration Utilizes exa_search with structured JSON responses, content summarization, and intelligent result extraction for comprehensive research.
High-Performance Parallel Execution Leverages ThreadPoolExecutor to run multiple specialized agents concurrently, achieving significant time reduction for complex queries.
Flexible Configuration Customizable model selection (Claude, GPT), token limits, loop counts, and output formatting options.
Conversation Management Built-in conversation history tracking with the swarms framework's Conversation class for persistent dialogue management.
Export Functionality JSON export with automatic timestamping, unique session IDs, and comprehensive conversation history.
Multiple Output Formats Support for various output types including JSON, markdown, and full conversation history formatting.
Session Management Unique session IDs, batch processing capabilities, and step-by-step research execution control.

๐Ÿ—๏ธ Architecture

The system follows a streamlined orchestrator-worker pattern with parallel execution:

                [User Query + Configuration]
                            โ”‚
                            โ–ผ
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚       AdvancedResearch          โ”‚ (Main Orchestrator)
           โ”‚  - Session Management          โ”‚
           โ”‚  - Conversation History        โ”‚
           โ”‚  - Export Control              โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚ 1. Initialize Research Session
                            โ–ผ
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚      Director Agent             โ”‚ (Research Coordinator)
           โ”‚  - Query Analysis & Planning    โ”‚
           โ”‚  - Task Decomposition           โ”‚
           โ”‚  - Research Strategy            โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚ 2. Decompose into Sub-Tasks
                            โ–ผ
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚     Parallel Worker Execution           โ”‚
       โ”‚   (ThreadPoolExecutor - Concurrent)     โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚           โ”‚           โ”‚           โ”‚
          โ–ผ           โ–ผ           โ–ผ           โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚Worker 1  โ”‚ โ”‚Worker 2  โ”‚ โ”‚Worker 3  โ”‚ โ”‚Worker N  โ”‚
    โ”‚Exa Searchโ”‚ โ”‚Exa Searchโ”‚ โ”‚Exa Searchโ”‚ โ”‚Exa Searchโ”‚
    โ”‚Integrationโ”‚ โ”‚Integrationโ”‚ โ”‚Integrationโ”‚ โ”‚Integrationโ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚           โ”‚           โ”‚           โ”‚
          โ–ผ           โ–ผ           โ–ผ           โ–ผ
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚      Results Aggregation                โ”‚
       โ”‚  - Combine Worker Outputs               โ”‚
       โ”‚  - Format Research Findings             โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚ 3. Synthesize Results
                            โ–ผ
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚    Conversation Management      โ”‚
           โ”‚  - History Tracking             โ”‚
           โ”‚  - Output Formatting            โ”‚
           โ”‚  - Export Processing            โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                            โ”‚ 4. Deliver Results
                            โ–ผ
              [Formatted Report + Optional JSON Export]

๐Ÿ”„ Workflow Process

  1. Session Initialization: AdvancedResearch creates a unique research session with conversation tracking
  2. Director Agent Planning: The director agent analyzes the query and plans research strategy
  3. Parallel Worker Execution: Multiple worker agents execute concurrent searches using Exa API
  4. Results Aggregation: Worker outputs are combined and synthesized into comprehensive findings
  5. Output Processing: Results are formatted according to specified output type (JSON, markdown, etc.)
  6. Export & Delivery: Optional JSON export with timestamped files and conversation history

๐Ÿค Contributing

This implementation is part of the open-source swarms ecosystem. We welcome contributions!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-research-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-research-feature)
  5. Open a Pull Request

Development Setup with uv

# Clone and setup development environment
git clone https://github.com/The-Swarm-Corporation/AdvancedResearch.git
cd AdvancedResearch

uv venv

uv pip install -r requirements.txt

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

๐Ÿ“š Citation

If you use this work in your research, please cite both the original paper and this implementation:

@misc{anthropic2024researchsystem,
    title={How we built our multi-agent research system},
    author={Anthropic},
    year={2024},
    month={June},
    url={https://www.anthropic.com/engineering/built-multi-agent-research-system}
}

@software{advancedresearch2024,
    title={AdvancedResearch: Enhanced Multi-Agent Research System},
    author={The Swarm Corporation},
    year={2024},
    url={https://github.com/The-Swarm-Corporation/AdvancedResearch},
    note={Implementation based on Anthropic's multi-agent research system paper}
}

@software{swarms_framework,
    title={Swarms: An Open-Source Multi-Agent Framework},
    author={Kye Gomez},
    year={2023},
    url={https://github.com/kyegomez/swarms}
}

๐Ÿ“š Documentation

For comprehensive API documentation, examples, and advanced usage:

๐Ÿ“– View Full API Documentation โ†’

๐Ÿ”— Related Work

  • Original Paper - "How we built our multi-agent research system" by Anthropic
  • Swarms Framework - The underlying multi-agent AI orchestration framework

๐Ÿ“ž Support

Built with Swarms framework for production-grade agentic applications

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

advanced_research-0.1.5.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

advanced_research-0.1.5-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file advanced_research-0.1.5.tar.gz.

File metadata

  • Download URL: advanced_research-0.1.5.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Darwin/24.5.0

File hashes

Hashes for advanced_research-0.1.5.tar.gz
Algorithm Hash digest
SHA256 40f60d9c2d2a27d846db566cf80d35d1df1172e2fa6eab087a2e00da04f7087f
MD5 259849682f9399281d471868588d723f
BLAKE2b-256 226c8ea5f283ffab128d9ed17ce2ca649122230aac6597e44e62b19306e9698b

See more details on using hashes here.

File details

Details for the file advanced_research-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: advanced_research-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Darwin/24.5.0

File hashes

Hashes for advanced_research-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1adf85330975734cb33749e41c3ebe466a3ae36f468ff150f559b9dc8c40cb55
MD5 d727f293fede29f9544b8649843c71d6
BLAKE2b-256 e2ee9f6fccdab8167950b1130ecf8c7368fb58650531b87a009f435fabf599e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page