A multi-agent code review system using Claude Haiku 3.5 with 6 specialized agents.
- Python 3.7 or higher
- Anthropic API Key - Get one at https://console.anthropic.com/api-keys
pip install anthropicpython setup.pyWhen prompted:
- Enter your Anthropic API key (starts with "sk-ant-api03-...")
- Choose option 1 (environment variable) or 2 (.env file)
python main.pyWhen prompted:
- Enter the path to the code file you want to review (e.g.,
example.py) - Wait for all 6 agents to analyze your code
- Choose whether to save results to text file
- Syntax & Logic Agent - Finds bugs, logic errors, and correctness issues
- Security Agent - Finds vulnerabilities and security issues
- Performance Agent - Identifies bottlenecks and optimization opportunities
- Architecture Agent - Reviews design patterns and code structure
- Testing Agent - Suggests test cases and identifies testing gaps
- Documentation Agent - Reviews and improves code documentation
python DemoMode.pyThis shows how the system works without using your API credits.
python BatchReview.py /path/to/your/projectβββ main.py # Main entry point
βββ BaseAgent.py # Base class for all agents
βββ SyntaxLogicAgent.py # Syntax and logic error detection
βββ SecurityAgent.py # Security analysis
βββ PerformanceAgent.py # Performance analysis
βββ ArchitectureAgent.py # Architecture review
βββ TestingAgent.py # Testing recommendations
βββ DocumentationAgent.py # Documentation review
βββ CodeReviewCouncil.py # Orchestrates all agents
βββ BatchReview.py # Review multiple files
βββ DemoMode.py # Demo without API
βββ setup.py # API key setup
βββ config.json # Configuration
βββ example.py # Example code to test
βββ README.md # This file
Edit config.json to:
- Change the Claude model (default: claude-3-5-haiku-20241022)
- Enable/disable specific agents
- Adjust temperature and max tokens
$ python main.py
Enter the path to the code file to review: example.py
π Reading example.py...
π File size: 37 lines
π Starting code review for: example.py
============================================================
[ββββββββββββ] Review complete! (6/6)
============================================================
============================================================
π REVIEW SUMMARY
============================================================
π Total Issues Found: 17
π Issues by Type:
π Syntax & Logic: 3 issues
π Security: 3 issues
β‘ Performance: 2 issues
ποΈ Architecture: 3 issues
π§ͺ Testing: 3 issues
π Documentation: 3 issues
β οΈ Severity Breakdown:
β’ Critical: 5 π΄
β’ Warnings: 8 π‘
β’ Suggestions: 4 π’
π‘ Key Findings:
β’ Syntax & Logic Agent: List Modification During Iteration (Lines 9-12)
β’ Security Agent: SQL Injection (Line 2)
β’ Performance Agent: O(nΒ²) Algorithm (Lines 9-12)
β’ Architecture Agent: Tight Coupling - Data access mixed with business logic
β’ Testing Agent: SQL Injection Testing (Line 2) - Security-critical code untested
β’ Documentation Agent: Missing Function Docstrings
============================================================
β
Review complete! Check the detailed report for full analysis.
============================================================
πΎ Save Options:
Save detailed report as .txt? (y/n): y
π Detailed report saved to: example_review_20241120_143022.txt
β¨ Success! Review saved to: example_review_20241120_143022.txt
Contains:
β’ Summary of issues found
β’ Detailed findings by agent
β’ Line-specific references
β’ Recommended fixes
Also save raw data as JSON? (y/n): n
π Done! Thanks for using Code Review Council.The system generates two types of output:
-
Text Report (Recommended)
- Human-readable format
- Includes line numbers and code references
- Detailed analysis from each agent
- Code examples and fixes
- Example:
example_review_20241120_143022.txt
-
JSON File (Optional)
- Raw data for integration with other tools
- Machine-readable format
- Example:
ReviewResults.json
Claude Haiku 3.5 is very affordable:
- ~$0.25 per million input tokens
- ~$1.25 per million output tokens
- A typical code review costs less than $0.01
"API key not found" error
- Make sure you ran
python setup.pyand entered your key - On Windows, restart your terminal after setup
"No module named 'anthropic'" error
- Run:
pip install anthropic
"File not found" error
- Make sure the file path is correct
- Try using the full path to your code file