Skip to main content
This page takes one Linux machine from nothing to a finished build. One command, outerlayer runner init, writes the runner’s config file and starts the service that keeps the runner running. Not on Linux, or want the runner image? Find your machine in Choose how to run the runner. Then follow the page it names.

Before you start

You need:
  • Node.js 22.15 or later, and the CLI: npm install -g @outerlayer/cli. A service needs a fixed path to start, so use the global install, not npx.
  • About 10 GiB of memory and 40 GB of free disk, with the default limits. See Memory limits and Disk fit.
  • Outbound HTTPS to the gateway (api.outerlayer.ai), github.com, api.anthropic.com and registry.npmjs.org. A runner that builds in containers also needs Docker Hub. See A build host.
  • A way to create an API key on the factory. The owner, admin and write roles can. If you cannot, see If you cannot create the key.
  • The factory’s name, as <org>/<factory>. It is in the factory’s dashboard address, app.outerlayer.ai/orgs/<org>/factories/<factory>.
  • A connected repository. The GitHub App is installed on it, and outerlayer init has added the /build skill to it. See Connect a repository and the Quickstart. Without the GitHub App, every build fails at provision with repository_not_in_installation.
  • For builds in microVMs: x86_64 Linux where the runner’s account can open /dev/kvm. A microVM host needs no Docker.
  • For builds in containers: Docker Engine 26 or later, usable by the runner’s account, and Docker’s Buildx plugin, 0.18 or later.
  • For builds in sandboxes that OuterLayer provides: no Docker and no KVM. A Linux machine or a Mac with neither can run a runner with outerlayer runner init --sandbox. A Mac needs no Linux VM for it. See Build in a managed sandbox.
To give the account access, run sudo usermod -aG kvm <account> for KVM, or sudo usermod -aG docker <account> for Docker. Then log in again. The docker group gives root rights in practice.

Give the runner its key

The runner needs a key of its own: an API key with the Runner preset. Use one new key for each runner. The runner’s first claim binds the key to this host, and runner init refuses a key that another host already used. See The host key. First decide which kind of runner this host runs:
  • A personal runner builds only the work you ask for. Use it when the runner builds with your own Claude subscription. runner init asks you to approve its key in your browser, so you create and paste nothing.
  • A shared runner builds the work of every member who has no personal runner. Use it for a team server. Give it an API key, such as an Anthropic API key, and not a Claude subscription: a subscription belongs to one person. Create its runner key yourself, as below, and pass --shared to runner init.
See Which items a runner takes.
  1. Log in on the host, and approve the link that the command prints. On a host with no browser, add --no-browser and open the link on another machine.
For a shared runner, also do these steps:
  1. In the factory, open Settings → API keys.
  2. Choose Create API key, and pick the Runner preset.
  3. Keep the page open. The key shows once, and you paste it when runner init --shared asks.
The Create API key dialog with the Runner preset chosen and its permissions listed as chips

The Create API key dialog with the Runner preset chosen.

The commands on this page pass --config ~/.outerlayer-runner/config.json. That file keeps the runner key apart from your own login, which is in ~/.outerlayer/config.json. A runner key in your own file would replace your login, and your sessions would switch factory.

Give the runner Claude’s credential

A runner that builds with Claude Code needs a Claude credential. A build never sees the credential itself. For a runner that builds only with Codex, see Build with Codex instead. Create a token on any machine where Claude Code is installed, such as your laptop:
Copy the token to the host. With built-in hooks, the host does not need Claude Code. An Anthropic API key works in place of the token.

Run outerlayer runner init

  1. Read the token into a variable. read -rs keeps it off the screen and out of your shell history.
  2. Run runner init, with the token on standard input:
    For a shared runner, add --shared.
  3. For a personal runner, approve the key in the browser page that runner init opens. Check that the page shows the same code as the terminal. For a shared runner, paste the runner key when runner init asks, then press Enter. Nothing shows as you paste.
runner init then does this:
  • It checks the key with the gateway and writes the config file, readable only by your account.
  • It picks the built-in hooks that fit the machine:
  • It writes a command for each queue that starts Claude Code. Builds run on Opus, and amends run on Sonnet. To change a model, edit runner.commands in the config file.
  • It stores the credential in claude.env, beside the config file, readable only by your account.
  • It installs and starts the service, and asks for sudo where it needs root. See What the service sets.
