---
title: "Self-hosted runners for Reactor remote agents · Selan"
description: "Run Reactor remote agents on a server or Mac your company keeps on, or on a VM per run in your own Google Cloud: add a runner, install it, remove it."
url: https://selan.ai/docs/runners
updated: 2026-11-24T21:09:22+02:00
---

Agents

Docs · Runners

# Self-hosted runners for remote agents

A runner is a server or a Mac your company keeps on. It takes a Reactor remote agent's runs in seconds, each in a container of its own. Without one, each run gets a vm made for it.

The idea

## Why use a runner instead of a fresh VM?

**By default every run gets a fresh vm, which Selan makes and throws away after.** A runner is a machine you keep on that asks Reactor for work, so a run starts in seconds instead of waiting for a vm to boot. Use one for speed, or for a machine you chose: your own hardware and network, or a Mac so an agent can build with Xcode. Otherwise keep the vm: nothing a run does outlives it, and no machine of yours holds an agent's secrets.

**A vm per run can also be made in your own Google Cloud project**, on your quota and your bill. Its credentials sit in that vm's metadata while it runs, readable to anyone in your project who may read it. See [Runs in your own Google Cloud](#google-cloud).

Adding a runner takes four steps:

1.  An owner adds it in Reactor, under [**Runners**](https://reactor.selan.ai/runners) ([add a runner](#add)).
2.  Reactor shows an install line containing the runner's token, shown once. Copy it.
3.  Run the line on the machine: the **Linux** one on an [Ubuntu server](#linux), the **Mac** one on an [Apple Silicon Mac](#mac).
4.  Once the runner shows as online, add it to an agent's **Runs on**.

## What is a runner?

**A runner is a machine your company keeps on, such as a VPS or a Mac mini.** The `selan-runner` container on it polls Reactor over HTTPS and is answered with the runs to start and stop. It only calls out, so the machine needs no inbound port.

**Each run gets its own container**, from the same agent image a vm runs, with its own Docker daemon and Docker network, so one run cannot reach another's containers or ports. Runs use the [Sysbox](https://github.com/nestybox/sysbox) runtime and are **never `--privileged`**: root in one container would mean every concurrent run's credentials.

The agent image carries Node.js, `git`, `curl`, Python 3 with its standard library, Docker and PostgreSQL 18, on a runner as on a vm.

|  | How it behaves |
| --- | --- |
| Which agents | An agent's **Runs on** field in Reactor lists where its runs may go: one or more runners, a **runner tag** such as `#jobs` for every runner of yours carrying it, [Google Cloud projects of yours](#google-cloud), **Selan Isolated VM**, or any mix. The field appears once your company has a runner or a Google Cloud project. A run tries a tag's runners first, oldest first, then the runners listed (the first online with a slot free), then a Google Cloud project, then the vm. A workspace's supervisor runs only on the vm. A run on the vm is paid from your company's credits, bought under [Billing](https://control.selan.ai/billing); when they run out, a new run there fails and says so. Your own runners and Google Cloud projects are not metered. Over [Selan MCP](https://selan.ai/docs/mcp#tools) it is the agent's `runnerIds`; `runnerId` sets one runner or `#tag`, or `null` for the vm, and the first entry sent back unchanged keeps the list. |
| Slots | How many runs it takes at once, from 1 to 16. A new runner starts at 2. The runner takes a changed value at its next poll. |
| Offline or full | A runner is online while it has polled in the last 60 seconds. When every online runner listed is full and neither a Google Cloud project nor the vm is listed, the run stays `queued` on the runner with the shortest queue and starts when a slot frees, oldest first. The 4-hour limit runs while it waits; a run still queued at its end ends `unprovisioned`. A run also waits `queued` while its agent's [parallel-runs limit](https://selan.ai/docs/mcp#tools) is full. When no runner listed is online, the run ends at once as `unprovisioned`, saying why for each, unless a Google Cloud project or **Selan Isolated VM** is listed. |
| Restarts | **Runs survive a restart of the runner.** Each run's container is labelled with its run and deadline, and a restarted or updated runner reads them back from Docker. Only a runner that stops polling for 2 minutes has its runs closed as `lost`. |
| Deadlines | A run may take 4 hours, on a runner or a vm. The runner stops a run that passes its deadline, and the run ends `timed_out`. |
| Secrets | Every run sent to a runner is handed all of its agent's secrets, which then sit on a machine you run. That is why only an owner adds, changes or removes a runner. |

Setting one up

## How do I add a runner in Reactor?

In [Reactor](https://reactor.selan.ai), open [**Runners**](https://reactor.selan.ai/runners). Every member sees each runner's state (`online · 1 of 2 busy`, `offline · last seen …` or `never connected`) and version. **Only an owner adds one.**

Click **New runner** and keep **Your own machine**. Give it a unique **Name** of 1 to 40 characters, set **Runs at once** (1 to 16, default 2), add [Tags](#tags) if you want any, then click **Add runner**. The dialog shows **Install on**, three lines to copy:

| Install on | For |
| --- | --- |
| Linux | An [Ubuntu 24.04 server](#linux). |
| Mac | An [Apple Silicon Mac](#mac). |
| Mac privileged | The Mac line with `--mac-host`, for [Xcode builds on the Mac](#mac-host). |

**The token is in the line, and it is shown only once.** Reactor keeps only a hash of it. Copy the line before you close the dialog. It reaches the install script through the environment, not the command line, where any user on the machine could read it from `ps`.

**Rename it and set its slots or tags later** by clicking its row. An owner can do the same over [Selan MCP](https://selan.ai/docs/mcp#tools):

-   `selan_remote_runner_update` replaces the name and slots at once, so send the current name to change only the slots; `tags`, if left out, are kept.
-   `selan_remote_runners_list` shows every runner's `id`, `name`, `slots`, `tags`, `busy`, `online`, `lastSeenAt`, `version` and `agents`, how many agents name it.
-   `selan_remote_runner_create` takes optional `tags` and answers the same three lines.
-   `selan_remote_runner_delete` takes its `id` and is refused on the same terms as **Delete** in Reactor.

`RUNNER_SLOTS` in the install line only starts the runner; after that Reactor's value counts.

## How do I send a run to a particular runner?

**Give a runner tags, and a run can ask for them.** A runner carries up to 8 tags, such as `mac` or `xcode`, each 1 to 24 letters, digits, spaces, `-` and `_`. An owner sets them in **Tags** when adding the runner and in its dialog later, or over [Selan MCP](https://selan.ai/docs/mcp#tools) with `tags` on `selan_remote_runner_create` and `selan_remote_runner_update`.

**A run that asks tags goes only to a runner carrying every one.** It ignores its agent's **Runs on**: it goes to your company's runner carrying all of them, a free one first, else the one with the shortest queue, and never to a Google Cloud project or a vm. When no runner carries every tag, the run ends `unprovisioned` and says `no runner carries every tag of mac, xcode`. A run that asks none goes where **Runs on** says.

**Ask in Runner tags.** The field is on **Start run** and on the Schedule and Events tabs of a trigger's form, appears once a runner carries a tag, and takes only tags a runner carries. Every run a schedule or an event trigger (a webhook's included) starts asks them. An agent that starts another from inside its run can send `runner_tags` to `selan_agent_start`. A question's answer resumes with the tags of the run that asked it. A workspace's supervisor runs only on a vm, so a run of it that asks tags is refused.

## Can runs use my own Google Cloud project?

**A runner can also be a Google Cloud project of yours.** Every run sent there gets a vm of its own in your project, made when the run starts and deleted when it ends, on your quota and your bill. Each run's logs are written to your project. Unlike Selan Isolated VM, the vm has `/dev/kvm`, so an Android emulator boots at full speed.

In [**Runners**](https://reactor.selan.ai/runners), an owner clicks **New runner**, picks **Google Cloud** and clicks **Sign in with Google**, with a Google account that may change the project's roles. Then pick:

| Field | Choices |
| --- | --- |
| Project | One of the projects that Google account sees. A project serves one Selan company only. |
| Zone | `europe-north1-b`, then `europe-west4-a` (the default), or `us-central1-a`, then `us-east4-a`. A run's vm goes to the first zone, and to the second when the first has no room. A cloud connected earlier keeps `europe-west1-b`, then `europe-west4-a`. |
| Start from | A template that sets the size and pricing below: **Android** (16 vCPU, Spot, KVM; for Android builds and emulator tests), **Backend** (8 vCPU, Spot, PostgreSQL; for backend builds and test databases) or **Agents** (8 vCPU, Spot, Chromium and Playwright; for everyday agents). **Custom** lets you pick both. |
| Size | Small (`c4-standard-4`), Medium (`c4-standard-8`, the size of Selan Isolated VM, and the default) or Large (`c4-standard-16`). |
| Pricing | **Standard**, on demand, or **Spot**, cheaper. The dialog shows what an hour of the vm costs in the zone's region, and the other pricing's price under it. Google may take a Spot vm back at any time: Selan then starts the run once more on a fresh vm and says so in the run, and a second take-back ends it as lost. |

**Connect** takes five steps in your project, as you, in a minute or two:

1.  Compute Engine and IAM are switched on.
2.  `selan-run` is made, the account each run's vm runs as.
3.  Selan may make and delete vms there. It touches only the vms it made.
4.  `selan-run` may pull the agent image.
5.  A firewall: a run's vm answers nobody and reaches nothing private inside your network, except the ranges you allow later.

A step Google refuses says why, often with a command to copy. Fix it and connect again; the steps left are run again. Then add the project to an agent's **Runs on**. A new agent starts with the company's first connected project there; an existing agent keeps where it runs.

**A run's credentials ride its vm's instance metadata.** Anyone in your project who may read instance metadata can read them, so keep that to people you would trust with your agents' secrets.

**Click the project's row under Runners** to see where its vms go and which agents send runs there. An owner changes where they go there; a run already going stays where it is.

| Field | Choices |
| --- | --- |
| Network | **default**, your project's default network, where a run reaches nothing private; or one of the project's private subnets, listed by name and region. |
| Runs may reach | On a subnet, up to 5 private ranges its runs may reach, separated by commas or spaces, such as `10.100.0.0/16`. Each is inside `10.0.0.0/8`, `172.16.0.0/12` or `192.168.0.0/16` and written as its own network, and none is repeated. Everything else inside your network stays closed, peered networks included. The default network takes none. |
| Zone | On the default network, the pairs above. On a subnet, the zones of its region that offer the size, tried first to second; a region with none is refused: pick another subnet. |

**Saving a new network or new ranges asks you to sign in to Google**: the firewall rules are written in your project as you, by someone who may write firewall rules there. A change of zone, template, size or pricing alone saves at once. Over [Selan MCP](https://selan.ai/docs/mcp#tools), a network or ranges change answers a link an owner opens to sign in, and saves nothing until then.

**Disconnect** asks you to sign in to Google again: only someone who may change the project's roles can take Selan's back. It is refused while a run there has not ended, and while an agent still names the project, counting agents deleted in the last 7 days. Point them elsewhere first. The `selan-run` account and the firewall rules stay in your project. No Selan MCP tool connects or disconnects a project.

## How do I install a runner on Linux?

**Ubuntu 24.04, on amd64 or arm64.** Paste the **Linux** line on the machine as a user who can `sudo`. It installs what it needs and connects on its own.

```bash
export SELAN_RUNNER_TOKEN=selanrunner_…; curl -fsSL https://reactor.selan.ai/runners/install.sh | sudo --preserve-env=SELAN_RUNNER_TOKEN REACTOR_URL=https://reactor.selan.ai RUNNER_SLOTS=2 bash
```

| It installs |  |
| --- | --- |
| Docker | Ubuntu's `docker.io`, with `curl`, `python3` and `cron`, when Docker is missing. A machine that is not Ubuntu needs Docker installed first, and the rest of the script is for Ubuntu only. |
| Sysbox | Sysbox 0.7.1, checked against its published checksum. Its installer restarts Docker, so the script asks you to stop any running containers first. It does not finish without the `sysbox-runc` runtime. |
| The runner | The `selan-runner` container, started `--restart=always` with the Docker socket mounted. It also pulls the agent image. |
| Egress rules | A firewall chain, `SELAN-RUNS`, for the runs' networks alone: a run reaches the internet, but not the cloud metadata server or any other link-local address on this machine (DNS excepted). The runner puts it in place every time it starts and takes no run without it; a `selan-runner-egress` service does the same at boot. |
| A daily update | A root crontab line runs `/usr/local/sbin/selan-runner-install` at 04:17, logging to `/var/log/selan-runner-install.log`. Each update replaces the container only when its image or settings changed. |

**Its settings are in `/etc/selan-runner.env`**, readable by root alone: `REACTOR_URL`, `SELAN_RUNNER_TOKEN` and `RUNNER_SLOTS`. Running the script by hand needs no token:

```bash
sudo /usr/local/sbin/selan-runner-install
```

It prints `selan-runner is current` or `selan-runner started`. The runner's own log is `docker logs selan-runner`, one JSON line per event.

The log says `runner.egress_guarded` once the egress rules are in place. A runner that says `runner.egress_unguarded` takes no runs until they are, and the line says why. A runner installed before 19 October 2026 takes the egress rules with its next daily update.

**Each run gets its slot's share of the machine**: the CPUs, and nine tenths of the memory, divided by `RUNNER_SLOTS`.

## How do I install a runner on a Mac?

**An Apple Silicon Mac runs the runner inside an Ubuntu VM.** Runs need the Sysbox runtime, which macOS and Docker Desktop's VM cannot take. So the Mac line makes a [Lima](https://lima-vm.io) VM and runs the Linux install inside it.

Paste the **Mac** line in Terminal as the user who logs in to the Mac, not with `sudo`:

```bash
export SELAN_RUNNER_TOKEN=selanrunner_…; curl -fsSL https://reactor.selan.ai/runners/install-mac.sh | REACTOR_URL=https://reactor.selan.ai RUNNER_SLOTS=2 bash
```

To size the VM, end the line with `bash -s --` and the flags, such as `bash -s -- --cpus 6 --memory 16`:

| Flag | What it sets |
| --- | --- |
| `--cpus N` | The VM's CPUs. Default 4, and fewer than the Mac has. |
| `--memory GiB` | The VM's memory. Default 8, and less than the Mac has. |
| `--disk GiB` | The VM's disk. Default 100, and set only when the VM is made. |

-   **The VM is `selan-runner`**: Ubuntu 24.04 on Virtualization.framework (`vz`, arm64), with no mounts and no port forwards, so a run cannot reach the Mac's home directory.
-   **It starts at login.** A Mac that restarts to the login screen has no runner until somebody logs in.
-   It needs Lima 2 or newer, and installs it with Homebrew when it is missing.
-   **Running the Mac line again, without the token, updates the runner.** It reuses the VM and re-runs the update inside it, which reads the VM's own `/etc/selan-runner.env`. A `--cpus` or `--memory` that differs stops the VM to resize it, and the runs going in it end as `lost`.
-   **A run reaches nothing of the Mac.** The VM sees the Mac at `192.168.5.2`, the services on the Mac's own loopback included, so the runner refuses that address to every run, as it refuses the [link-local addresses](#linux). With `--mac-host` it lets SSH through, and nothing else. A runner given `--mac-host` before 19 October 2026 needs the [Mac privileged line](#mac-host) once more, without the token, or its runs cannot fetch the key.

```bash
curl -fsSL https://reactor.selan.ai/runners/install-mac.sh | REACTOR_URL=https://reactor.selan.ai RUNNER_SLOTS=2 bash
```

## Can agents run Xcode builds on the Mac?

**A run in the VM cannot run Xcode, which needs macOS.** An owner who wants agents to build Apple apps opts the Mac in with the **Mac privileged** line, which is the Mac line with `--mac-host`. It asks for the Mac's password. On a runner already installed, leave out the token.

```bash
export SELAN_RUNNER_TOKEN=selanrunner_…; curl -fsSL https://reactor.selan.ai/runners/install-mac.sh | REACTOR_URL=https://reactor.selan.ai RUNNER_SLOTS=2 bash -s -- --mac-host
```

Other flags go after it, such as `bash -s -- --mac-host --cpus 6 --memory 16`. It sets up five things:

-   **A standard macOS user, `selan-build`**, where builds run.
-   **Other users' homes closed to it.** macOS makes a home readable to the `staff` group, which every user is in, so `--mac-host` sets the other homes, the owner's included, to `700` and checks that `selan-build` cannot list them.
-   **SSH limited to that user**, and to connections from this Mac. The runner's VM reaches the Mac at `192.168.5.2`, and runs reach its SSH there and no other port.
-   **A key served only to containers inside the runner VM.**
-   **A `macrun` helper**: `macrun ssh mac "xcodebuild …"` runs a command on the Mac, and `macrun rsync` copies a tree to the Mac and results back.

**Any run on that runner can run commands on the Mac as `selan-build`, and the runs are not kept apart there.** That user is not an admin and has no `sudo`, but anything it can do, every agent pinned to this runner can do.

### Where isolation ends

In the VM, each run is isolated. On the Mac every run acts as the same `selan-build` user: runs share its home, `~/work`, the simulators and DerivedData, and can read each other's files and whatever is world-readable, such as `/Applications`, `/opt/homebrew`, `/Users/Shared` and `/tmp`. Use a Mac kept for this, or one whose owner account holds nothing sensitive, and pin only agents you trust to it. Without `--mac-host` a runner stays isolated from macOS.

### Simulator platforms

Xcode must be installed on the Mac. A build for a simulator also needs that platform, installed once on the Mac, 5 to 10 GB each:

```bash
xcodebuild -downloadPlatform iOS
```

### Turning it off

Running the Mac line again without `--mac-host` keeps it on. `--no-mac-host` removes it: a run on the runner can then no longer reach the Mac.

```bash
curl -fsSL https://reactor.selan.ai/runners/install-mac.sh | REACTOR_URL=https://reactor.selan.ai bash -s -- --no-mac-host
```

### An Apple build agent

An agent pinned to this runner, with a system prompt along these lines. Replace the repository and the scheme with your own:

```text
You build and test the iOS app in the repository named in your task, on this
company's Mac. You run on the runner "mac-mini", and macrun lets you run
commands on that Mac as the user selan-build.

Setup, every run:
1. Fetch the macrun helper, then run: macrun ssh mac "xcodebuild -version"
   If either fails, say so in your final message and stop. Nothing below
   works without it.

Build:
2. Clone the repository in your container and make the change you were asked for.
3. Copy the tree to the Mac with macrun rsync, into ~/work/<run>, where
   <run> is the run id the first line of your instructions names. Never
   build anywhere else.
4. Build for the simulator, unsigned:
   macrun ssh mac "cd ~/work/<run> && xcodebuild -scheme <scheme>
     -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO build"
5. On a failure, read the log, fix the cause and build again, at most 3 times.

Clean up, always, even after a failure:
6. macrun ssh mac "rm -rf ~/work/<run>"

End with what you changed, whether the build passed, and the last error if not.
```

The [remote-agents skill](#skills) helps you write and review a prompt like this one.

## How do I update a runner?

**A runner updates itself every night**, at 04:17 its machine's time, and runs going at the time carry on.

**Reactor says Update needed** on a runner still behind the newest a day after it came out. The update's log says why: `/var/log/selan-runner-install.log`, inside the VM on a Mac.

To update it at once on Linux:

```bash
sudo /usr/local/sbin/selan-runner-install
```

On a Mac, as the user who logs in to the Mac:

```bash
limactl shell selan-runner sudo /usr/local/sbin/selan-runner-install
```

## How do I remove a runner?

**Delete it in Reactor first.** Open the runner and click **Delete**, as an owner, or call `selan_remote_runner_delete` with its `id` over [Selan MCP](https://selan.ai/docs/mcp#tools). Delete stays off while an agent runs on it, until you move that agent to another runner or a Selan Isolated VM, and while a run is still going on it. Once it is deleted, Reactor refuses its token, and the runner stops every run it still holds and takes no more work.

**Then remove it from the machine.** On a Mac, [turn off `--mac-host`](#mac-host) first if you turned it on, then delete the VM:

```bash
limactl stop selan-runner
limactl delete selan-runner
```

On Linux, remove the container and its daily update (without the cron line, the update would install it again):

```bash
sudo docker rm -f selan-runner
sudo crontab -l | grep -v selan-runner-install | sudo crontab -
sudo rm -f /etc/selan-runner.env /usr/local/sbin/selan-runner-install
```

Docker and Sysbox stay installed, along with the images.

Around it

## Which skill helps write remote agents?

**A Claude Code plugin for designing and reviewing remote agents.** Run these two lines inside Claude Code:

```text
/plugin marketplace add selan-ai/selan-remote-agents
/plugin install selan-remote-agents@selan-remote-agents
```

Then ask for what you need, such as _"design an agent that watches our prod logs"_ or _"audit my remote agents"_, or run `/selan-remote-agents:remote-agents`. Auditing reads your agents through [Selan MCP](https://selan.ai/docs/mcp), so connect that first. An audit changes nothing. The source is public at [github.com/selan-ai/selan-remote-agents](https://github.com/selan-ai/selan-remote-agents).

It does not install a runner. It can write the [Apple build agent's](#mac-host) prompt and trigger, and audit your agents before you pin any to a runner.

## More

-   [Selan MCP](https://selan.ai/docs/mcp): `selan_remote_runners_list`, `selan_remote_runner_create`, `selan_remote_runner_update`, and the `runnerId` that `selan_remote_agent_create` and `selan_remote_agent_update` take.
-   [Agents](https://selan.ai/docs/agents): running an agent in your own CI with `selan agent-run`.
-   [Hiding secrets](https://selan.ai/docs/secrets): the Secrets feed marks a detection from a remote agent's run.
