A production-ready hierarchical multi-agent system built with LangGraph, LangChain, FastAPI, and Docker. This system demonstrates advanced AI agent orchestration for customer support operations.
┌─────────────────────────┐
│ Supervisor Agent │
│ (Ticket Router) │
└───────────┬─────────────┘
│
┌───────┴────────┬────────────┬──────────────┐
│ │ │ │
┌───▼────┐ ┌─────▼─────┐ ┌──▼────────┐ ┌──▼──────────┐
│Knowledge│ │ Database │ │ MCP │ │ Response │
│ Base │ │ Agent │ │Integration│ │ Generator │
│ Agent │ │ │ │ Agent │ │ │
│(Qdrant) │ │ (SQLite) │ │(FS/GH/SL) │ │ │
└─────────┘ └───────────┘ └───────────┘ └─────────────┘
- Supervisor Agent: Routes customer tickets to appropriate worker agents based on ticket classification
- Knowledge Base Agent: Semantic search using Qdrant vector database for FAQ and documentation
- Database Agent: Structured queries on SQLite for customer data and ticket history
- MCP Integration Agent: Integrates multiple MCP servers:
- Filesystem MCP: File operations and document management
- GitHub MCP: Issue tracking and repository operations
- Slack MCP: Team notifications and communication
- ✅ Hierarchical agent orchestration with LangGraph StateGraph
- ✅ Production-quality code with OOPS principles and PEP-8 compliance
- ✅ Highly configurable design with Pydantic v2 settings
- ✅ Vector search with Qdrant for semantic knowledge retrieval
- ✅ Structured data queries with SQLite and aiosqlite
- ✅ Multiple MCP server integrations (filesystem, GitHub, Slack)
- ✅ RESTful API with FastAPI 0.115.0
- ✅ Real-time streaming with Server-Sent Events (SSE)
- ✅ LangGraph checkpointing with AsyncSqliteSaver
- ✅ Structured outputs with Pydantic models
- ✅ Docker containerization with multi-stage builds
- ✅ Comprehensive logging and error handling
- ✅ Health checks and component monitoring
- ✅ Latest LangChain 1.2.10 and LangGraph 1.0.9 (Feb 2026)
- ✅ LangGraph Checkpoint 4.0.0 with durable execution
- ✅ Qdrant Client 1.17.0 for vector search
- Docker and Docker Compose
- Python 3.11+ (for local development)
- OpenAI API key
- Optional: GitHub token, Slack bot token
- Clone the repository:
git clone <repository-url>
cd multi-agent-system- Create environment file:
cp .env.example .env
# Edit .env with your API keys- Start the system:
docker-compose up -d- Initialize the databases:
docker-compose exec app python scripts/initialize_db.py- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set environment variables:
export OPENAI_API_KEY=your_key_here
# ... other environment variables- Run the application:
uvicorn src.app:app --reloadOnce running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
curl -X POST "http://localhost:8000/tickets" \
-H "Content-Type: application/json" \
-d '{
"content": "I forgot my password and the reset email is not arriving",
"customer_id": "CUST001",
"priority": "high"
}'Response:
{
"ticket_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"response": "To reset your password, please...",
"processing_time": 2.34
}curl -X POST "http://localhost:8000/tickets/stream" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{
"content": "What is your refund policy?",
"priority": "medium"
}'Streaming response:
event: start
data: {"ticket_id": "...", "status": "processing"}
event: update
data: {"node": "supervisor", "decision": "knowledge_base"}
event: u├── mcp_integration.py
│ │ └── response_generator.py
│ ├── config/ # Configuration management
│ │ └── settings.py # Pydantic settings with validators
│ ├── database/ # Database clients
│ │ ├── qdrant_client.py
│ │ └── sqlite_client.py
│ ├── graph/ # LangGraph workflows
│ │ └── workflow.py # StateGraph implementation
│ ├── mcp/ # MCP servers
│ │ ├── server.py # FastMCP server with tools/resources
│ │ ├── filesystem_client.py
│ │ ├── github_client.py
│ │ └── slack_client.py
│ ├── models/ # Pydantic models
│ │ └── schemas.py
│ ├── services/ # Business logic
│ │ └── ticket_service.py
│ └── app.py # FastAPI application with streaming
├── tests/ # Test suite
│ ├── test_agents.py
│ ├── test_database.py
│ └── conftest.py
├── scripts/ # Utility scripts
│ ├── initialize_db.py
│ └── test_system.py
├── data/ # Data storage
│ └── mcp_files/
├── logs/ # Application logs
├── docs/ # Documentation
│ ├── API_GUIDE.md
│ └── ARCHITECTURE.md
├── docker-compose.yml # Development compose
├── Dockerfile # Development Dockerfile
├── Dockerfile.prod # Production Dockerfile
├── requirements.txt # Python dependencies (latest versions)
├── setup.py # Package setup
├── pyproject.toml # Tool configuration
├── DEPLOYMENT.md # Detailed deployment guide
# Run with coverage
pytest --cov=src --cov-report=html
# Run specific test file
pytest tests/test_agents.py
multi-agent-system/
├── src/
│ ├── agents/ # Agent implementations
│ │ ├── base.py # Base agent class
│ │ ├── supervisor.py # Supervisor agent
│ │ ├── knowledge_base.py
│ │ ├── database.py
│ │ └── mcp_integration.py
│ ├── config/ # Configuration management
│ ├── database/ # Database clients
│ ├── graph/ # LangGraph workflows
│ ├── mcp/ # MCP server clients
│ ├── models/ # Pydantic models
│ ├── services/ # Business logic
│ └── main.py # FastAPI application
├── tests/ # Test suite
├── scripts/ # Utility scripts
├── data/ # Data storage
├── logs/ # Application logs
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
└── README.md
Key configuration files:
.env: Environment variablessrc/config/settings.py: Application settingspyproject.toml: Tool configuration
- Health endpoint:
/health - Metrics endpoint:
/metrics(if enabled) - Logs:
./logs/directory
- Non-root Docker user
- Environment variable management
- API key validation
- Input sanitization
- Error message sanitization
MIT License
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
For issues and questions, please open a GitHub issue.