An intelligent multi-agent AI system powered by CrewAI and Google Gemini 2.5 Flash that automatically performs deep code reviews, detects security vulnerabilities, identifies bugs, and generates professional Markdown documentation for your codebase.
- π΅οΈββοΈ Multi-Agent Architecture (CrewAI):
- Senior Code Reviewer Agent: Inspects source code for security vulnerabilities, logic errors, edge cases, and performance bottlenecks.
- Technical Documentation Writer Agent: Transforms technical findings into clear, structured Markdown reports with actionable code recommendations.
- β‘ Powered by Gemini 2.5 Flash: Utilizes Google's fast and state-of-the-art LLM model for high-accuracy analysis.
- π¨ Modern Streamlit Web UI:
- Upload code files (
.py,.java,.js,.ts,.html,.css,.cpp). - Direct code editor / text pasting options.
- Multi-language support dropdown (Python, Java, JavaScript, TypeScript, C++, HTML/CSS, etc.).
- Upload code files (
- π₯ One-Click Export: Download generated code review & documentation reports directly as
.mdfiles. - π» CLI & Web UI Modes: Flexible execution via command line terminal or interactive web dashboard.
graph TD
A[User Code Input / File Upload] --> B[Streamlit Web UI / CLI]
B --> C[CrewAI Orchestrator]
subgraph AI Architecture Crew
C --> D[Agent 1: Senior Code Reviewer]
D -->|Identifies Bugs & Security Issues| E[Agent 2: Tech Documentation Writer]
E -->|Generates Markdown Report| F[Final Output Report]
end
D --- G[(Google Gemini 2.5 Flash)]
E --- G
F --> H[UI Display & Markdown File Download]
- Framework: CrewAI (Sequential Multi-Agent Process)
- LLM Engine:
gemini-2.5-flashvia Google Gemini API - Frontend / Web UI: Streamlit
- Language: Python 3.10+
- Environment Management:
python-dotenv
- Python:
3.10or higher installed. - Gemini API Key: Get a free API key from Google AI Studio.
-
Clone the Repository:
git clone https://github.com/chathunga2007/AI-Code-Review-Agent.git cd AI-Code-Review-Agent -
Create & Activate Virtual Environment:
- Windows (PowerShell):
python -m venv venv .\venv\Scripts\activate - macOS / Linux:
python3 -m venv venv source venv/bin/activate
- Windows (PowerShell):
-
Install Dependencies:
pip install crewai streamlit python-dotenv
-
Configure Environment Variables: Create a
.envfile in the root directory and add your API key:GEMINI_API_KEY=your_google_gemini_api_key_here
Run the following command in your terminal:
streamlit run app.pyThis opens the interactive Web Application in your browser at http://localhost:8501.
How to use the Web App:
- Select your target programming language in the sidebar.
- Choose your input method (Upload Code File or Paste Code Text).
- Click π Run AI Review & Generate Docs.
- View the live analysis report and click π₯ Download Markdown Report to save it!
You can also run the terminal script directly:
python agent.pyAI-Code-Review-Agent/
β
βββ .env # Environment variables (GEMINI_API_KEY)
βββ .gitignore # Git ignore rules
βββ agent.py # CLI entry point using CrewAI & Gemini
βββ app.py # Streamlit Web App entry point
βββ sample.py # Code snippet buffer for evaluation
βββ README.md # Project documentation
Contributions, issues, and feature requests are welcome! Feel free to open an issue or pull request.
Distributed under the MIT License.
Developed By β€οΈ Chathunga Bimsara