| title | AI Code Review Assistant |
|---|---|
| emoji | 🤖 |
| colorFrom | blue |
| colorTo | green |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
An AI agent that integrates with GitHub, reviews pull requests in real-time, detects potential bugs, security vulnerabilities, code smells, and performance bottlenecks, and then generates actionable inline review comments automatically.
Judges / Reviewers: Watch the AI in action below!
- Real-time Automated Reviews: Listens to GitHub webhooks (
pull_requestevents) to review code as soon as a PR is opened or updated. - Deep Code Analysis: Uses AI to analyze git diffs for bugs, logic errors, security vulnerabilities, code smells, and performance bottlenecks.
- One-Click "Suggested Changes" (Auto-Fixes): Provides direct code fixes using GitHub's
suggestionsyntax, allowing developers to accept fixes with a single click. - Automated PR Summaries & Release Notes: Generates a high-level summary of what changed, why it matters, and potential impact.
- Custom Rules & Configurations (
.code-reviewer.yml): Enforce custom coding standards, style guides, or ignoring specific files using a repo-level config file. - Context-Aware Reviewing (RAG): Fetches the full file content (not just the diff) for deeper, architectural understanding before reviewing.
- Automated Test Generation: Suggests unit tests for newly added or modified code.
- Interactive Chat / Q&A: Tag the bot or reply to its comments on the PR to ask follow-up questions, request clarifications, or discuss design decisions.
- Multi-LLM Support: Built with
litellmto easily switch between Google Gemini, OpenAI (GPT-4o), and Anthropic (Claude). - FastAPI Backend: Built on Python and FastAPI for blazing fast, asynchronous webhook processing.
- Backend: Python 3.11, FastAPI, Uvicorn
- AI Integration: LiteLLM (Supports Gemini 1.5 Pro, GPT-4o, Claude 3.5 Sonnet)
- GitHub Integration: PyGithub (GitHub App/PAT Support)
- Deployment: Docker
git clone https://github.com/sasikumar161106/AI_Powered_Code_Review_Assistant.git
cd AI_Powered_Code_Review_AssistantCopy the .env.example file to .env:
cp .env.example .envFill in the necessary keys in .env:
GEMINI_API_KEY: Get this from Google AI Studio.GITHUB_APP_ID: The ID of your GitHub App.GITHUB_PRIVATE_KEY_PATH: Path to your downloaded GitHub App private key (.pemfile).GITHUB_WEBHOOK_SECRET: Optional secret to verify GitHub payloads.
Make sure you have Python 3.11+ installed.
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# Windows:
.\venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start the FastAPI server
python main.pyIf you prefer Docker, you can build and run the application container:
docker build -t ai-code-reviewer .
docker run -p 8000:8000 --env-file .env ai-code-reviewerRunning locally requires keeping your PC awake. Deploying to Hugging Face Spaces is 100% free and doesn't require a credit card.
- Create a free account at HuggingFace.co.
- Go to your profile and click New Space.
- Give your Space a name (e.g.,
ai-code-reviewer). - Important: For the Space SDK, choose Docker, then select Blank.
- Set Space Hardware to the free "CPU basic". Click Create Space.
- Follow their instructions to push your repository to the Space, or simply upload your files via the UI.
- Go to your Space's Settings -> Variables and secrets.
- Under Secrets, add your API keys:
GEMINI_API_KEYGITHUB_APP_IDGITHUB_PRIVATE_KEY(copy the full content of the.pemfile)GITHUB_WEBHOOK_SECRET
- Once the Space builds and says "Running", click the "Embed this Space" (three dots menu at the top right) to find the Direct URL (it looks like
https://username-ai-code-reviewer.hf.space). - Update your GitHub App Settings so the Webhook URL points to:
https://username-ai-code-reviewer.hf.space/api/v1/webhook.
You're done! The agent will now run 24/7 for free.
Since your local server runs on localhost:8000, GitHub cannot send webhooks directly to it. You need to expose it using a tunneling tool like ngrok.
- Download and install ngrok.
- Run ngrok to tunnel port 8000:
ngrok http 8000
- Copy the public URL provided by ngrok (e.g.,
https://1a2b3c.ngrok.app). - In your GitHub App Settings, set the Webhook URL to:
https://1a2b3c.ngrok.app/api/v1/webhook
- A developer opens or updates a Pull Request.
- GitHub sends a webhook payload to the
/api/v1/webhookendpoint. - The app fetches the changed files and parses the git diffs.
- The diffs are sent to Google Gemini for analysis based on strict review prompts.
- The AI returns structured JSON containing review comments mapped to exact line numbers.
- The app uses the GitHub API to post the inline comments on the PR!



