A sophisticated system that combines multiple AI agents with multiple tools (MCP + Custom Tools) to automatically design, generate, and manage production-ready backend applications. Built with AutoGen, Gemini, and Groq APIs, this system showcases advanced capabilities in both multi-agent collaboration and multi-tool utilization.
Note: This project extends beyond a standard multi-tool agent implementation by integrating multiple specialized agents that can leverage multiple tools in a coordinated fashion, creating a more powerful and flexible system than either approach alone.
This system employs four specialized AI agents that collaborate to build complete backend applications:
- π§ Architect Agent: Plans system architecture and design
- π» Coder Agent: Implements code based on architecture plans
- βοΈ Ops Agent: Handles deployment, testing, and operations
- π Reviewer Agent: Ensures production readiness and quality
- Specialized Agents: Four distinct AI agents with specific roles and responsibilities
- Collaborative Workflow: Agents work together in a coordinated pipeline
- Role-Based Access: Each agent has specific permissions and tool access
- Distributed Knowledge: Different agents maintain different aspects of project state
- MCP Server Integration: Seamless interaction with external MCP servers
- Custom Tools: Specialized tools for code generation, validation, and testing
- Tool Chaining: Ability to combine multiple tools in sequence
- Dynamic Tool Selection: Agents can choose the right tool for each task
- Production-Ready Code: Enforces comprehensive production checklist
- Incremental Development: 20% phases with user feedback loops
- Multi-LLM Strategy: Gemini for reasoning, Groq for fast code generation
- Security-First: Built-in security validation and best practices
- Quality Assurance: Automated code review and testing
- Modular Architecture: Easily extensible agent system
- Real-time Collaboration: Agents work together to solve complex tasks
- Comprehensive Testing: Built-in test generation and execution
- RESTful APIs: Complete backend services with proper endpoints
- Database Schemas: SQL and NoSQL database designs
- Authentication Systems: Secure user management and access control
- WebSocket Services: Real-time communication endpoints
- Background Tasks: Asynchronous job processing
- API Documentation: Interactive API documentation (Swagger/OpenAPI)
- Test Suites: Comprehensive test coverage
- Docker Configurations: Containerization setup
- CI/CD Pipelines: Automated testing and deployment workflows
- MCP Filesystem: For file operations within the workspace
- MCP Terminal: For executing shell commands
- Code Analysis Tools: For quality and security checks
- Version Control: Git integration for code management
- Dependency Management: Automatic requirements tracking
Multi-Agent System/
βββ agents/ # AI Agent implementations
β βββ architect.py # System design & planning
β βββ coder.py # Code implementation
β βββ ops.py # Operations & testing
β βββ reviewer.py # Quality assurance
βββ config/ # Configuration management
β βββ gemini_config.json
β βββ groq_config.json
β βββ tools_config.json
βββ utils/ # Utilities
β βββ mcp_client.py # MCP server integration
βββ workspace/ # Generated projects go here
βββ main.py # Main orchestrator
βββ production_checklist.md # Quality standards
- Python 3.8+
- Virtual environment (recommended)
- Gemini API key
- Groq API key (optional but recommended)
# Clone or navigate to the project directory
cd multi-tool-agent
# Install dependencies
pip install -r requirements.txt
# Install MCP Terminal server
npm install -g @dillip285/mcp-terminal- Set up API keys in
.env:
# Copy and edit the .env file
cp .env .env.local
# Edit .env.local with your actual API keys
GEMINI_API_KEY=your_gemini_api_key_here
GROQ_API_KEY=your_groq_api_key_here- MCP Server Setup: The system uses external MCP servers:
- Filesystem MCP:
https://www.claudemcp.com/servers/filesystem - Terminal MCP:
@dillip285/mcp-terminal(locally hosted)
- Filesystem MCP:
python main.py --project "AI Chat Backend" --description "Build a FastAPI backend for AI-powered chat with user authentication"python main.py --project "Content Generator API" --description "AI content generation service with rate limiting" --fullThe system enforces a comprehensive production checklist covering:
- β Core Application: Environment variables, dependencies, project structure
- β Code Quality: PEP8, error handling, logging, modularization
- β Security: Input validation, authentication, secrets management
- β LLM Safeguards: Prompt templates, output validation, cost tracking
- β Testing: Unit tests, integration tests, coverage goals
- β Observability: Structured logging, metrics, health checks
- β Performance: Async patterns, caching, efficient queries
- β Deployment: Docker configs, environment management
- β Documentation: README, API docs, code documentation
-
Architecture Planning (20%)
- Architect Agent designs system structure
- User reviews and approves plan
-
Core Implementation (40%)
- Coder Agent implements basic structure
- Ops Agent sets up environment
- User tests basic functionality
-
API & Features (60%)
- Complete API implementation
- Add advanced features
- User validates functionality
-
Testing & Quality (80%)
- Comprehensive testing setup
- Code quality validation
- Security review
-
Production Readiness (100%)
- Final production checklist validation
- Deployment preparation
- Documentation completion
- Role: Senior backend architect
- Tools: Gemini API for complex reasoning
- Outputs: System design, API specifications, database schema
- Role: Backend developer
- Tools: Groq (fast) + Gemini (complex), Filesystem MCP
- Outputs: FastAPI applications, database models, configuration files
- Role: DevOps engineer
- Tools: Terminal MCP
- Outputs: Test execution, server management, deployment scripts
- Role: Senior code reviewer
- Tools: Gemini API, Filesystem MCP
- Outputs: Code quality reports, security analysis, production readiness validation
Gemini (Complex reasoning tasks):
- Architecture planning
- Code review and analysis
- Security validation
- Complex problem solving
Groq (Fast code generation):
- Code implementation
- Simple transformations
- Quick responses
The system integrates with external MCP servers for secure operations:
{
"mcp_servers": {
"filesystem": {
"url": "https://www.claudemcp.com/servers/filesystem",
"workspace_path": "./workspace"
},
"terminal": {
"command": "npx",
"args": ["@dillip285/mcp-terminal", "--allowed-paths", "./workspace"]
}
}
}All generated projects are created in the workspace/ directory with:
- FastAPI application with proper structure
- Database models (SQLAlchemy)
- API endpoints with validation
- Configuration management
- Testing setup
- Docker configuration
- Documentation
Example generated structure:
workspace/ai-chat-backend/
βββ main.py # FastAPI application
βββ app/
β βββ __init__.py
β βββ config.py # Configuration management
β βββ models.py # Database models
β βββ routers/ # API endpoints
βββ tests/ # Test suite
βββ requirements.txt # Dependencies
βββ .env.example # Environment template
βββ Dockerfile # Container configuration
βββ README.md # Project documentation
- Input Validation: All endpoints include proper validation
- Authentication: JWT-based auth when needed
- Rate Limiting: Built-in rate limiting for APIs
- Security Headers: Proper CORS and security middleware
- Secrets Management: Environment-based configuration
- SQL Injection Prevention: Parameterized queries
The system generates comprehensive test suites:
- Unit Tests: Core logic testing
- Integration Tests: API endpoint testing
- Security Tests: Vulnerability scanning
- Performance Tests: Load testing setup
Run tests for generated projects:
cd workspace/your-project
pytest -vGenerated applications include:
- Health Check Endpoints:
/health,/ready - Structured Logging: JSON formatted logs
- Metrics Collection: Request/response metrics
- Error Tracking: Comprehensive error handling
Generated projects are deployment-ready with:
- Docker Support: Multi-stage Dockerfiles
- Environment Configuration: Dev/staging/prod configs
- Database Migrations: Alembic setup
- CI/CD Ready: GitHub Actions templates
-
MCP Server Connection Failed
# Ensure MCP terminal server is installed npm install -g @dillip285/mcp-terminal # Check if server is accessible npx @dillip285/mcp-terminal --help
-
API Key Issues
# Verify API keys are set echo $GEMINI_API_KEY echo $GROQ_API_KEY
-
Permission Errors
# Ensure workspace directory is writable chmod 755 workspace/
Enable detailed logging:
export LOG_LEVEL=DEBUG
python main.py --project "Test Project" --description "Test description"- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- AutoGen Framework: Multi-agent orchestration
- Google Gemini: Advanced reasoning capabilities
- Groq: Fast inference for code generation
- MCP Protocol: Secure tool integration
- FastAPI: Modern Python web framework
Built with β€οΈ by the Multi-Agent Backend Builder System
For support or questions, please open an issue in the repository.