Automated pull request code review powered by a multi-agent LangGraph pipeline and a Streamlit Web Interface.
This system leverages four specialized AI agents that execute in parallel to analyze pull requests across multiple dimensions: security, bugs, performance, and style. An orchestration layer synthesizes the findings into actionable insights.
When a pull request is submitted for review, the AI Code Reviewer initiates a parallel execution pipeline:
- Security Analysis: Scans for hardcoded secrets, SQL injection vectors, cross-site scripting (XSS), authentication bypasses, and insecure cryptography.
- Defect Detection: Identifies potential null pointer dereferences, off-by-one errors, unhandled exceptions, and resource leaks.
- Performance Profiling: Highlights N+1 query patterns, blocking asynchronous operations, missing database indexes, and potential memory leaks.
- Style Verification: Ensures compliance with styling standards, flagging missing docstrings, magic numbers, overly complex functions, and dead code.
The orchestrator deduplicates the findings and ranks them by severity. Results are dynamically rendered in the Streamlit web dashboard and can optionally be posted as inline GitHub PR comments.
The application is built on a directed acyclic graph (DAG) architecture using LangGraph, allowing for highly concurrent agent execution.
- Diff Parsing: The system splits unified diffs into per-file chunks, safely bypassing binary and lock files.
- Parallel Fan-out: The parsed chunks are routed to four distinct AI agents simultaneously.
- Synthesis & Orchestration: Findings from the agents are aggregated, deduplicated, and ranked by a central orchestrator node.
- Presentation Layer: The Streamlit frontend visualizes the findings interactively.
Ensure you have Python 3.11 or higher installed. Clone the repository and install the dependencies:
pip install -e .Copy the example environment configuration:
cp .env.example .envConfigure the necessary API tokens in the .env file, or provide them dynamically via the web interface:
ANTHROPIC_API_KEY=your_anthropic_api_key
GITHUB_TOKEN=your_github_tokenStart the Streamlit dashboard:
streamlit run app.pyAccess the interface at http://localhost:8501. Enter the target repository (e.g., owner/repo) and the pull request number to initiate the review process.
| Variable | Requirement | Description |
|---|---|---|
ANTHROPIC_API_KEY |
Required | Authentication token for Anthropic Claude. |
ANTHROPIC_MODEL |
Optional | Specifies the model to use (default: claude-haiku-20240307). |
GITHUB_TOKEN |
Required | GitHub token with repo and pull_requests scope. |
- Streamlit: Interactive web interface.
- LangGraph: Parallel agent orchestration.
- LangChain Anthropic: Claude LLM integration.
- PyGitHub: GitHub API communication layer.