How it works
Each runner:- Registers with the main server using a Runner Token (Better Auth API key)
- Sends periodic heartbeats to report availability
- Polls for pending tasks
- Executes reviews inside an isolated Docker container
- Reports task status and results back to the server
Prerequisites
- Docker installed and accessible on the runner host
- Network connectivity from the runner host to the main server
- A valid API key created in the main server (used as
RUNNER_TOKEN)
Environment variables
| Variable | Required | Description |
|---|---|---|
RUNNER_SERVER_URL | Yes | URL of the main AI Review server |
RUNNER_TOKEN | Yes | Better Auth API key from the main server |
RUNNER_NAME | Yes | Unique name for this runner instance |
DOCKER_EXECUTOR_IMAGE | Yes | Docker image used to execute reviews |
RUNNER_MAX_CONCURRENT_JOBS | No | Maximum number of simultaneous review jobs |
RUNNER_CLONE_DEPTH | No | Git clone depth for repository checkouts |
RUNNER_POLL_INTERVAL_MS | No | How often the runner polls for new tasks (ms) |
RUNNER_POLL_TIMEOUT_MS | No | Timeout for each poll request (ms) |
RUNNER_HEARTBEAT_INTERVAL_MS | No | How often the runner sends heartbeats (ms) |
RUNNER_REQUEST_TIMEOUT_MS | No | Timeout for requests to the main server (ms) |
DOCKER_MEMORY_LIMIT | No | Memory limit for executor containers |
DOCKER_CPU_LIMIT | No | CPU limit for executor containers |
DOCKER_NETWORK_MODE | No | Docker network mode for executor containers |
DOCKER_WORKSPACE_BASE | No | Base path for runner workspaces |
DOCKER_TIMEOUT_SECONDS | No | Timeout for container execution (seconds) |
DOCKER_POOL_SIZE | No | Number of pre-warmed executor containers |
DOCKER_HOST | No | Docker daemon socket or host |
Setup
Create a Runner Token
In the main server’s admin interface, create a Better Auth API key. This value will be used as
RUNNER_TOKEN.Build the runner and executor images
ai-review-runner image and the ai-review-executor image used for isolated task execution.Docker socket requirement
Network requirements
The runner must be able to reach the main server atRUNNER_SERVER_URL. When running locally with Docker, http://host.docker.internal:3000 resolves to the host machine. For remote deployments, use the server’s actual hostname or IP address.
Scaling runners
To run multiple runner instances, start additional containers with uniqueRUNNER_NAME values. Each instance registers independently and picks up tasks from the shared queue.
Task concurrency
Control how many review jobs a single runner processes at the same time usingRUNNER_MAX_CONCURRENT_JOBS. Tune this based on available CPU, memory, and the Docker resource limits configured for executor containers.