The-PR-Agent / pr-agent

The Original Open-Source PR Reviewer This repository contains the open-source PR Agent Project. It is not the Qodo offering for open-source projects. PR-Agent is an open-source, AI-powered code review agent and a community-maintained legacy project of Qodo. It is distinct from Qodo’s primary AI code review offering, which provides a feature-rich, context-aware experience. Qodo offers a free version for open-source projects and integrates seamlessly with GitHub, GitLab, Bitbucket, and Azure DevOps for high-quality automated reviews.

最初的开源 PR 审查器。此存储库包含开源 PR Agent 项目。它并非 Qodo 为开源项目提供的产品。PR-Agent 是一个由 AI 驱动的开源代码审查代理,也是 Qodo 社区维护的遗留项目。它与 Qodo 的主要 AI 代码审查产品不同,后者提供功能丰富且具备上下文感知能力的体验。Qodo 为开源项目提供免费版本,并与 GitHub、GitLab、Bitbucket 和 Azure DevOps 无缝集成,以实现高质量的自动化审查。

Sponsors PR-Agent is a community-maintained open-source project, with its ongoing development supported by our sponsors. If you’d like to support the project, consider becoming a sponsor. 🥇 Gold Sponsor Free version of Qodo for open-source projects Table of Contents Getting Started Why Use PR-Agent? Features See It in Action How It Works Data Privacy Contributing

赞助商。PR-Agent 是一个由社区维护的开源项目,其持续开发得到了赞助商的支持。如果您想支持该项目,请考虑成为赞助商。🥇 金牌赞助商:Qodo 为开源项目提供的免费版本。目录:入门指南、为什么要使用 PR-Agent?、功能、查看实际效果、工作原理、数据隐私、贡献。

Getting Started NoteDocker Hub namespace migration. Releases 0.34.2 and later are published under pragent/pr-agent. Older releases (up to and including v0.31) remain available at the legacy codiumai/pr-agent namespace as a frozen archive — no new images are pushed there. Update any pinned image: / docker pull / uses: docker:// references when upgrading to 0.34.2+.

