An AI-powered system diagnostic tool that uses CrewAI agents to analyze Windows system problems and generate automated fix scripts. The agent investigates system issues through safe diagnostic commands and creates customized batch scripts to resolve identified problems.
- AI-Powered Diagnosis: Uses Google Gemini LLM through CrewAI framework for intelligent system analysis
- Safe Command Execution: Only executes read-only, non-destructive diagnostic commands
- Automated Fix Generation: Creates Windows batch scripts tailored to identified issues
- User-Friendly GUI: Tkinter-based interface with step-by-step workflow
- Comprehensive System Analysis: Covers hardware, software, network, and performance issues
- Multi-Platform Support: Primary focus on Windows with basic Linux/macOS compatibility
The system uses a multi-agent architecture:
- Lead Diagnostician Agent: Orchestrates diagnosis, analyzes data, creates fix scripts
- System Command Executor Tool: Executes safe diagnostic commands and returns raw output
- GUI Interface: Manages user interaction and displays results
- Python 3.8+
- Windows OS (primary target, basic support for Linux/macOS)
- Google Gemini API Key (Get one here)
- Download the latest release
- Run
installer.bat
as Administrator for system-wide installation - Or use
launch.bat
for portable execution
-
Clone the repository:
git clone https://github.com/ajitashwath/diagnostic-agent.git cd diagnostic-agent
-
Install dependencies:
pip install -r requirements.txt
-
Set up Gemini API key:
set GEMINI_API_KEY=your_api_key_here
Or export on Linux/macOS:
export GEMINI_API_KEY=your_api_key_here
-
Launch the application:
python main_gui.py
-
Enter your Gemini API key in the provided field
-
Describe your problem in detail (e.g., "My computer is running slowly and the fan is always loud")
-
Click "Diagnose My System" and wait for analysis
-
Review the diagnosis results
-
Approve script generation if you want an automated fix
-
Save and run the generated batch script as Administrator
python src/laptop_repair/main.py "My computer keeps freezing randomly"
Use the provided build script to create a standalone executable:
python build_exe.py
This creates:
dist/WindowsSystemDiagnostic.exe
- Main executableinstaller.bat
- System installeruninstaller.bat
- Removal toollaunch.bat
- Portable launcher
├── main_gui.py # Main GUI application
├── build_exe.py # Executable build script
├── src/laptop_repair/
│ ├── crew.py # CrewAI orchestration
│ ├── main.py # CLI interface
│ ├── config/
│ │ ├── agents.yaml # Agent configurations
│ │ └── tasks.yaml # Task definitions
│ └── tools/
│ └── custom_tool.py # System command executor
├── installer.bat # Windows installer
├── uninstaller.bat # Windows uninstaller
└── launch.bat # Portable launcher
- System Info:
systeminfo
,wmic
queries - Process Analysis:
tasklist
, process monitoring - Hardware Diagnostics: CPU, memory, disk status
- Network Analysis:
netstat
,ipconfig
- File System:
sfc /verifyonly
, DISM health checks - Performance: Power settings, startup programs
- Event Logs: System and application errors
- System Cleanup: Temp file removal, disk cleanup
- System Repair: SFC scans, DISM repairs
- Service Management: Restart critical services
- Network Reset: DNS flush, Winsock reset
- Performance Optimization: Power settings, defragmentation
- Registry Maintenance: Safe registry operations
- Windows Updates: Automated update installation
- Lead Diagnostician: Main analysis agent
- Command Executor: System command execution
- System Analysis: Complete diagnostic workflow
- Command Execution: Individual command tasks
GEMINI_API_KEY
: Required for AI functionality
- Command Whitelist: Only approved, safe commands allowed
- Read-Only Operations: No destructive commands during diagnosis
- User Confirmation: Scripts require explicit user approval
- Administrator Check: Critical operations require elevated privileges
- Error Handling: Comprehensive exception management
- Timeout Protection: Commands automatically timeout after 180 seconds
- Performance Issues: Slow boot, high CPU/memory usage
- Hardware Problems: Overheating, hardware failures
- Network Connectivity: Internet issues, DNS problems
- System Crashes: BSOD analysis, stability issues
- Software Conflicts: Application errors, service failures
- Disk Problems: Storage issues, file system errors
- Security Concerns: Malware symptoms, suspicious activity
"Gemini API Key not found"
- Ensure API key is set in environment or GUI
- Verify key is valid and has proper permissions
"Command not permitted"
- Tool only allows safe, predefined commands
- Check
custom_tool.py
for allowed command list
"Build failed"
- Install PyInstaller:
pip install pyinstaller
- Ensure all source files are present
- Check Python version compatibility
"Script execution failed"
- Run batch scripts as Administrator
- Check Windows execution policy
- Verify system permissions
Enable verbose logging by setting:
set CREW_DEBUG=true
The tool integrates with Google Gemini API for AI-powered analysis. Ensure you have:
- Valid API key from Google AI Studio
- Sufficient API quota for analysis requests
- Network connectivity for API calls
- Limited Command Set: Only safe diagnostic commands allowed
- No Destructive Operations: Read-only analysis mode
- User Approval Required: Scripts need explicit permission
- API Key Protection: Keys masked in GUI, stored as environment variables
- Local Processing: System data processed locally when possible
- Fork the repository
- Create feature branch:
git checkout -b feature-name
- Make changes and test thoroughly
- Submit pull request with detailed description
pip install -r requirements.txt
pip install -e . # Install in development mode
For issues and questions:
- Check the troubleshooting section above
- Review the diagnostic output for error messages
- Ensure all prerequisites are met
- Verify API key configuration
This tool generates automated system repair scripts. While designed with safety in mind:
- Always backup important data before running repair scripts
- Test scripts in safe environments when possible
- Review generated code before execution
- Use at your own risk on production systems