runner init refuses, and writes nothing, in these cases:
  • The machine cannot isolate a build. The refusal names the fix: Docker Engine 26 or later, or access to KVM.
  • The config file already holds a runner block, and no agent is named. Edit the block, or remove it and run runner init again. With --agent, the command adds that agent to the block instead.
  • Your login can use several factories and you named none. It lists each factory as a --factory value.
--app-id with the Factory ID from Settings → General works in place of --factory. To use your own isolation, see Write your own hooks.

Check the runner

runner init starts the service, so the runner can take work before you run this check:
check validates the config, confirms that the key works, and prints the settings the runner uses, including its hooks. It exits 1 and says what to fix when something would fail every build, for example:
  • A queue’s command is still the placeholder.
  • A claude command has a --permission-mode that Claude Code does not accept, such as bypassPermissons.
  • Built-in hooks find no credential for a listed agent.
  • The key does not hold work.claim. Create it with the Runner preset.
If it prints credentials unverified, the gateway did not answer normally. Run it again later. outerlayer doctor --config ~/.outerlayer-runner/config.json reports on the host as well. What each line means is in outerlayer doctor.

Build your first item

By default a build can reach every public domain, and can send anything it can read to any of them. List the domains your builds need in build.allowHosts. See Limiting the hosts a build reaches.
Ask for a build as yourself, not with the runner key. A build requested with a runner key gets no repository tokens, so it fails. Either:
  • choose Build beside the issue on the Work page, or
  • run this from your own machine:
The first build of a repository also builds its build image, so it takes longer.

Watch it run

From a second terminal on the host:
status lists running builds and their stage. logs -f follows one item’s build log. status --recent shows finished builds. The session and the pull request show on the item’s page. The factory’s Settings → Runners page lists the runner.
The Runners settings page: one runner named ollie with its version, the agents it builds with, a Ready status, its last heartbeat and whether it updates itself. Under it, the Runner updates choices: Automatic, Paused and Hold at a version

Settings → Runners lists each runner, its version and its status.

If something goes wrong, see Troubleshoot builds. Every key is in The config file, and every command is in Runner commands.

What keeps the runner running

The service that runner init installed restarts the runner after a crash, a reboot and an update. You write no service file. To change the service, size the host, update the runner or remove it, see Run the runner as a service.

Run the runner in a terminal instead

The service and a terminal runner cannot use the same config file. Remove the service first, then start the runner:
The runner then needs the agent’s credential in that shell’s environment. A runner started from a global npm install does not update itself. See Update a runner.

Build with Codex

A runner that builds with Codex needs an OpenAI API key and no Claude credential. A runner build cannot use a ChatGPT login.
  1. Read the key into a variable:
  2. Run runner init, with the key on standard input:
runner init writes a command for each queue that starts Codex. It stores the key in codex.env, beside the config file, readable only by your account. Codex also judges and reviews the runner’s Codex builds. To add Codex to a runner that already builds with Claude Code, run the same command on its config file. The command keeps the Claude credential. Then run outerlayer runner install --service --replace and restart the runner, so the service loads codex.env. See Build with several agents.

Using another agent

On a terminal, runner init without --agent asks which agent builds start, and then asks for its credential. To use an agent that runner init does not list:
  1. Answer none. runner init writes a placeholder command for each queue and stores no credential. The runner claims nothing while a command is the placeholder.
  2. Edit runner.commands in the config file to start your agent on item $OUTERLAYER_WORK. The runner reads the edited file on its next poll.
  3. Put the credentials your agent needs in runner.env, beside the config file. Make the file readable only by the runner’s account.
  4. Restart the service, which reads runner.env only when it starts.

Other ways to give the runner its key

If you cannot create the key

Ask a member who can create keys to make one with the Runner preset. Then put the key in the config file yourself. Do the same when runner init has no terminal to ask on, such as in a script. Run these lines one at a time. Each read waits for you to paste a value and press Enter. read -rs shows nothing as you paste. The Factory ID is on the factory’s Settings → General tab.
If the echo prints 0 characters, the key is empty. Run the read line again before you write the file. runner init then uses this key and asks for none. Leave --factory out of the commands on this page, because the config file already names the factory.

Save the key with outerlayer login

On a machine that only runs the runner, you can save the key with outerlayer login instead. The key is read from standard input, so it stays out of your shell history. The dialog that shows the new key also shows this command, filled in.
If you save the key this way, leave --config out of every command on this page.