A code review system where multiple specialized AI agents work together to analyze your code, find issues, suggest improvements, and generate detailed review reports. Think of it as having a team of expert code reviewers, each focusing on their area of expertise.
I built this to showcase how different agentic AI patterns can work together in a practical application. Instead of one agent trying to do everything, I created specialized agents that each focus on a specific aspect of code review. They work together to give you comprehensive feedback on your code.
Here's what makes this system useful:
- Specialized Agents: Each agent focuses on one area - syntax, security, performance, style, best practices, and documentation
- Comprehensive Analysis: Covers everything from basic syntax errors to architectural issues
- Smart Issue Detection: Finds bugs, security vulnerabilities, performance problems, and code smells
- Actionable Suggestions: Not just problems, but specific recommendations on how to fix them
- Detailed Reports: Generates well-formatted reports you can share with your team
- Multiple Languages: Works with Python, JavaScript, TypeScript, and more
The system uses six specialized agents, each with their own job:
- Syntax Analyzer: Catches syntax errors and basic structural problems before anything else
- Security Agent: Looks for vulnerabilities like SQL injection, hardcoded secrets, and other security risks
- Performance Agent: Identifies bottlenecks, inefficient algorithms, and optimization opportunities
- Style Agent: Checks your code against style guides and naming conventions
- Best Practices Agent: Reviews design patterns, SOLID principles, and architectural issues
- Documentation Agent: Evaluates how well your code is documented
An orchestrator coordinates all these agents, collects their findings, and puts everything together into a comprehensive report.
- LangChain: Agent framework
- Gemini API: LLM for code analysis
- Streamlit: Web interface
- Python: Core implementation
Ready for use. All core components implemented and tested.
- Install dependencies:
pip install -r requirements.txt-
Set up environment:
Copy the example env and add your Gemini API key (do not commit the real
.env):- Unix / macOS:
cp .env.example .env
- Windows (PowerShell):
Copy-Item .env.example .envThen edit
.envand setGEMINI_API_KEYto your key.You can get an API key from Gemini's platform.
-
Run the application:
streamlit run frontend/streamlit_app.pyRun the application using Docker:
docker build -t code-review-agent .
docker run -p 8501:8501 --env-file .env code-review-agentUsing the system is straightforward:
- Input your code - Either paste it directly or upload a file
- Pick the language - Select Python, JavaScript, TypeScript, or another supported language
- Choose which agents to run - You can run all of them or just the ones you care about
- Start the review - Click the button and wait a minute or two while the agents do their work
- Check the results - Each agent's findings are organized in expandable sections
- Export the report - Download everything as a Markdown, Text, or JSON file to share with your team
Run tests without API key:
python test_review_dry_run.pyRun full test with API key:
python test_review.pySecurity note: If you accidentally committed secrets (for example a real .env file), remove it from future commits with:
git rm --cached .env
git commit -m "remove sensitive .env"To purge secrets from repository history you will need to rewrite history (for example using git filter-repo or the BFG Repo Cleaner) — take care, this rewrites commits and will require force-push.
- LangChain: Agent framework and orchestration
- Gemini API: LLM for code analysis
- Streamlit: Web interface
- Python 3.8+: Core language
- Code Quality Assurance: Automated code review before commits
- Security Auditing: Detect security vulnerabilities automatically
- Performance Optimization: Identify performance bottlenecks
- Best Practices: Ensure code follows best practices
- Documentation: Evaluate and improve code documentation
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.