A production-ready hierarchical multi-agent AI system built with LangGraph that provides specialized assistance across 19 expert domains with industry-standard prompts, dynamic tool binding, and comprehensive infrastructure integration.
- Added Mistral's Devstral 24B - Specialized coding model for Python development
- Integrated as secondary model for coding agents in backend configuration
- 46.8% SWE-Bench Verified score - Multi-file editing and codebase exploration
- Available via API, HuggingFace, and Ollama - Flexible deployment options
- Black formatting applied to all Python files (88 char line length)
- isort import organization with Black-compatible profile
- Frontend build fixes - All TypeScript errors resolved
- Successful production build - Ready for deployment
- Moved frontend utilities from backend to proper frontend location
- Enhanced document management - Comprehensive FileUpload component
- API client consolidation - Full document lifecycle support
- Cleaned up duplicates - Removed temporary and redundant files
- Replaced all hardcoded prompts with dynamic, context-aware system
- Integrated with existing prompt infrastructure (
prompts.py,config.py) - Scalable for any request type - no more limitations
- Context-aware prompt building using
build_enhanced_prompt()
- Dynamic tool binding based on agent roles and context
- 11 tools available including web search, document search, code generation
- Category-based assignment (development, research, documentation)
- Fallback to all tools when category-specific binding fails
- AgentRole enum references - all corrected
- Tool binding system - fully functional
- Error handling - comprehensive with fallbacks
- LLM integration - primary + fallback models
- Syntax validation - all files pass compilation
# Install dependencies
pip install -r requirements.txt
# Start the backend server
python -m uvicorn src.code_hero.main:app --reload --port 8000# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev- 19 Specialized Agents: Each expert in specific domains
- Hierarchical Team Structure: Development, Research, and Documentation teams
- LLM-Based Routing: Intelligent task routing with structured output
- Comprehensive Infrastructure: Full integration with all Code Hero components
- Template-Based Prompts: Zero hardcoded responses
- Model-Aware Selection: OpenAI, DeepSeek, Groq support
- FastAPI Expert - Backend development and API design
- Next.js Expert - Frontend development and React components
- Code Expert - General programming and implementation
- Research Expert - Information gathering and analysis
- Strategic Expert - Strategic planning and architecture
- Analysis Expert - Data analysis and insights
- Documentation Expert - Technical writing and guides
- Implementation Expert - Implementation documentation and tutorials
- Supervisor - Routes between teams and manages workflow
- SUPERVISOR - Multi-agent coordination and team routing
- RESEARCH - Research and analysis
- IMPLEMENTATION - Software development
- DOCUMENTATION - Technical documentation
- TRD_CONVERTER - Requirements conversion
- CODE_GENERATOR - Code generation
- CODE_REVIEWER - Code quality assurance
- STANDARDS_ENFORCER - Compliance enforcement
- STRATEGIC_EXPERT - Strategic planning
- LANGCHAIN_EXPERT - LangChain development
- LANGGRAPH_EXPERT - LangGraph workflows
- LLAMAINDEX_EXPERT - RAG systems
- FASTAPI_EXPERT - Backend development
- NEXTJS_EXPERT - Frontend development
- PYDANTIC_EXPERT - Data validation
- AGNO_EXPERT - Agno framework
- CREWAI_EXPERT - Multi-agent systems
- DOCUMENT_ANALYZER - Document processing
- PROMPT_ENGINEER - Prompt optimization
- Black: Python code formatting (88 char line length) - β Applied to all files
- isort: Import organization with Black-compatible profile - β Applied
- TypeScript: Frontend build errors resolved - β Production ready
- Pre-commit hooks: Automatic formatting on commits
- Flake8: Code linting (230 minor issues remaining)
# Run formatting script
./format_code.sh
# Or manually
black src/ tests/ --line-length 88 --target-version py39
isort src/ tests/ --profile black# Backend build
python setup.py build
# Frontend build (production ready)
npm run build
# Full build verification
npm run build && python setup.py build# Run all tests
python -m pytest tests/ -v
# Quick test
python -m pytest tests/ -q
# Test coverage
python -m pytest tests/ --cov=src/code_hero- β Backend: Running on port 8000
- β Frontend: Running on port 3000 (Next.js 15) - Production build successful
- β LangGraph: Running on port 2024 with hierarchical system loaded
- β Tests: 20/20 passing
- β Agents: 19 experts operational with industry-standard prompts
- β Hierarchical System: LLM-based routing with team structure
- β Tool Binding: Dynamic binding with 11 tools available
- β Infrastructure: Comprehensive integration with all components
- β Code Quality: Black + isort formatted (88 char line length)
- β Build System: Frontend TypeScript errors resolved, production ready
- β Devstral Integration: Mistral's coding model available for Python tasks
- β File Structure: Consolidated frontend/backend separation
- β Document Management: Enhanced upload/processing capabilities
- β AgentRole Enums: All references corrected and validated
- β Error Handling: Comprehensive fallbacks and recovery
# Required API Keys
OPENAI_API_KEY=your_openai_key
MISTRAL_API_KEY=your_mistral_key # For Devstral model access
DEEPSEEK_API_KEY=your_deepseek_key # Optional
GROQ_API_KEY=your_groq_key # Optional
# Database (Optional)
ASTRA_DB_TOKEN=your_astra_token
ASTRA_DB_ENDPOINT=your_astra_endpoint
# LangSmith Tracing (Optional)
LANGCHAIN_API_KEY=your_langsmith_key
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=code-heroThe system intelligently selects models based on task requirements:
- OpenAI GPT-4: Complex reasoning and analysis
- Mistral Devstral 24B: Specialized Python coding and software engineering
- DeepSeek: Cost-effective coding tasks
- Groq: Fast inference for simple tasks
- Specialized for coding: 46.8% score on SWE-Bench Verified
- Multi-file editing: Advanced codebase exploration capabilities
- Python optimization: Specifically tuned for Python development
- Secondary model: Available as alternative for coding agents
- State Management: Comprehensive state tracking and persistence
- Context Management: Cross-agent context sharing
- Agent Manager: Task tracking and completion recording
- Strategic Agent: Strategic guidance and planning
- Service Validation: Health monitoring and validation
- Logger: Structured logging with state tracking
- Utils: Tool execution, ID generation, file handling
- Human-in-the-Loop: Interactive workflow management
- Workflow Runner: Advanced workflow execution
- Performance Metrics: Comprehensive monitoring
- Error Handling: Graceful fallbacks and recovery
- Service Health: Real-time component monitoring
code-hero/
βββ src/code_hero/ # Backend source code
β βββ hierarchical_agents.py # Hierarchical multi-agent system
β βββ agent_expert.py # Expert agent implementations
β βββ supervisor.py # LangGraph supervisor
β βββ state.py # Agent state management
β βββ tools.py # Agent tools
β βββ prompts.py # Prompt templates
β βββ config.py # Configuration management (includes Devstral)
β βββ context.py # Context management
β βββ logger.py # Structured logging
β βββ manager.py # State management
β βββ services.py # Service management
β βββ utils.py # Utility functions
β βββ interfaces.py # Service interfaces
β βββ types.py # Type definitions
β βββ agents_api.py # Agent API endpoints
β βββ documents_api.py # Document processing endpoints
β βββ main.py # FastAPI application
βββ frontend/ # Next.js frontend (consolidated)
β βββ src/app/ # App router pages
β βββ src/components/ # React components
β β βββ documents/ # Document management components
β β β βββ FileUpload.tsx # Enhanced file upload with TRD conversion
β β βββ agents/ # Agent interface components
β β βββ ui/ # Reusable UI components
β βββ src/hooks/ # React hooks (moved from backend)
β β βββ useDocuments.ts # Document management hook
β βββ src/utils/ # Frontend utilities (consolidated)
β β βββ api.ts # API client with full document support
β βββ public/ # Static assets
βββ tests/ # Test suite
βββ docs/ # Documentation
βββ .pre-commit-config.yaml # Code formatting hooks
βββ format_code.sh # Formatting script
βββ setup.py # Python package configuration
βββ package.json # Node.js dependencies and scripts
# Deploy frontend
cd frontend
vercel deploy
# Deploy backend (serverless functions)
vercel deploy --prod# Build and run
docker-compose up --build- System Status:
SYSTEM_STATUS.md - Architecture:
ARCHITECTURE.md - API Documentation:
API_DOCUMENTATION.md - Deployment Guide:
DEPLOYMENT_GUIDE.md - Quick Start:
QUICK_START.md - Frontend Integration:
frontend/FRONTEND_INTEGRATION.md - API Documentation: Available at
/docswhen backend is running
# Greeting - handled directly
curl -X POST "http://localhost:8000/api/chat/?message=hello"
# Development request - routed to Development Team
curl -X POST "http://localhost:8000/api/chat/?message=create%20a%20FastAPI%20endpoint"
# Research request - routed to Research Team
curl -X POST "http://localhost:8000/api/chat/?message=research%20best%20practices%20for%20API%20design"
# Documentation request - routed to Documentation Team
curl -X POST "http://localhost:8000/api/chat/?message=write%20documentation%20for%20this%20API"# Check infrastructure health
python -c "
import asyncio
from src.code_hero.hierarchical_agents import validate_full_infrastructure
async def check():
status = await validate_full_infrastructure()
print(f'Status: {status[\"overall_status\"]}')
print(f'Healthy: {status[\"healthy_components\"]}')
asyncio.run(check())
"- Code Formatting: Run
./format_code.shbefore committing - Tests: Ensure all tests pass with
python -m pytest tests/ - Documentation: Update relevant docs for new features
- Pre-commit: Install hooks with
pre-commit install
MIT License - see LICENSE file for details.
Status: π’ FULLY OPERATIONAL WITH HIERARCHICAL AGENTS
Last Updated: January 2025 - Devstral Integration & Build System
Version: 3.1 - Enhanced Multi-Agent System with Specialized Coding Models