Build an AI code review agent
A code review agent reads each pull request, comments on likely bugs, missing tests and risky changes, and posts a short summary so a human reviewer knows where to look first. It uses our coding stack: a strong coding model, an agentic coding tool that can read the whole repository, and a trigger that runs on every new or updated pull request. The bot comments; people still approve and merge.
Uses the picker's Coding assistant / vibe coding stack, with advice specific to this use case.
Recommended stack
Model
- Anthropic Claude Sonnet 5.5: ~$2 in / $10 out per 1M tokens (verified 2026-11-22 on anthropic.com/pricing)
- OpenAI GPT-6.1 Sol: ~$2 in / $10 out per 1M tokens (verified 2026-11-22)
Framework
- Cursor: Free (limited); Plus $8/mo (Grok models only); Premium $30/mo adds third-party models at API list price (verified 2026-11-22)
- Claude Code: Included with Claude Pro ($20/mo, or $17/mo billed annually) and Max (from $100/mo) (verified 2026-11-22)
- Aider: Free, open source; bring your own API key
Hosting
- Vercel: Hobby $0 (personal, non-commercial); Pro $20/mo incl. $20 credit (verified 2026-11-15)
No-code alternative
Rough monthly cost
$0–40/mo (editor plan + hosting free tier)Approximate. Tool prices checked 2026-11-15.Difficulty
BeginnerSome links may be affiliate links. Disclosure
Why this stack
- Claude Code has an official GitHub Action (anthropics/claude-code-action) that can review pull requests and answer @claude mentions. It runs on your own GitHub runner and calls the model provider you configure with your API key.
- Cursor's Premium plan ($30/month) and higher plans include AI code reviews via Bugbot (cursor.com/pricing, checked 15 Nov 2026). Cursor's Agent SDK, generally available since 20 Oct 2026, also has a security-reviewer template if you want a custom review bot defined as code.
- Strong coding models such as Claude Sonnet 5.5 or GPT-6.1 Sol (both about $2 in / $10 out per 1M tokens, checked 8 Nov 2026) are good at reading diffs. Aider is a free, open-source option if you want to script reviews with your own key.
- On GitHub, standard GitHub-hosted runners are free for public repositories; private repositories draw on your plan's included Actions usage (GitHub docs, checked 15 Nov 2026).
Step-by-step
- Write a short REVIEW.md: what to flag (bugs, security issues, missing tests, breaking API changes), what to ignore (style your linter already catches), and the tone of comments.
- Install one review tool on one repository, for example the Claude Code GitHub Action, or Bugbot if you already pay for Cursor Premium. Store the API key as an encrypted repository secret.
- Trigger it when a pull request is opened or updated. Have it post one summary comment, plus inline comments only for issues it can point to with a line reference.
- Replay it on 10 recent merged pull requests, including one that later caused a bug, and check whether it would have caught the problem without burying it in noise.
- Keep a human approval rule on the branch: the bot comments, people approve and merge. Review its false positives weekly and update REVIEW.md.
Common pitfalls
- Don't let the bot approve or merge pull requests on its own. Use it as a first pass, not as the required reviewer.
- Pull request titles, descriptions, code comments and changed files are untrusted input. A pull request from a fork can carry prompt-injection text, so don't give the review job secrets or push access on untrusted pull requests.
- Never echo secrets into review comments or logs. Scope the API key to this one job and set a spend limit with your model provider.
- Large diffs cost more and get shallower reviews. Skip generated files, lockfiles and vendored code, and ask for smaller pull requests.
- Models can be confidently wrong. Ask for a reason and a line reference with every comment so reviewers can check it quickly.
FAQ
Can AI review my pull requests automatically?
Yes. Tools such as the Claude Code GitHub Action or Cursor's Bugbot can run on every new pull request and leave a summary and inline comments. Keep a human approval step before merging.
How much does an AI code reviewer cost?
It depends on the tool. Bugbot is included in Cursor Premium ($30/month) and higher plans. With the Claude Code GitHub Action you pay for model usage on your own API key, for example Claude Sonnet 5.5 at about $2 in / $10 out per 1M tokens. Standard GitHub-hosted runners are free for public repositories.
Is it safe to run an AI reviewer on pull requests from forks?
Treat fork pull requests as untrusted. Run the reviewer without secrets or write permissions, or only after a maintainer has looked at the pull request.
Try it in the picker: AI code review for my pull requests · Review my PRs automatically · PR review bot for my GitHub repo
Customise this stack in the picker →Related stacks
- Vibe-code an app with AI (Coding assistant / vibe coding)
- Build an AI uptime and log monitoring agent (AI uptime & log monitoring agent)
- Build an AI email and automation agent (Email / automation agent)
Last updated 2026-11-22.