Skip to main content

Reviewer Agent

A code review agent that automatically reviews open pull requests, runs checks, fixes failures, and merges approved PRs.

Setup

  1. Copy agent-config.toml and ACTIONS.md into agents/reviewer/ in your project
  2. Edit agent-config.toml:
    • Set orgs to your GitHub organization
    • Set author in [params] to filter PRs by author (optional)
  3. Run al doctor to verify credentials

Trigger modes

Webhook (recommended): Fires on PR events (opened, synchronize, ready_for_review) and when check suites complete. Requires a GitHub webhook configured in config.toml — see Webhooks docs. Scheduled: Runs on a cron schedule (default: hourly). Searches for open PRs across the configured organization.

How it works

Each run, the agent works on one PR:
  1. Finds a PR to review (from webhook trigger or scheduled search)
  2. Acquires a resource lock to prevent duplicate reviews
  3. Clones the repo and checks out the PR branch
  4. Reviews code for security issues and quality
  5. Runs tests, lint, and build — fixes failures (up to 3 rounds)
  6. Squash-merges if all checks pass, or comments with issues found

Custom Dockerfile

The reviewer agent uses the gh CLI, which isn’t in the base image. Add a Dockerfile to the agent directory (only needed for Docker mode):
FROM al-agent:latest
USER root
RUN apk add --no-cache github-cli
USER node