The-PR-Agent/pr-agent

🚀 PR Agent: The Original Open-Source PR Reviewer. This project is not the Qodo free tier.

The‑PR‑Agent / PR‑Agent

What it is – An open‑source, AI‑powered “code‑review bot” that can automatically comment on pull‑requests (or issues) with summaries, reviews, suggestions, or answers to free‑form questions. It talks to large language models (OpenAI, Anthropic, Gemini, Mistral, Ollama, etc.) via LiteLLM and posts the results back to the Git provider.

Why you might want it

  • Fast & cheap – each operation (/review, /improve, /ask, …) makes a single LLM call (≈30 s, low token cost).
  • Works on any size PR – uses a “PR compression” step to fit large diffs into the model context.
  • Highly configurable – prompts are defined in a JSON/TOML file, so teams can tailor the review categories, tone, or add custom checks.
  • Runs everywhere – GitHub, GitLab, Bitbucket, Azure DevOps, Gitea; usable as a GitHub Action, Docker container, self‑hosted service, or a local CLI tool.
  • Open‑source & self‑hosted – you keep full control of your code and API keys; no vendor lock‑in.

Key features

  • /describe – generates a short summary of what the PR changes.
  • /review – produces a conventional code‑review comment (style, bugs, tests, etc.).
  • /improve – suggests concrete improvements or refactorings.
  • /ask "…" – free‑form Q&A about the PR.
  • /similar_issue – finds existing issues that resemble the current one.
  • Supports many LLM providers (OpenAI, Claude, Gemini, DeepSeek, Mistral, Azure OpenAI, AWS Bedrock, Vertex AI, Ollama, OpenRouter, …) via the LiteLLM abstraction.
  • JSON‑based prompt configuration for easy customization.
  • Docker images (pragent/pr-agent) for quick deployment.

Getting started

  1. GitHub Action (recommended) – add a workflow file that runs the action on pull_request events and provides OPENAI_KEY (or another provider key) and GITHUB_TOKEN.
    name: PR Agent
    on:
      pull_request: { types: [opened, synchronize] }
    jobs:
      pr_agent:
        runs-on: ubuntu-latest
        steps:
          - uses: the-pr-agent/pr-agent@main
            env:
              OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    
  2. Local CLI – install with pip install "pr-agent[github]", set OPENAI_KEY, then run:
    pr-agent --pr_url https://github.com/owner/repo/pull/123 review
    
    Extras exist for other providers (pr-agent[gitlab], pr-agent[bitbucket], etc.) or pr-agent[all] for everything.
  3. Other platforms – the docs provide webhook/app setup for GitLab, Bitbucket, Azure DevOps, and Gitea.

How it works

  • The tool fetches the PR diff, compresses it to fit the model context, builds a prompt (customizable via configuration.toml), sends it to the chosen LLM, and posts the model’s response as a comment on the PR/issue.
  • A diagram in the docs shows the flow: fetch → compress → prompt → LLM → comment.

Data privacy

  • When self‑hosted, the only data sent outside your environment is the request to the LLM provider (e.g., OpenAI). The provider’s enterprise privacy policy applies.

Community & contribution

  • The project is community‑maintained, sponsored by Qodo (Gold sponsor). Contributions are welcomed via the usual GitHub pull‑request process; tests can be run locally with uv run pytest.

Useful links


All information above is taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project