A sophisticated multi-agent AI system built on Cloudflare Workers and Containers that orchestrates different specialized AI agents to collaborate on complex research and analysis tasks.
The system consists of a main orchestrator service and three specialized agent containers:
- Purpose: Coordinates agent communication and task distribution
- Technology: Cloudflare Workers, Hono framework, TypeScript
- Responsibilities: Request routing, response aggregation, error handling
- Capabilities:
- Text summarization using BART transformer
- Sentiment analysis with RoBERTa
- Named entity recognition with spaCy
- Language detection
- Technology: FastAPI, transformers, spaCy, NLTK, TextBlob
- Capabilities:
- Web scraping and content extraction
- Search result simulation
- Content parsing with Readability
- URL validation and metadata extraction
- Technology: Node.js, Hono, Cheerio, Puppeteer, Readability
- Capabilities:
- Statistical analysis (mean, median, std dev)
- Trend detection and correlation analysis
- Data insights generation
- Performance metrics calculation
- Technology: Go, Gin framework, Gonum statistics
Submit a research query and get:
- Web search results with extracted content
- Sentiment analysis of findings
- Statistical analysis of data patterns
- Comprehensive insights and trends
- Extract and analyze text from multiple sources
- Generate summaries and key insights
- Identify correlations and patterns
- Produce actionable intelligence
- Process structured and unstructured data
- Generate statistical reports
- Detect trends and anomalies
- Provide automated insights
System information and available endpoints
System health check with agent status
List all available agents and their capabilities
Submit a comprehensive research request
Request Body:
{
"query": "artificial intelligence in healthcare",
"focus_areas": ["machine learning", "diagnostics"],
"max_sources": 5,
"include_sentiment": true,
"include_analytics": true
}Response:
{
"success": true,
"data": {
"query": "artificial intelligence in healthcare",
"summary": "AI in healthcare is transforming...",
"sources": [...],
"sentiment_analysis": {
"score": 0.8,
"label": "positive",
"confidence": 0.95
},
"key_entities": [...],
"analytics": {
"statistics": {...},
"trends": [...],
"insights": [...]
},
"generated_at": "2025-06-24T20:15:30Z",
"processing_time_ms": 3450
}
}Test NLP agent directly
Test Web agent directly
Test Analytics agent directly
- Node.js 20+
- pnpm
- Docker (for container development)
- Cloudflare Workers CLI (wrangler)
# Install dependencies
pnpm install
# Generate Cloudflare types
pnpm run cf-typegen
# Start development server
pnpm run dev# Run all tests
pnpm test
# Run linting and type checking
pnpm run checkEach agent can be developed and tested independently:
# Test NLP Agent locally
cd containers/nlp
pip install -r requirements.txt
python main.py
# Test Web Agent locally
cd containers/web
npm install
npm start
# Test Analytics Agent locally
cd containers/analytics
go mod download
go run .# Deploy to Cloudflare
pnpm run deploy- Each container runs on port 8080
- NLP Agent requires ~2GB RAM for transformer models
- Web Agent needs internet access for scraping
- Analytics Agent is lightweight and CPU-focused
- Simple NLP tasks: 100-500ms
- Web scraping (3-5 URLs): 2-5 seconds
- Statistical analysis: 50-200ms
- Full research pipeline: 3-10 seconds
- Horizontal scaling: Multiple container instances
- Auto-scaling: Based on request volume
- Resource isolation: Each agent in separate containers
- Fault tolerance: Individual agent failures don't crash system
- Container isolation: Each agent runs in isolated environment
- No persistent storage: Stateless request processing
- Input validation: Comprehensive request validation
- Error sanitization: No sensitive data in error messages
curl -X POST {HOST}/research \
-H "Content-Type: application/json" \
-d '{
"query": "electric vehicle market trends 2024",
"max_sources": 10,
"include_sentiment": true,
"include_analytics": true
}'curl -X POST {HOST}/research \
-H "Content-Type: application/json" \
-d '{
"query": "kubernetes security best practices",
"focus_areas": ["container security", "network policies"],
"max_sources": 7,
"include_sentiment": false,
"include_analytics": true
}'curl -X POST {HOST}/research \
-H "Content-Type: application/json" \
-d '{
"query": "renewable energy adoption rates",
"max_sources": 15,
"include_sentiment": true,
"include_analytics": true
}'- Built-in health checks for all agents
- Performance metrics in responses
- Error tracking with detailed error messages
- Request tracing through the orchestration pipeline
- Agent Plugin System: Dynamic agent registration
- Caching Layer: Redis-based response caching
- Streaming Responses: Real-time result streaming
- Advanced ML Models: Integration with GPT/Claude APIs
- Visual Analytics: Chart and graph generation
- Multi-language Support: International content analysis
This is a proof-of-concept demonstrating Cloudflare Containers for AI agent orchestration. The system showcases:
- Microservice architecture with language-specific agents
- Container orchestration for specialized AI workloads
- Real-time collaboration between different AI capabilities
- Scalable and fault-tolerant design patterns
Perfect for research institutions, content intelligence platforms, and organizations needing automated analysis workflows.