AI-Powered Multi-Agent Search Orchestration with Remote MCP Servers
A production-ready real-time search system that combines DeepAgents orchestration with Model Context Protocol (MCP) servers to deliver intelligent, coordinated search capabilities across multiple data sources.
The RSearch (Real-time Search) system is an advanced AI orchestration platform that leverages:
- DeepAgents: Multi-agent coordination for complex search workflows
- MCP Servers: Standardized protocol for tool interactions
- Claude 4 Sonnet: Advanced language model for intelligent processing
- Distributed Architecture: Remote MCP servers for scalable search operations
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Query Interface β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DeepAgent Orchestrator β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β’ Planning Engine (Todo Management) β β
β β β’ Workflow Coordination β β
β β β’ Result Synthesis β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
β SerpApi β β Algolia β βOpenSearchβ
β MCP β β MCP β β MCP β
ββββββββββββ ββββββββββββ ββββββββββββ
Web Search Indexing Analytics
- Web Search: Live internet search via SerpApi MCP
- Semantic Indexing: Document storage and retrieval with Algolia
- Analytics Tracking: Performance monitoring via OpenSearch
- Multi-Source Aggregation: Combines results from multiple sources
- Multi-Agent Architecture: Specialized agents for different tasks
- Adaptive Workflow: Dynamic task planning and execution
- Error Recovery: Graceful degradation and retry mechanisms
- Performance Optimization: Network-aware latency management
- MCP Protocol Support: SSE/Streamable HTTP transports
- Redis Caching: Response caching for improved performance
- File Management: Automatic result documentation
- Thread Management: Conversation context preservation
# Required
- Python 3.11+
- uv package manager
- Anthropic API key
# Optional
- Redis server (for caching)
- MCP server endpoints
- Clone the repository
git clone <repository-url>
cd agentic-internet-rsearch-deepagents
- Install dependencies
uv sync
- Configure environment
cp .env.example .env
# Edit .env with your credentials:
# - ANTHROPIC_API_KEY=your-api-key
# - MCP_SERPAPI_URL=https://your-serpapi-mcp-url
# - MCP_ALGOLIA_URL=https://your-algolia-mcp-url
# - MCP_OPENSEARCH_URL=https://your-opensearch-mcp-url
# - REDIS_URL=redis://your-redis-url (optional)
uv run python main.py demo
uv run python main.py interactive
uv run python test_mcp_connectivity.py
The system receives a user query and creates an execution plan:
# Example query flow
Query β Planning β Research β Indexing β Analysis β Synthesis β Output
Specialized agents handle different aspects:
- Web Researcher: Executes targeted searches
- Object Indexer: Stores and retrieves structured data
- Analytics Tracker: Monitors performance and trends
Remote MCP servers provide:
- SerpApi: Google search, news, images, trends
- Algolia: Object storage, indexing, semantic search
- OpenSearch: Logging, analytics, performance tracking
The orchestrator combines results:
- Aggregates findings from multiple sources
- Generates comprehensive reports
- Saves results to files for review
# Core Configuration
ANTHROPIC_API_KEY=sk-ant-api03-... # Required: Claude API access
# MCP Server URLs (Optional - will degrade gracefully)
MCP_SERPAPI_URL=https://... # Web search server
MCP_ALGOLIA_URL=https://... # Indexing server
MCP_OPENSEARCH_URL=https://... # Analytics server
# Optional Services
REDIS_URL=redis://... # Cache server
LANGSMITH_API_KEY=... # Tracing/monitoring
# Adjust in main.py
recursion_limit = 100 # Max agent recursion depth
temperature = 0.1 # LLM creativity (0.0-1.0)
timeout = 10.0 # MCP connection timeout (seconds)
# Input
"What are the latest AI breakthroughs in 2024?"
# Workflow
1. Create research plan
2. Search web for recent AI news
3. Index relevant findings
4. Analyze trends and patterns
5. Generate comprehensive report
# Input
"Analyze recent financial technology innovations in Europe"
# Workflow
1. Search financial news sources
2. Index company and technology data
3. Track investment trends
4. Generate market analysis report
The system implements multiple layers of error recovery:
- Connection Failures: Automatic fallback to available servers
- Timeout Management: Configurable timeouts with graceful degradation
- Partial Failures: Continue with available tools
- Retry Logic: Automatic retry for transient failures
The system tracks:
- Query Latency: End-to-end processing time
- Network Overhead: Separate tracking of network vs processing
- Tool Performance: Individual tool execution metrics
- Success Rates: Query completion statistics
Target Performance:
- Total latency: <5000ms
- Individual tools: <2000ms average
- Network resilience: Handle up to 33% server failures
- API Key Management: Secure environment variable storage
- Redis Authentication: Optional password protection
- MCP Server Auth: HTTPS connections with authentication
- No Sensitive Data Logging: Automatic credential masking
- MCP Connection Failures
# Test connectivity
uv run python test_mcp_connectivity.py
# Check server URLs and network access
- Redis Connection Issues
# System works without Redis (degraded performance)
# Check REDIS_URL format: redis://[password@]host:port/db
- Import Errors
# Ensure dependencies are installed
uv sync
# Check Python version (3.11+ required)
python --version
agentic-internet-rsearch-deepagents/
βββ main.py # Main orchestrator
βββ test_mcp_connectivity.py # MCP server testing
βββ pyproject.toml # Project dependencies
βββ .env # Environment configuration
βββ README.md # This file
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test your changes thoroughly
- Submit a pull request
[License Type] - See LICENSE file for details
- DeepAgents: Advanced multi-agent orchestration framework
- MCP Protocol: Standardized tool interaction protocol
- Anthropic: Claude 3.5 Sonnet language model
- AI Tinkerers Hackathon: Platform for innovation
For issues and questions:
- Open an issue on GitHub
- Check troubleshooting section
- Review test scripts for connectivity debugging
Built with β€οΈ for the AI Tinkerers Hackathon