The AI Code Review Agent is an intelligent Streamlit web application that provides instant code analysis, improvement suggestions, and execution capabilities for Python code. Powered by Google's Gemini AI, it helps developers write better code through automated reviews focusing on correctness, performance, readability, and security.
Component | Technology |
---|---|
Frontend | Streamlit |
AI Model | Google Gemini 1.5 Flash |
Code Execution | Python AST + Sandboxed Execution |
Styling | Custom CSS |
Deployment | Streamlit Cloud (or any Python hosting) |
The system uses Google's Gemini 1.5 Flash model with:
"""
You are a senior Python developer. Review the following code thoroughly.
Then suggest fixes for bugs, improvements, and best practices.
Focus on:
- Correctness
- Performance
- Readability
- Security
Return markdown output with clear sections:
1. Summary
2. Issues Found
3. Suggestions
4. Suggested Fixed Code (as a code block)
"""
graph TD
A[User Input] --> B[Code Submission]
B --> C{Action?}
C -->|Analyze| D[Send to Gemini AI]
C -->|Execute| E[Run in Sandbox]
D --> F[Generate Review]
F --> G[Extract Suggestions]
G --> H[Display Results]
E --> I[Capture Output]
I --> H
H --> J[Store in History]
git clone https://github.com/muzaffar401/ai-code-review-agent.git
cd ai-code-review-agent
pip install -r requirements.txt
secrets.toml
in .streamlit
folder:[gemini]
api_key = "your-api-key-here"
streamlit run app.py
git checkout -b feature/AmazingFeature
)git commit -m 'Add some amazing feature'
)git push origin feature/AmazingFeature
)Distributed under the MIT License. See LICENSE
for more information.
Your Name - @yourtwitter - your.email@example.com
Project Link: https://github.com/yourusername/ai-code-review-agent