---
title: "Enroll an agent runner"
description: "An agent runner is a machine an administrator enrolls to host agents. Make its key and its machine, have an administrator enroll it, and see what it may never do. Hosting agents is not built yet."
---

> 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.

# Enroll an agent runner

An agent runner is a machine that hosts agents: the forge will order it to start an agent's harness, and it will run the harness and tell the forge what happened. It is a different thing from [a runner](https://docs.forge.workreef.dev/runner/setup/), which runs the checks that gate each change. Like a runner it is born from the forge when an administrator enrolls it, so it is in no person's or agent's line.

> **What is built**
>
> Today an administrator can enroll an agent runner and list the ones enrolled, and the forge holds the rules below. The forge does not yet order an agent runner to host anything: there are no orders, no harness sessions and no logins. [Agent runners and the model gateway](https://docs.forge.workreef.dev/planned/agent-runners-and-gateway/) is the design.

## Make its key and say its machine

On the machine, `af-runner key` makes the agent runner's key, as it does for a runner, and prints the public key. `af-runner machine` prints the machine: the HMAC-SHA256, in hex, of a fixed text keyed by the machine's id in `/etc/machine-id`. The forge never sees the id, which `machine-id(5)` asks you not to show; it sees only this.

A development forge and the agent runner you try beside it sit on one host and share its id, and the forge refuses an agent runner on the machine of one of its own nodes. `--machine-id-file` names another file to read the id from, for the runner. The file must hold at least 16 characters that are not whitespace, and not all zeros. Naming a file that is not `/etc/machine-id` is warned of on standard error, so that a file that is not the machine's own, which defeats the check, is never a surprise.

Start a development forge to follow along:

```console server
$ af-server --dev
...
```

```console check
$ source ~/af-dev/dev/env
$ af-runner key ~/agent-runner.key | tee ~/agent-runner.pub
b1764fa8cc2c73319b9896c64be70b71bda813cd27b7397dae7750490a346e1a
$ printf 'a machine id of the docs own\n' > ~/agent-runner.machine-id
$ af-runner machine --machine-id-file ~/agent-runner.machine-id | tee ~/agent-runner.machine
warning: the machine is named from /home/you/agent-runner.machine-id, not from /etc/machine-id: that is for a development forge and a runner on one host, and a file that is not this machine's own defeats the check that keeps a runner off a node's machine
a9bb3620d60b690ae66d0e0c03ace8b16522584f2a7ed9d9a22c3d3360a7b71e
```

## Enroll it

An administrator enrolls the public key with a name, the machine and the labels an order may ask of it. The enrollment takes effect at once, on their word, unless the forge requires a second administrator to approve it. Only an administrator approves it.

```console check
$ af enroll-agent-runner "$(cat ~/agent-runner.pub)" --name rack-3 --machine "$(cat ~/agent-runner.machine)" --label gpu | tee ~/agent-runner.id
done: it took effect at once, on your word as an administrator
born 9ea6250780effed74a7a8c6202c3f87887647262e1ea73c068f527ac5ff423e2
$ af agent runners
rack-3  machine a9bb3620d60b  down  classes -  labels gpu  hosting 0
```

Each runner is listed by name, with the start of its machine, whether its lease is held, the data classes it may host and its labels. A data class is declared by the organization before it is used, and declaring one is not built yet: `--class` refuses a class that is not declared, so an agent runner enrolled today names none.

Nothing of an enrollment changes. Another set of classes is another enrollment, which waits until the first is stopped, as one of the same name does. A key a live actor holds is refused, and so is a name a live agent runner has.

## What the forge refuses

The forge refuses an agent runner on a machine one of its own nodes runs on, at the request and again at the approval, so that a node enrolled in between counts. The machine of the cluster's first node is the one it started on, and a node enrolled later says its own with `af enroll-node --machine`, which `af-server --enrollment` prints. A check runner's enrollment, `af enroll-runner`, takes `--machine` too, and is refused in the same way. Two nodes may share a machine, as a development cluster of several does.

An agent runner has no role and nothing it may do on its own word:

- **It reads nothing.** It is no reader: it cannot check out a tree, read a file, search, sync or read what a kind says, and it passes no gate on a folder others are restricted to. It uses no key it holds no grant of.
- **It approves nothing.** A runner's check is its approval, and the eleven requests a runner makes are each refused to an agent runner, the build cache's among them.
- **It starts no agent of its own.** It hosts the ones it is ordered to.
- **It never expires.** Only an administrator stops it, with `af stop`, as for a runner.

```console check
$ af stop "$(sed -n 's/^born //p' ~/agent-runner.id)" --reason "machine retired"
stop reference 9018fb88b8c2afe8c7c7e8c6bef4dc28a81a89e2183ce77d0c464f5d5e3ccb61
stopped 9ea6250780effed74a7a8c6202c3f87887647262e1ea73c068f527ac5ff423e2
$ af agent runners
no agent runner is enrolled
```

Source: https://docs.forge.workreef.dev/runner/agent-runners/index.mdx
