A walkthrough of PR Agent, an open-source AI code reviewer (formerly a commercial product, now donated to the community, ~13k GitHub stars) that describes, reviews, and improves pull requests. The host sets it up as a GitHub Action with an OpenAI key and GitHub token, then tunes it with a .pr_agent.toml file to get committable code suggestions, dynamic context expansion, and self-reflection scoring. His verdict: it replaces the lazy "review this PR thoroughly" prompt he'd been using, and it's good enough to take over his private projects, though it still lacks CodeRabbit's one-click apply-all-suggestions button.
- PR Agent lives under its own GitHub org, was previously a paid product that big companies used, and was contributed to the community in full — so it can be self-hosted and pointed at any LLM, your own subscription, or a local model.
- It works with GitHub, GitLab, Bitbucket, and Azure DevOps, and the command names mirror what it does: describe, review, improve.
- For oversized PRs it runs token-aware compression in a set order — deleted files first, then hunks and patches, dropping images, packages, and binaries — before anything hits the model; model, size, fallback models, timeouts, and token limits are all configurable.
- Setup is a GitHub Action: drop a pr_agent YAML under .github/workflows, add an OpenAI key secret, and the GitHub token is picked up automatically; the action pulls the prebuilt image from Docker Hub.
- Default output includes a human-oriented "review effort" score, a review guide, and collapsed code suggestions tagged by impact.
- To get suggestions you can apply straight from the PR discussion, set committable code suggestions to true — either as a manual trigger flag or, better, in a .pr_agent.toml config file.
- The host lost roughly an hour because he named the config file PR_agent_toml instead of .pr_agent.toml, and it silently failed to load.
- Extra features: pluggable skills (e.g. Terraform review guidance) that can be scoped to paths and token-capped, dynamic context that expands code around the diff so the model understands it, and a self-reflection step where the agent scores its own output.
- The one missing piece versus CodeRabbit (the channel's sponsor, which the host pays for at work) is an "approve all changes" checkbox to apply every suggestion at once.
The clearest explanation of the mechanism that makes the tool practical on large, AI-generated diffs.
If the PR is small enough, no problems. If it's too large, as AI changes tend to get, it'll start compressing, starting with deleted files, onto hunks and patches, ditch images, compressed packages and binaries, and basically running through a cleanup before it hits your token-consuming machine.
The one config change that closes the gap with paid tools, plus the exact gotcha most people will hit.
I called this file PR underscore agent underscore toml and could not figure out why it won't work for the better part of the next hour. Draw your own conclusions.
This is the code prompt I added, basically saying, 'Review the changes in this pull request thoroughly.' Well done, mate. You nailed it.
The PR agent interacts with GitHub, GitLab, and Bitbucket if you took a wrong turn in life, even Azure DevOps if it was more than one turn.
PR agent is not the only option in the open source space, not even the popular one if you count stars alone, but it's the one I currently trust.