---
title: "af-runner"
description: "Atoll Forge runner"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# af-runner

<!-- Generated by tools/gen-reference.mjs from `af-runner --help`. Change the help text in crates/atoll-forge-runner/src/main.rs, then run `npm run gen:reference`. -->

Runs jobs for the forge that enrolled it: the checks that gate changes before they land, and release builds. Each job runs in its own sandbox on this machine, and its result goes back to the forge.

To set up a runner, create its key with `af-runner key`, have an administrator enroll it with `af enroll-runner`, then start it with `af-runner run`.

## Usage

```text
af-runner <COMMAND>
```

## Commands

| Command | What it does |
| --- | --- |
| [`key`](#af-runner-key) | Create the runner's key and print its public key |
| [`machine`](#af-runner-machine) | Print this machine's identity, for enrolling an agent runner |
| [`run`](#af-runner-run) | Connect to the forge and run the jobs it assigns |

## Examples

```sh
af-runner key /etc/af-runner/key
af enroll-runner <PUBLIC_KEY> --name build-01
af-runner run --address forge.example.com:7777 --id <RUNNER_ID> \
    --key /etc/af-runner/key --work /var/lib/af-runner --system /usr --capacity 4
```

## af-runner key {#af-runner-key}

Create the runner's key and print its public key

Writes a new Ed25519 private key to FILE, readable by its owner only, and prints the public key in hex. Give the public key to an administrator, who enrolls the runner with `af enroll-runner`.

### Usage

```text
af-runner key <FILE>
```

### Arguments

- `<FILE>`

  File to write the private key to

## af-runner machine {#af-runner-machine}

Print this machine's identity, for enrolling an agent runner

The machine is the HMAC-SHA256 of a fixed text keyed by the machine's id, in hex: the forge compares it with the machines of its own nodes, to keep an organization's runner off them, and never sees the id itself. Give it to an administrator with the public key, who enrolls the agent runner with `af enroll-agent-runner --machine`.

### Usage

```text
af-runner machine [OPTIONS]
```

### Options

- `--machine-id-file <MACHINE_ID_FILE>`

  The file to read the machine's id from, at least 16 characters that are not whitespace, instead of /etc/machine-id

  For a development forge and a runner on one host, which share the machine's id: naming another file gives the runner a machine of its own, and is logged as a warning to standard error.

## af-runner run {#af-runner-run}

Connect to the forge and run the jobs it assigns

Runs until it is interrupted or terminated (SIGINT or SIGTERM). On stopping, it hands its unfinished jobs back to the forge so that other runners can take them. If the connection drops or the server is briefly unavailable, it reconnects and resumes the jobs it holds. It stops if the forge refuses it, for example after an administrator stops the runner with `af stop`.

Each job's check runs in a sandbox that sees the job's files, the host paths given with --system (read-only) and the variables given with --env.

### Usage

```text
af-runner run [OPTIONS] --id <ID> --key <KEY> --work <WORK>
```

### Options

- `--address <ADDRESS>`

  Server address, as host:port

  The port is the server's WebSocket port.

  Default: `127.0.0.1:7777`

- `--quic-port <QUIC_PORT>`

  Server's WebTransport port, if it differs from the --address port

- `--cert-hash <CERT_HASH>`

  SHA-256 fingerprint, in hex, of a self-signed server certificate to trust

- `--websocket-only`

  Connect over WebSocket only, never WebTransport

  Use this where UDP traffic cannot reach the server.

- `--id <ID>`

  Runner ID, in hex, given when its enrollment took effect

- `--key <KEY>`

  Private key file created by `af-runner key`

- `--capacity <CAPACITY>`

  Number of jobs to run at once

  Default: `1`

- `--work <WORK>`

  Directory for the files of the jobs being run

- `--system <SYSTEM>`

  Host path that checks can read, at the same path

  Mounted read-only in each job's sandbox: typically the toolchain and the system libraries a build needs, such as `/usr`. Repeat for several paths.

- `--env <ENV>`

  Environment variable for checks, as NAME=value

  Repeat for several variables.

Source: https://docs.forge.workreef.dev/reference/af-runner/index.mdx
