An intelligent Multi-Agent System for predictive maintenance and optimization in smart manufacturing. This system uses LLM-powered orchestration to automatically load, preprocess, analyze, and generate prescriptive recommendations from manufacturing data.
- LLM-Powered Orchestration: Intelligent workflow planning using Google Gemini or local LLMs (Ollama)
- Adaptive Intelligence: Automatic model selection and performance optimization
- Intelligent Preprocessing: Automatic feature analysis, encoding, and data quality handling
- Multi-Model Analysis: Supports classification, regression, and anomaly detection
- Prescriptive Recommendations: Actionable maintenance suggestions with priority ranking
- Human-in-the-Loop: Interactive approval workflow for critical decisions
- Comprehensive Logging: Detailed audit trails and performance metrics
-
Fixed One-Hot Encoding Issue: Protected identifier columns (e.g., Machine_ID) are now properly handled as pass-through features instead of being one-hot encoded, reducing feature explosion and improving performance.
-
Fixed ID Column Handling: All models now automatically drop ID columns during training while preserving them for recommendations and reporting.
-
Enhanced Contributing Factors: All priority levels (Critical, Medium, Low) now show detailed contributing factors based on actual feature values instead of generic messages.
-
Improved Workflow Completion: Fixed LLM validation logic to properly handle workflow completion signals.
-
Better Data Flow Logic: Improved tracking of data shapes through the entire pipeline for better debugging and transparency.
- Python: 3.8 or higher
- API Key: Google Gemini API key (optional if using local LLMs)
- Ollama: Optional, for local LLM support
git clone <repository-url>
cd smart_manufacturing_mas_code# Create virtual environment
python3 -m venv mas_venv
# Activate virtual environment
# On macOS/Linux:
source mas_venv/bin/activate
# On Windows:
mas_venv\Scripts\activatepip install -r requirements.txtIf using Google Gemini, create a .env file:
echo "GEMINI_API_KEY=your_gemini_api_key_here" > .env# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model (example with Qwen3)
ollama pull qwen3:4bpython3 main_llm.pyThis will guide you through:
- Dataset selection
- Feature and target selection
- Problem type identification
- Approval of critical decisions
python3 main_llm.py --auto --dataset "data/Smart Manufacturing Maintenance Dataset/smart_maintenance_dataset.csv"python3 main_llm.py --decision-llm ollama --decision-model qwen3:4b# Run with default Gemini LLM
python3 main_llm.py
# Run with auto schema discovery
python3 main_llm.py --auto --dataset "path/to/dataset.csv"
# Run with local LLM
python3 main_llm.py --decision-llm ollama --decision-model qwen3:4b
# Batch process all datasets
python3 main_llm.py --batch# Custom LLM configuration
python3 main_llm.py \
--planner-llm gemini \
--decision-llm ollama \
--decision-model llama3:8b \
--auto
# Specific dataset with auto mode
python3 main_llm.py \
--auto \
--dataset "data/Intelligent Manufacturing Dataset/manufacturing_6G_dataset.csv"- LLM Planner Agent: Orchestrates workflow using LLM reasoning
- Data Loader Agent: Loads and inspects datasets
- Preprocessing Agent: Intelligent feature analysis and data preparation
- Dynamic Analysis Agent: Multi-model analysis with automatic selection
- Optimization Agent: Generates prescriptive recommendations
- Schema Discovery: Automatic dataset understanding
- Tool Decider: Intelligent preprocessing/model selection
- Adaptive Intelligence: Performance-based model switching
- Intelligent Summarization: Clean output with full logging
- Classification: Predict categorical outcomes (e.g., maintenance priority)
- Regression: Predict continuous values (e.g., failure probability)
- Anomaly Detection: Identify unusual patterns (no target needed)
| Option | Description |
|---|---|
--planner-llm |
LLM backend for planner (gemini, ollama, mock) |
--planner-model |
Model name for planner |
--decision-llm |
LLM backend for decisions (ollama, mock, or None) |
--decision-model |
Model name for decisions (e.g., qwen3:4b) |
--dataset |
Path to CSV dataset |
--auto |
Enable auto mode with schema discovery |
--batch |
Process all datasets in data/ directory |
--interface |
HITL interface (cli or web) |
smart_manufacturing_mas_code/
βββ agents/ # Core agent implementations
β βββ llm_planner_agent.py # LLM orchestration
β βββ data_loader_agent.py # Data loading
β βββ preprocessing_agent.py # Preprocessing
β βββ dynamic_analysis_agent.py # Analysis
β βββ optimization_agent.py # Recommendations
βββ utils/ # Utility modules
β βββ schema_discovery.py # Auto schema detection
β βββ tool_decider.py # Model/tool selection
β βββ hitl_interface.py # Human-in-loop UI
β βββ reporting.py # Logging and reporting
βββ data/ # Sample datasets
β βββ Smart Manufacturing Maintenance Dataset/
β βββ Intelligent Manufacturing Dataset/
βββ documentation/ # Documentation
β βββ usage_guide.md # Detailed usage guide
β βββ architecture_and_workflow.md
β βββ adaptive_intelligence_system.md
βββ logs/ # Generated logs
βββ main_llm.py # Main entry point
βββ requirements.txt # Dependencies
The system provides real-time progress updates and a final intelligent summary.
All runs generate:
logs/workflow_report_*.json: Detailed workflow reportlogs/detailed_results_*.json: Complete structured datalogs/hitl_audit.json: Human approval audit trail
1. Import Errors
# Make sure virtual environment is activated
source mas_venv/bin/activate
# Verify installation
pip list | grep scikit-learn2. API Key Issues
# Check .env file exists
cat .env
# Verify API key is valid
python -c "import google.generativeai as genai; genai.configure(api_key='your_key')"3. Ollama Connection Issues
# Start Ollama service
ollama serve
# Test model availability
ollama list4. Dataset Issues
# Verify dataset path
ls -la data/
# Check CSV format
head -5 data/Smart\ Manufacturing\ Maintenance\ Dataset/smart_maintenance_dataset.csvEnable detailed logging:
export LOG_LEVEL=DEBUG
python3 main_llm.py --autoContributions are welcome! Please follow these guidelines:
- Create a feature branch
- Add tests for new functionality
- Update documentation
- Submit a pull request
[Add your license information here]
This project is developed for research in intelligent manufacturing and predictive maintenance systems.
[Add contact information]
Ready to get started? Run python3 main_llm.py to begin your first analysis!