---
title: "Deploy PR-Agent"
description: "AI pull-request reviewer for GitHub and GitLab, using your own LLM key"
category: "AI/ML"
url: https://railway.com/deploy/pr-agent
---

# Deploy PR-Agent

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

**[Deploy PR-Agent on Railway](https://railway.com/template/pr-agent)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/pr-agent/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### PR-Agent https://cdn.jsdelivr.net/gh/The-PR-Agent/pr-agent@v0.50.0/docs/static/img/logo.png

- **Source:** https://github.com/aalfath/pr-agent-railway-template
- **Health check:** /
- **Public domain:** Yes

## Documentation

# 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

* PR-Agent source and release notes: https://github.com/The-PR-Agent/pr-agent/releases/tag/v0.50.0
* GitHub App setup (upstream docs): https://github.com/The-PR-Agent/pr-agent/blob/v0.50.0/docs/docs/installation/github.md
* GitLab webhook setup (upstream docs): https://github.com/The-PR-Agent/pr-agent/blob/v0.50.0/docs/docs/installation/gitlab.md
* Template repository: https://github.com/aalfath/pr-agent-railway-template

### 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 &amp; 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.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/pr-agent
