AI-powered code analysis and bug fixing system using Mistral AI.
- Create bug tickets with descriptions
- AI agent analyzes code and finds bugs automatically
- Real-time progress tracking with step-by-step visibility
- Side-by-side code diff view (original vs fixed)
- One-click fix application
- Frontend: React 18 + Vite + Tailwind CSS
- Backend: Python FastAPI + SQLite
- AI: Mistral AI API
cd agentic-bug-fixer/backend
pip install -r requirements.txt
python main.pyBackend runs at: http://localhost:8000
cd agentic-bug-fixer/frontend
npm install
npm run devFrontend runs at: http://localhost:3000
Navigate to http://localhost:3000
-
Create a bug ticket:
- Title: "Application crashes when user has no membership"
- Description: "KeyError occurs in calculate_discount function when user.membership is not gold/silver/bronze"
- Code folder:
./sample_code
-
Watch the agent work:
- Status changes: NEW -> ANALYZING -> FOUND_BUG -> FIX_GENERATED -> RESOLVED
- See each analysis step appear in real-time
-
Review the fix:
- View original vs fixed code side by side
- Read AI explanation of the fix
-
Apply the fix:
- Click "Apply Fix" button
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check |
| GET | /tickets |
List all tickets |
| POST | /tickets |
Create ticket |
| GET | /tickets/{id} |
Get ticket details |
| DELETE | /tickets/{id} |
Delete ticket |
| POST | /tickets/{id}/apply-fix |
Apply fix |
| POST | /tickets/{id}/restart |
Restart analysis |
- Scan Files - Read code files from folder
- Analyze Structure - Map file dependencies
- Find Bug - AI identifies bug location
- Root Cause - Determine why bug occurs
- Generate Fix - Create corrected code
- Validate - Verify fix addresses issue
Set your Mistral API key in backend/.env:
MISTRAL_API_KEY=your-api-key-here
agentic-bug-fixer/
├── backend/
│ ├── main.py # FastAPI app
│ ├── database.py # SQLite operations
│ ├── agent.py # AI agent logic
│ ├── models.py # Pydantic models
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── App.jsx
│ │ ├── api/api.js
│ │ └── components/
│ ├── package.json
│ └── vite.config.js
└── sample_code/ # Demo buggy code
├── app.py
├── utils.py
└── database.py