AI PR Review
AI-powered pull request review using multiple LLM agents. Posts a summary comment and inline findings directly on your PRs.
Multi-Agent Review
Up to 9 specialized AI agents analyze your code from different perspectives: architecture, security, edge cases, and more.
18 Static Analyzers
Shellcheck, semgrep, trufflehog, ruff, golangci-lint, hadolint, checkov, phpcs, phpstan, kube-linter, and tflint ship as binaries in the container image. ESLint runs only when you install it. cve-check, dep-exists, suppression-check (comments that turn off a security rule), and three documentation analyzers (docs-api-check, docs-ref-check, and docs-drift-check) also run. All 18 run as native Python.
Works Everywhere
GitHub Actions, Bitbucket Cloud Pipelines, and GitLab CI/CD. Anthropic, OpenAI, Google, and Bedrock proxy providers.
One-Click Fixes
Code suggestion buttons let PR and MR authors accept fixes with one click. They use the suggestion block syntax of GitHub and GitLab.
What it does
On every push to a pull request, AI PR Review runs a roster of LLM agents and deterministic static analyzers against the diff, then posts a structured review. The review has a summary comment and inline findings with “Apply suggestion” buttons where they apply. The review is incremental: later pushes review only what changed. A JSON rules file suppresses known false positives. The tool continues without error if a model times out or a scanner is missing. It runs on GitHub Actions, Bitbucket Cloud Pipelines, or GitLab CI/CD. It works with Anthropic, OpenAI, Google, or any OpenAI-compatible endpoint.
Quick start
Get AI reviews on your PRs in two steps:
1. Add your LLM API key as a repository secret named ANTHROPIC_API_KEY (or the equivalent for your provider).
2. Create .github/workflows/ai-review.yml with this minimal workflow:
name: AI PR Review
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tag1consulting/ai-pr-review/container-action@main
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
pr-number: ${{ github.event.pull_request.number }}
base-ref: ${{ github.event.pull_request.base.ref }}
head-sha: ${{ github.event.pull_request.head.sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Reviews start on the next PR.
What’s new in v2.24.1
Security: the pull request checkout can no longer shadow the engine’s Python modules. A file in a pull request, such as ai_pr_review/__main__.py or yaml.py, could run instead of the installed module and see the review’s API keys. The image and the actions now set PYTHONSAFEPATH=1. Update image-tag to 2.24.1 or leave it at latest. If you run the engine by hand, set PYTHONSAFEPATH=1 first.
See Version History → v2.24.1 for details.
What’s new in v2.24.0
A provider “prompt too long” rejection skips the review. Before, the provider rejected the prompt, every agent failed, and the comment said “2 failed agents”. Now the review stops and says which agent does not fit. Use exclude-patterns for generated files.
Behavior change: the severity icons are different shapes. Critical is ⛔, High is 🚨, Medium is 🔶, and Low is 💬. 🚨 meant Critical before. An old comment keeps its old icon until the next review rewrites it.
Bitbucket: the feedback command. /ai-pr-review feedback <text> saves a note to the learning loop, with the same authorization as the verdict commands.
Behavior change: a style finding no longer merges into a nearby security finding. A missing docblock used to absorb a security finding on a nearby line and show it as “corroborated”. Now style and documentation findings stay separate, phpcs style sniffs are Low, and fewer findings show as corroborated.
A new analyzer, suppression-check. It flags a comment that turns off a security rule, such as # noqa: S301 or # nosec. Add it to an analyzers allowlist if you use one.
See Version History → v2.24.0 for details.
What’s new in v2.23.2
Behavior change: Bitbucket verdict owners are IDs only. An @nickname on a * line of .bitbucket/CODEOWNERS no longer grants, because a nickname is not unique. List the account_id or the {uuid} instead. The review logs a warning that names each ignored nickname.
Behavior change: the owners file is read from the target branch only. AI_POLICY_SOURCE no longer applies to it, so a pull request cannot add its own author to the list. Merge a changed owners file into the target branch first.
See Version History → v2.23.2 for details.
Learn more
Start here
- Getting started: Installation, requirements, secrets and variables
- Configuration: Action inputs and LLM provider options
Optional capabilities: Three independent features. They are off by default, except context enrichment, which is on in the container action. They use the Python engine (the default since v1.0.0):
- Tree-sitter context enrichment: Adds the symbol definitions that the diff references to the agent prompts. This reduces invented “should check X” findings.
- SARIF 2.1.0 ingestion: Merges findings from external scanners (CodeQL, Semgrep, Trivy, Bandit) into the same dedup and post pipeline as native analyzers.
- Learning loop: Reviewers post
/ai-pr-review false-positive | wont-fix | feedbackto save verdicts to a dedicated git branch. Later reviews see them as a<repo-feedback>block.
Reference
- Features: Code suggestions, incremental reviews, resilience, token usage
- Version History: What changed in each release
- Agents & profiles: Review agents, severity icons, review modes, language profiles
- Static analyzers: Analyzer table, dependency vulnerability check, SARIF ingestion
- Suppression rules: Suppress false positives with JSON rules. Scope a rule to a line range with
match.line_startandmatch.line_end(v1.1.0) - Diff-scope severity cap: Use
analyzer-diff-scopeto control how the tool handles out-of-diff native-analyzer findings (v1.2.0) - Slash commands: PR-comment commands (rescan, review-full, skip, dismiss, help, plus learning-loop commands)
Internals
- Architecture: Directory tree, data flow, dependencies
- Local development: Run the container locally against any PR
Contributing
- Contributing guide: Step-by-step recipes for adding analyzers, agents, language profiles, and VCS providers
- Internal architecture reference: Deep implementation details for maintainers