⚡ AI DevOps Agent – Automating code fixes, testing and pull requests with intelligent backend + AI reasoning.
AI DevOps Agent is an intelligent automation tool that seamlessly integrates with GitHub repositories to streamline the entire development workflow. It leverages AI to detect and repair broken code, refactor for readability and style and validate changes through automated testing. Once verified, it raises clean, well‑structured pull requests, all with minimal human intervention.
- Connects to GitHub: Securely links to your repository using a personal access token.
- Fetches Python files: Reads source code directly from your repo.
- AI Refactoring & Bug Fixing: Uses Ollama + CodeLlama to:
- Refactor messy code
- Fix broken logic when tests fail
- Ensure valid Python output (sanitized before saving)
- Formatting: Runs Black to enforce consistent style.
- Testing: Executes pytest to validate correctness.
- Pull Requests: Automatically commits changes and raises a PR back to your repo.
- Frontend Dashboard: React UI to connect repos, trigger checks and view PR status.
-
services/github_client.py
Handles GitHub API calls: branch creation, file updates, PR creation, file listing. -
services/fixers.py
Runs Black, pytest, and AI refactoring. Sanitizes Ollama output to strip markdown fences and explanations. -
routes/code.py
FastAPI route/fix-and-pr:- Clones repo locally
- Iterates over Python files
- Calls AI to refactor/fix code
- Runs Black + pytest
- If tests fail, re-prompts AI with feedback
- Commits changes and raises PR
-
lint.py
Provides static analysis and linting checks before code is committed.- Ensures code follows PEP8 and project style rules
- Detects unused imports, variables, and potential bugs
- Acts as a pre‑commit quality gate before AI fixes and PR creation
- Ollama + CodeLlama
- Input: raw code + optional test failure feedback
- Output: corrected/refactored Python code only
- Sanitization ensures only valid code is saved
- Components:
RepoConnect→ Connect GitHub repoCodeCheck→ Trigger AI refactor + testsPRStatus→ Show PR creation status
- 🔗 GitHub Integration
- 🤖 AI-Powered Code Fixes
- 🛠️ Automated Formatting (Black)
- ✅ Testing Automation (pytest)
- 📦 Pull Request Creation
- 🎨 Futuristic Dashboard UI
# Clone the repo
git clone https://github.com/sakshisemalti/ai-devops-agent.git
cd frosttech
# Backend setup
pip install -r requirements.txt
uvicorn main:app --reload
# Frontend setup
npm install
npm run dev-
Connect your GitHub repo in the UI.
-
Trigger Code Check to refactor, format and fix broken code.
-
Backend runs Black and pytest automatically.
-
If tests fail, AI re-prompts with feedback to fix the code.
-
Review and merge the auto-generated PR.
Contributions are welcome!This project is open for changes.
-
Fork the repository
-
Create a feature branch (git checkout -b feature-name)
-
Commit your changes (git commit -m "Add feature")
-
Push to your branch (git push origin feature-name)
-
Open a Pull Request
Please ensure your code passes Black formatting and pytest before submitting.
MIT License – free to use, modify and distribute.