Deploy PR-Agent

AI pull-request reviewer for GitHub and GitLab, using your own LLM key

Deploy PR-Agent

Deploy and Host PR-Agent on Railway

PR-Agent is an open-source AI reviewer for pull requests, MIT-licensed, from The PR Agent project. When a PR is opened, it writes the description, reviews the code and suggests fixes as comments. You can also call it from any PR with /review, /describe, /improve or /ask. It works with GitHub and GitLab and any OpenAI-compatible LLM.

About Hosting PR-Agent

This template runs PR-Agent v0.50.0 as one service: upstream's webhook server, built from the official image pinned by digest. PR-Agent is stateless. Settings are variables and every result is posted on the PR, so it needs no database and no volume. Railway gives it a public HTTPS URL for GitHub or GitLab to call. A webhook secret is generated on each deploy, and the server rejects every unsigned request, so nobody else can spend your LLM key. You bring the LLM key. After the first deploy, you create a GitHub App that points at your URL, or add a GitLab webhook, and paste its credentials into the variables.

Common Use Cases

  • Automatic description and review of every new pull request in your organization
  • On-demand /improve code suggestions and /ask questions about a change, with your own LLM provider and model
  • A self-hosted alternative to paid AI review bots, for private repositories on GitHub or GitLab

Dependencies for PR-Agent Hosting

  • An API key for an OpenAI-compatible LLM provider (OpenAI, OpenRouter, Groq, DeepSeek, or your own vLLM or Ollama endpoint)
  • A GitHub account that can create a GitHub App, or a GitLab access token with the api scope

Deployment Dependencies

Implementation Details

Service: PR-Agent (public). It runs upstream's github_app image with gunicorn on $PORT and two workers. The health check is GET /, which answers {"status":"ok"}. The service has no database or volume.

Variables: LLM_API_KEY is the only prompt. LLM_BASE_URL (default https://api.openai.com/v1) and LLM_MODEL (default gpt-5.4-mini) choose the provider and model. WEBHOOK_SECRET is generated. GIT_PROVIDER is github (default) or gitlab. GITHUB_APP_ID and GITHUB_PRIVATE_KEY stay empty until you create the app. GITLAB_TOKEN and GITLAB_URL are for GitLab.

After deploy (GitHub):

  1. Open the service URL. It answers {"status":"ok"}.
  2. Create a GitHub App (Settings → Developer settings → GitHub Apps) with these settings:
    • Webhook URL: https://YOUR-DOMAIN/api/v1/github_webhooks
    • Webhook secret: the service's WEBHOOK_SECRET value
    • Permissions: Pull requests and Issues read & write; Contents and Metadata read-only
    • Events: Issue comment, Pull request, Pull request review, Pull request review comment, Push
  3. Set GITHUB_APP_ID and GITHUB_PRIVATE_KEY (the PEM file's content) in Railway, then install the app on your repositories.

After deploy (GitLab): set GIT_PROVIDER=gitlab and GITLAB_TOKEN. Then add a project or group webhook to https://YOUR-DOMAIN/webhook, with WEBHOOK_SECRET as its secret token and the Comments and Merge request events selected.

Tuning: set any PR-Agent setting as a SECTION__KEY variable (for example PR_REVIEWER__REQUIRE_TESTS_REVIEW=false), or put a .pr_agent.toml in a repository.

Resources: the server idles at about 290 MB, and one review peaked at about 310 MB on Railway's 0.5 GB plan. Use 1 GB for busy repositories.

Updates: the service builds from the template repository. When we bump the pinned PR-Agent image, Railway shows you an "update available" notice, and the repository's CHANGELOG.md lists breaking changes first.

Why Deploy PR-Agent on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying PR-Agent on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

Tracklayer
1