入门指南。关于 Docker Hub 命名空间迁移的说明:0.34.2 及更高版本的发布版本在 pragent/pr-agent 下发布。旧版本(包括 v0.31 及之前版本)仍可在旧的 codiumai/pr-agent 命名空间中作为冻结存档获取,该处不再推送新镜像。升级到 0.34.2+ 时,请更新任何固定的镜像引用(如 docker pull 或 uses: docker://)。

🚀 Quick Start for PR-Agent 1. GitHub Action (Recommended) Add automated PR reviews to your repository with a simple workflow file: # .github/workflows/pr-agent.yml name: PR Agent on: pull_request: types: [opened, synchronize] jobs: pr_agent_job: runs-on: ubuntu-latest steps: - name: PR Agent action step uses: the-pr-agent/pr-agent@main env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Full GitHub Action setup guide

🚀 PR-Agent 快速入门。1. GitHub Action(推荐):通过简单的 workflow 文件为您的存储库添加自动化 PR 审查:# .github/workflows/pr-agent.yml name: PR Agent on: pull_request: types: [opened, synchronize] jobs: pr_agent_job: runs-on: ubuntu-latest steps: - name: PR Agent action step uses: the-pr-agent/pr-agent@main env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}。查看完整的 GitHub Action 设置指南。

  1. CLI Usage (Local Development) Run PR-Agent locally on your repository: pip install “pr-agent[github]” export OPENAI_KEY=your_key_here pr-agent —pr_url https://github.com/owner/repo/pull/123 review Git provider SDKs are optional extras: install the one for your provider (list), or pr-agent[all] for every integration. Complete CLI setup guide

  2. CLI 使用(本地开发):在您的存储库上本地运行 PR-Agent:pip install “pr-agent[github]” export OPENAI_KEY=your_key_here pr-agent —pr_url https://github.com/owner/repo/pull/123 review。Git 提供商 SDK 是可选的额外组件:安装您所用提供商的 SDK(列表),或使用 pr-agent[all] 进行全面集成。查看完整的 CLI 设置指南。

  3. Other Platforms GitLab webhook setup BitBucket app installation Azure DevOps setup News and Updates Full notes for every release are on the Releases page. Why Use PR-Agent? 🎯 Built for Real Development Teams Fast & Affordable: Each tool (/review, /improve, /ask) uses a single LLM call (~30 seconds, low cost) Handles Any PR Size: Our PR Compression strategy effectively processes both small and large PRs Highly Customizable: JSON-based prompting allows easy customization of review categories and behavior via configuration files

  4. 其他平台:GitLab webhook 设置、BitBucket 应用安装、Azure DevOps 设置。新闻与更新:每个版本的完整说明均可在“发布”页面查看。为什么要使用 PR-Agent?🎯 为真实的开发团队打造。快速且经济:每个工具(/review, /improve, /ask)仅使用一次 LLM 调用(约 30 秒,成本低)。处理任何规模的 PR:我们的 PR 压缩策略可有效处理小型和大型 PR。高度可定制:基于 JSON 的提示词允许通过配置文件轻松自定义审查类别和行为。

Platform Agnostic: Git Providers: GitHub, GitLab, BitBucket, Azure DevOps, Gitea Deployment: CLI, GitHub Actions, Docker, self-hosted, webhooks AI Models: OpenAI GPT, Anthropic Claude, Google Gemini, DeepSeek, Mistral, and any other model reachable through LiteLLM (Azure OpenAI, AWS Bedrock, Vertex AI, Databricks, OpenRouter, Ollama, and more) — see Changing a model Open Source Benefits: Full control over your data and infrastructure Customize prompts and behavior for your team’s needs No vendor lock-in Community-driven development

平台无关性:Git 提供商:GitHub、GitLab、BitBucket、Azure DevOps、Gitea。部署方式:CLI、GitHub Actions、Docker、自托管、webhooks。AI 模型:OpenAI GPT、Anthropic Claude、Google Gemini、DeepSeek、Mistral 以及任何可通过 LiteLLM 访问的模型(Azure OpenAI、AWS Bedrock、Vertex AI、Databricks、OpenRouter、Ollama 等)——请参阅“更改模型”。开源优势:完全掌控您的数据和基础设施;根据团队需求自定义提示词和行为;无供应商锁定;社区驱动的开发。

Features See the current feature and git provider support matrix in the PR-Agent documentation. ⚠️ /help_docs is temporarily disabled since v0.36.1 pending a fix for a credential-exposure issue (#2445). See It in Action /describe /review /improve Usage Examples PR-Agent tools run as a comment on a PR or from the CLI. A few common ones: # Comment on a PR (GitHub/GitLab/Bitbucket/…): /describe /review /improve /ask “What does this PR change?” # free-text Q&A about the PR # Issue-scoped commands run on an issue instead of a PR: /similar_issue # find similar issues in the repository # Or locally via the CLI: pr-agent —pr_url <PR_URL> review pr-agent —issue_url <ISSUE_URL> similar_issue See the Tools docs for the full list of tools with example commands, and each tool’s page for screenshots and options.

功能:在 PR-Agent 文档中查看当前功能和 Git 提供商支持矩阵。⚠️ 自 v0.36.1 起,/help_docs 已暂时禁用,等待修复凭据泄露问题 (#2445)。查看实际效果:/describe、/review、/improve。使用示例:PR-Agent 工具作为 PR 上的评论或通过 CLI 运行。一些常见用法:# 在 PR 上评论 (GitHub/GitLab/Bitbucket/…): /describe /review /improve /ask “What does this PR change?” # 关于 PR 的自由文本问答。# 针对 Issue 的命令(在 Issue 而非 PR 上运行):/similar_issue # 在存储库中查找相似的 Issue。# 或通过 CLI 本地运行:pr-agent —pr_url <PR_URL> review pr-agent —issue_url <ISSUE_URL> similar_issue。查看工具文档以获取工具完整列表及示例命令,并查看每个工具的页面以获取截图和选项。

How It Works The following diagram illustrates PR-Agent tools and their flow: Data Privacy Self-hosted PR-Agent If you host PR-Agent with your OpenAI API key, it is between you and OpenAI. You can read their API data privacy policy here: https://openai.com/enterprise-privacy

工作原理:下图展示了 PR-Agent 工具及其流程:数据隐私。自托管 PR-Agent:如果您使用自己的 OpenAI API 密钥托管 PR-Agent,则数据仅在您与 OpenAI 之间传输。您可以在此处阅读其 API 数据隐私政策:https://openai.com/enterprise-privacy

Contributing To contribute to the project, get started by reading our Contributing Guide. For local verification, run PYTHONPATH=. uv run pytest from the repository root; it discovers the unit-test suite under tests/unittest by default. End-to-end tests under tests/e2e_tests require provider credentials and should be invoked explicitly, for example PYTHONPATH=. uv run pytest tests/e2e_tests/test_github_app.py.

贡献:要为项目做出贡献,请先阅读我们的贡献指南。如需进行本地验证,请从存储库根目录运行 PYTHONPATH=. uv run pytest;它默认会发现 tests/unittest 下的单元测试套件。tests/e2e_tests 下的端到端测试需要提供商凭据,应显式调用,例如 PYTHONPATH=. uv run pytest tests/e2e_tests/test_github_app.py。

Big News for PR-Agent PR-Agent has a new home! After years of building this tool alongside the community, Qodo has donated PR-Agent to the open-source community - and we couldn’t be more excited about what comes next. The project now lives in the PR-Agent org on GitHub, is fully community-owned, and is open for contributions and additional maintainers. What else changed: Docs moved to - docs.pr-agent.ai Qodo Merge (Qodo 1.0), the hosted URL, which was the enterprise version of PR-Agent, has been rebranded and evolved into Qodo (Qodo 2.0), a full AI code review platform.

PR-Agent 的重大新闻:PR-Agent 有了新家!在与社区共同构建该工具多年后,Qodo 已将 PR-Agent 捐赠给开源社区——我们对未来的发展感到无比兴奋。该项目现在位于 GitHub 上的 PR-Agent 组织中,完全由社区所有,并开放贡献和招募额外维护者。其他变化:文档已迁移至 docs.pr-agent.ai;作为 PR-Agent 企业版的托管 URL Qodo Merge (Qodo 1.0) 已更名并演进为 Qodo (Qodo 2.0),这是一个完整的 AI 代码审查平台。

❤️ Community This open-source release remains here as a community contribution from Qodo — the origin of modern AI-powered code collaboration. We’re proud to share it and inspire developers worldwide. The project now has its first external maintainer, Naor (@naorpeled), and is currently in the process of being donated to an open-source foundation.

❤️ 社区:此开源版本作为 Qodo 的社区贡献保留在此——Qodo 是现代 AI 驱动代码协作的起源。我们很自豪能分享它并激励全球开发者。该项目现在有了第一位外部维护者 Naor (@naorpeled),目前正处于捐赠给开源基金会的过程中。