A sophisticated multi-agent orchestration system built with AutoGen, LangChain, and LangGraph. Deploy on Railway as a service to assign tasks and run an MCP server.
- Multi-Agent System: Orchestrates specialized AI agents (Planner, Coder, Researcher, Reviewer, Executor)
- LangGraph Integration: State-based workflow management with checkpointing
- MCP Server: Model Context Protocol server for agent communication
- REST API: FastAPI-based service for task submission and management
- Railway Ready: Configured for easy deployment on Railway
- Task Queue: Background task processing with status tracking
- Authentication: API key-based security
┌─────────────────┐ ┌─────────────────┐
│ REST API │ │ MCP Server │
│ (FastAPI) │ │ (WebSocket) │
└────────┬────────┘ └────────┬────────┘
│ │
└───────────┬───────────┘
│
┌───────────▼───────────┐
│ Orchestrator │
│ (LangGraph) │
└───────────┬───────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌────▼────┐ ┌────▼────┐ ┌────▼────┐
│ Planner │ │ Coder │ │Researcher│
└─────────┘ └─────────┘ └─────────┘
│
┌──────┴──────┐
┌────▼────┐ ┌────▼────┐
│Reviewer │ │Executor │
└─────────┘ └─────────┘
- Clone the repository and install dependencies:
cd multi-agent-orchestrator
pip install -r requirements.txt- Copy the environment template:
cp .env.example .env- Edit
.envwith your API keys:
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
API_KEY=your_api_key_for_auth
SECRET_KEY=your_secret_key- Run with Docker Compose:
docker-compose upOr run directly:
# Start all services
python main.py all
# Or run separately
python main.py api # Start REST API
python main.py mcp # Start MCP server-
Fork this repository
-
Connect to Railway:
railway login
railway link-
Set environment variables in Railway dashboard:
OPENAI_API_KEYANTHROPIC_API_KEYAPI_KEYSECRET_KEYDATABASE_URL(auto-provisioned by Railway)REDIS_URL(auto-provisioned by Railway)
-
Deploy:
railway upcurl -X POST https://your-app.railway.app/tasks \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"task": "Create a Python function that calculates fibonacci numbers",
"metadata": {
"language": "python",
"style": "recursive"
}
}'curl https://your-app.railway.app/tasks/{task_id} \
-H "Authorization: Bearer your-api-key"curl https://your-app.railway.app/agents \
-H "Authorization: Bearer your-api-key"Connect to the MCP server via WebSocket:
const ws = new WebSocket('ws://localhost:8001');
ws.on('open', () => {
// Initialize connection
ws.send(JSON.stringify({
jsonrpc: '2.0',
method: 'initialize',
params: {},
id: '1'
}));
// Execute a task
ws.send(JSON.stringify({
jsonrpc: '2.0',
method: 'execute_task',
params: {
task: 'Analyze this code for security vulnerabilities',
metadata: { priority: 'high' }
},
id: '2'
}));
});- Orchestrator: Coordinates other agents and manages workflow
- Planner: Decomposes complex tasks into actionable steps
- Coder: Implements solutions and writes code
- Researcher: Gathers information and conducts analysis
- Reviewer: Reviews code quality and suggests improvements
- Executor: Safely executes code and runs tests
Edit src/config.py or use environment variables:
MAX_ITERATIONS: Maximum workflow iterations (default: 20)AUTO_EXECUTE_CODE: Enable automatic code execution (default: true)SAVE_CHECKPOINTS: Enable workflow checkpointing (default: true)LOG_LEVEL: Logging level (default: INFO)
pytest tests/black src/
flake8 src/
mypy src/- Create agent class in
src/agents/specialized.py - Add to orchestrator in
src/orchestration/graph.py - Update workflow routing logic
- API endpoints require Bearer token authentication
- Code execution happens in isolated environments
- Input validation on all endpoints
- Rate limiting recommended for production
MIT License - see LICENSE file for details