Skip to main content
outerlayer runner claims queued work items and builds them on this machine. To set one up, follow Run work on your machines. The Build reference covers what the runner does around a build’s command. Every command that you run takes --config <path>. It names the config file whose runner block the command reads. The default is ~/.outerlayer/config.json. See The config file. A command that fails prints the reason on standard error and exits 1.

outerlayer runner init

Adds a runner block to the config file and makes the host key. With no runner key in the config file, it first asks you to approve a personal runner key in your browser. See The runner key.
The command does these things:
  1. It writes the runner block, with the hooks that fit the machine. It keeps every other key in the file.
  2. It writes placeholder command lines, unless you choose an agent.
  3. It makes the host key and prints its fingerprint.
  4. It runs outerlayer runner install --service. If that step refuses, the command prints a note and still exits 0.
With --sandbox on a Mac, step 4 writes and loads a launch agent, and the command asks no question about a Linux VM. See Build in a managed sandbox. The hooks it writes: builtin:container needs Docker Engine 26 or later and Docker’s Buildx plugin 0.18 or later. So does builtin:vm with runner.build.imageBuild set to host. init does not check Buildx. Until Buildx works, the runner claims nothing. See When the runner claims nothing. A default builtin:vm runner needs neither Docker nor Buildx. See A runner that needs no Docker. The command writes nothing and exits 1 when it cannot finish. The message names the fix. The common cases:
  • The config file has a runner block, and the command names no agent, by --agent or at the terminal’s question. Edit the block, or remove it and run the command again. With an agent, the command adds it to the block instead. See Build with several agents.
  • There is no config file and no login. Run outerlayer login first.
  • url, apiKey or appId is empty, or still holds a placeholder such as <factory-id>.
  • The machine cannot isolate a build. Docker Desktop alone is not enough. On Linux and WSL2, the message also names --sandbox, which needs no Docker. On Windows, use Docker Engine inside WSL2, or the runner image.
  • --sandbox is given with --vm, or on native Windows. Native Windows has no service for the runner. Run the command in WSL2 instead.
  • --sandbox is given on a Mac, and the config file has a runnerVm block. That file holds a runner in a Linux VM. Name another file with --config.
  • --sandbox is given and the gateway answers that it provides no sandboxes. The command leaves no runner block and sets up no service.
  • On macOS, you do not pass --vm and there is no terminal, or you answer no to the VM question.
  • --vm is given and limactl is not installed.
  • --agent is given and no valid credential for the agent is piped or stored.
With --sandbox, the command then asks the gateway whether it provides sandboxes to this runner, and prints one line with the answer. When managed sandboxes are off for the organization, the line gives the reason. The block stays, and the exit code is 0. When the gateway does not answer, the line says that the check could not be made, and the exit code is 0. After init, run outerlayer runner check. outerlayer doctor checks more on a runner host. See Runner host checks, Run the runner on a Mac and Run the runner on Windows.

The runner key

When the config file has no apiKey and a login is saved, runner init gets the runner key. The login only names the factory. The command never copies the login into the runner’s config file.
  1. The command finds the factory from the first of these that is set:
    • --factory;
    • --app-id;
    • OUTERLAYER_APP_ID;
    • the config’s appId;
    • the connection of the repository it runs in.
    When none is set, it uses the only factory your login can use. With several factories, it refuses and lists each as a --factory value.
  2. It asks you to approve a personal runner key. It prints the approve link and a code, and opens your browser. Check that the page shows the same code, then choose Approve.
  3. It checks the key with the gateway. A key that the gateway refuses, or that is bound to another host, stops the command.
  4. It writes url, apiKey and appId into the config file. With --vm, it gives the key to the VM and never writes it on the Mac.
A personal runner key belongs to you. Its runner builds only the work you ask for. See Which items a runner takes. To approve the key, you need permission to create factory keys. The owner, admin and write roles have it. When the approval cannot start, or you deny it, the command says why in one line. Then it prints the address of the factory’s API keys page and asks for a pasted key. With --shared, it asks for the pasted key at once:
  1. Create a key on that page with the Runner preset.
  2. Paste it when the command asks. Nothing shows as you paste. Press Enter when you are done.
The command asks on the terminal even when stdin is piped. With no terminal, it stops and prints the config-file lines to write by hand. A config file that already holds an apiKey is used as it is. Then the command asks nothing, and it refuses --factory. It also refuses an --app-id that differs from the config’s appId. If you cannot create the key, ask a member to create one with the Runner preset. Put it in the config file as apiKey, with the Factory ID as appId. That key makes a shared runner.

The agent

On a terminal with no --agent, runner init asks which agent builds start. Press Enter for claude, or answer none to keep the placeholder commands. It then asks for the credential, and shows nothing as you paste. Press Enter to use the credential already stored. For Claude Code, when claude is on the PATH and no Claude credential is stored, runner init first runs claude setup-token for you. Sign in when your browser opens. The command reads the token that claude setup-token prints, and you paste nothing. When it cannot read a token, it asks you to paste one. Without a terminal and without --agent, it reads nothing from stdin and writes the placeholder commands. --agent claude writes these commands: It reads Claude’s credential from stdin:
--agent opencode writes these commands: It reads an Anthropic API key from stdin. OpenCode refuses a token from claude setup-token.
--agent codex writes these commands: It reads an OpenAI API key from stdin. A runner build cannot use a ChatGPT login. The key goes in codex.env. The build holds a placeholder, and the runner adds the key to each model request.
The judge and the code review run on the agent that ran the build, when that agent can judge. Claude Code and Codex can. OpenCode cannot, so Claude Code judges and reviews an OpenCode build. A runner that builds with Codex needs only an OpenAI API key. A runner that builds with OpenCode needs a Claude credential too. To hold both, run runner init --agent codex on a runner that already has Claude Code. The command keeps the Claude credential and adds the OpenAI key. The rules for the credential:
  • A token from claude setup-token starts sk-ant-oat. The command stores it as CLAUDE_CODE_OAUTH_TOKEN.
  • An API key starts sk-ant-api. The command stores it as ANTHROPIC_API_KEY.
  • An OpenAI API key starts sk-, but not sk-ant-. The command stores it as OPENAI_API_KEY. Codex refuses an Anthropic key. Claude Code refuses an OpenAI key.
  • The command refuses any other value, including text around the credential.
  • The command stores the credential in the agent’s own file beside the config file, with mode 600. Claude Code uses claude.env. OpenCode uses opencode.env. Codex uses codex.env. The command never prints the value.
  • The file holds the one new line and loses what it held before.
  • runner.env loses each line that sets a credential variable of the named agent. It keeps every other line, another agent’s key among them. A key there that another listed agent uses moves to that agent’s file first.
  • With nothing piped, the command uses a credential already in the agent’s file, in the file of another agent that takes the same variable, or in runner.env.
  • With --vm, the command stores the credential in the VM’s file for the agent. The new VM has none, so you must pipe one.
  • A running service restarts to read the new credential, unless a build is running. Then it reads the file at its next restart.
The agent of a job comes from the job’s claim. See Build with several agents. A claim from a gateway that predates the choice names no agent. The runner then takes the agent from the first word of the job’s command. A command that starts opencode runs OpenCode. A command that starts codex runs Codex. Any other command runs Claude Code. An OpenCode job differs from a Claude Code job in two ways:
  • It needs ANTHROPIC_API_KEY. With only a token from claude setup-token, the job ends before the build starts.
  • It always starts a new session. It does not continue the kept session of an earlier job.
A Codex job differs from a Claude Code job in three ways:
  • It needs OPENAI_API_KEY. With only a Claude credential, the job ends before the build starts.
  • It continues the kept session of an earlier Codex job with codex exec resume <thread id>.
  • It starts with its input closed.
When a Codex command fails with no other reason, the job’s reason is the error that ended Codex’s run, as Codex reported it. An example is Codex reported: unexpected status 502 Bad Gateway: the upstream of the destination openai could not be reached, …. When Codex cannot reach OpenAI for 5 minutes, the runner stops the build. The reason is Codex could not reach OpenAI for 5 minutes, so the launcher stopped the build. A Claude Code job gives no such reason. Its print mode writes the agent’s answer as plain text, so an error line cannot be told from the agent’s own words. The runner removes control characters and secrets from each reason and makes it one line. It cuts a reason longer than 200 characters to 200, with … as the last character.

The Codex judge

The judge and the code review of a Codex build run Codex. They use the runner’s OpenAI key and never reach Anthropic. A runner that builds with Codex needs no Anthropic credential. They run in the build’s own container, after the build. The runner tells each run to read only, change no file, use no network and write only its answer files. It then checks the judge’s folder, and discards the verdict when a file there changed. The judge is instructed and checked, not sandboxed. See The Codex judge and code review. The runner refuses each model request of a judge run past 60. The reviewers of one review get 60 requests each. A run that reaches the limit, or runner.checks.timeLimitMinutes, ends with no verdict. So does a run that does not finish, or that prints no result: line. The reason says how the run ended, for example the judge reached the turn limit of 60 turns before it gave a result. A Claude Code judge differs: its answer file decides. The log line of a judge run shows its cost. A review records the cost of each reviewer. A response with no readable usage, or a model without a price, leaves the cost empty.

Build with several agents

One runner builds with several agents when runner.agents lists them:
The value is a list of agent ids. Each id must be claude-code, opencode or codex. With no runner.agents, the runner offers the agent that its implement command starts. A runner whose command starts opencode offers opencode. outerlayer runner init --agent <id> adds an agent to an existing config. It appends the id to runner.agents and changes no command. A runner block that still has the placeholder commands gets the agent’s commands instead, and lists no agent. The default agent of a runner is the agent of runner.commands.implement. An item that names no agent builds with the default agent, with the command the config names. runner init --agent <id> never changes the default agent. Suppose the runner holds no credential for the default agent. It then builds such an item with the first agent it offers. Its log says so. An item that names an agent builds with that agent, on a runner that offers it. A runner that builds with OpenCode needs a Claude credential for the judge and the code review. Run runner init --agent claude with the credential on stdin. The runner then also offers claude-code, so it builds the items that name Claude Code. To hold the credential for the judge only, add the line CLAUDE_CODE_OAUTH_TOKEN=<value> to the claude.env beside the config. Use mode 600. Then restart the service. A Codex runner needs no Claude credential. A build never gets the host’s value of a credential variable of an agent that the runner holds, even when runner.build.variables names it. The build gets a placeholder, and the runner logs one line for each name it withheld. A variable of an agent that the runner does not hold passes as before. A review job takes the agent of its item. For an item that names no agent, the default agent of the runner that takes the review does the review, when it can judge. Otherwise Claude Code does it. A runner that sends no list of agents offers only claude-code for items that name an agent. An older runner that starts OpenCode therefore takes an item that names claude-code. It builds the item with its own command. Update such a runner. A repository names its agent in .outerlayer/config.json, and a build request can override it. See The .outerlayer directory. The runner reports its agents to the gateway when it lists work, claims work and sends a heartbeat. The gateway lists and grants a runner every item that names no agent, and the items that name an agent the runner offers. A runner that does not report its agents offers only claude-code. A runner offers a listed agent only while it holds a credential that the agent takes. outerlayer runner status names each listed agent that has none, and the variable to store. Each agent keeps its own credential file beside the config file: An agent that has no file of its own uses a variable that another agent holds, when it takes that variable. A runner whose claude.env holds ANTHROPIC_API_KEY builds with OpenCode with no opencode.env. So one Anthropic API key serves Claude Code and OpenCode on a runner that lists both. A token from claude setup-token never goes to OpenCode. An API key starts sk-ant-api, and a token starts sk-ant-oat. The runner skips a value of the other kind, such as a token stored as ANTHROPIC_API_KEY, in a file or in its environment. It keeps a value of a shape it does not know, such as a key for a compatible proxy. When it skips a value, the runner log, runner check, runner status and outerlayer doctor name the file and the variable, never the value. A job gets only the credential of its own agent. The key proxy sends the credential of the agent that builds the job. To add an agent to a config that has a runner block, run runner init --agent with the agent’s credential on stdin:
The command adds the agent to runner.agents, keeps the agents the runner had, and changes no other key. A runner block that still has the placeholder commands gets the agent’s commands instead, and lists no agent. It stores the credential in opencode.env. Run outerlayer runner install --service --replace and restart the runner, so the service loads the new file. The same command replaces the credential of an agent that the runner already has. It then changes no key of the config. It refuses an agent that the runner already has when no credential is on stdin. It also refuses a credential the agent does not take, such as an OAuth token for OpenCode, and stores nothing. outerlayer runner install --service writes one credential for each listed agent into the unit. The unit always loads the credential of Claude Code. On systemd older than 247, the unit loads each file with EnvironmentFile=. Two files that set the same variable then collide, and the file that loads last wins. A runner that lists agents may leave a command out of runner.commands. The command line of the first listed agent stands in for it. A job whose agent is not the agent of its configured command runs the command line of its own agent. A command that starts no known agent, such as a wrapper script, stays as it is.

The model of a job

A claim can name a model. The runner sets it in the command of an implement, amend or revise job, for an agent that has a model flag. Claude Code, Codex and OpenCode have one.
  • If the command names a model with --model X or --model=X, the runner replaces it. For Codex, -m X counts too.
  • If the command names no model, the runner adds --model <model> right after the program. For Codex, it adds the flag right after exec.
  • If the command does not start the agent’s program, such as a wrapper script, the runner runs it as it is. The runner log says that the job’s model was not applied.
  • A review keeps its configured command. A criteria job runs the criteria command of the item’s agent. A run with no runner.commands.run runs the run command of the agent it runs on. None of them takes the claim’s model.

outerlayer runner check

Checks the config, the hooks and the credentials without taking work. It is safe to run beside a running runner.
It exits 1 and names the problem when:
  • the config or a hook fails a check that start runs;
  • apiKey or appId is empty or still a <...> placeholder;
  • the command of an enabled queue is still the placeholder that runner init wrote;
  • the hooks are built-in and the command finds no agent credential;
  • a claude command’s --permission-mode is not a value Claude Code accepts;
  • the gateway refuses the key, or the key lacks work.claim.
The command looks for the agent credential in three places: the shell, the service’s credentials directory, and the claude.env and runner.env files beside the config. A hook must be the path of an executable, not a shell line. Nothing expands $HOME or ~. When the gateway does not answer, the command prints credentials unverified and exits 0. A good run prints ✓ credentials ok, the gateway and the factory. Then it prints one line for each setting the runner uses:

outerlayer runner start

Runs the runner until it is stopped.
It exits 1 and names the problem when:
  • the config file is not valid JSON, or lacks url, apiKey or appId;
  • the runner block is absent, or holds a key that is unknown or out of range;
  • an enabled queue has no command;
  • a hook does not exist, is not a file, or is not executable;
  • a destination’s header names a variable that the runner’s environment does not hold;
  • another runner is running on the same config;
  • another runner uses the same microVM helper;
  • the gateway refuses the runner key.
To run a second runner on one machine, give it a config file and a service of its own. Run outerlayer runner install --service --unit-name <name>. See Several factories, one machine. A gateway that does not answer is not a refusal. The runner logs the gateway did not answer at start and starts anyway. See Troubleshoot builds. When the runner updates itself, start installs the new version and exits with status 75. The service then starts the new version. See Keep the runner up to date.

outerlayer runner status

Shows the runner’s state and its builds.
To see finished builds under the running ones:
Lines under the header appear only when they apply: --json prints one object with these keys: host, configPath, process, service, concurrency, housekeeping, pendingUpdate, image and jobs. pendingUpdate.waits lists each build that the update waits for, with its item and reason. In the runner image, the image object has an update with the tag to pull and a reason of newer or refused. status still answers when the config file is not valid.

outerlayer runner logs

Prints the newest build’s log for one item. It prints the command’s output, or the output of the hook that runs now.
<item> is the item’s number, or the claim id of one build. This prints item 42’s newest build log and keeps printing until you interrupt it:
The command exits 1 when <item> is neither a number nor a claim id. It also exits 1 when no build on this config worked the item, or the log does not exist yet. outerlayer work logs prints what the runner did around the build, from OuterLayer. runner logs prints the build command’s output from this host.

outerlayer runner stop

Stops the runner on this config.
Plain stop drains the runner. The runner takes no more work and waits for its running builds to end. Every five seconds the command prints waiting on #<item> (<stage>, <elapsed>). At the end it prints runner exited. To end running builds at once:
Running builds end with outcome stopped. Their cleanup still runs, and the runner releases their claims. The command exits 0 in every case, also when no runner is running. When another account runs the runner, the command cannot signal it. Run the command as that account, or stop the service with sudo systemctl stop <unit>.

What ends or keeps a build

These events have the same effect on every kind of build:
  • outerlayer runner stop and one Ctrl-C drain the runner. It takes no more work, and each running build runs to its end.
  • outerlayer runner stop --now and a second Ctrl-C end each running build now as stopped.
  • outerlayer work stop ends one build as stopped after the runner’s next heartbeat.
  • docker stop of the runner container leaves its builds running. The next container on the same volume adopts them.
  • outerlayer runner stop in the runner container makes the runner take no more work. The builds run to their end, and the container stays up.
These events differ by kind of build: Three limits apply:
  • systemd kills a runner that drains for longer than runner.timeLimitMinutes plus 10 minutes. That has the same effect as a crash. See Start and stop the runner.
  • A build whose container stopped, or whose sandbox the provider ended, ends interrupted.
  • A build whose runner never comes back loses its claim. Then a container build stops, and a microVM build powers off.

outerlayer runner install

Puts the running CLI in the install layout that a runner needs to update itself. With --service, it also sets up the service that keeps the runner running.
Without --service, the command does these things:
  • It copies the running CLI into <config dir>/runner/versions/<version>/ and points current at it.
  • It writes the launcher ~/.local/bin/outerlayer, which always runs the version in current.
  • It prints the ExecStart= line that starts the runner from current.
It needs no network. It never edits a shell startup file. When ~/.local/bin is not first on PATH, it prints the export PATH= line to add. See The outerlayer command. The command restarts nothing itself. When it moves current to another version, it prints when the service restarts. A service runner takes no new work, then restarts when its builds allow. A runner that you started by hand keeps its version until you restart it. See Upgrade by hand. Without --service, the command exits 1 and changes nothing when:
  • the CLI is not installed with npm, as in a source checkout;
  • the running CLI is older than the version that current names. The message names the command to run instead. --allow-downgrade installs it anyway.
With --service, the command also sets up one systemd unit. The unit runs on Linux, inside the Mac’s VM and inside WSL2. On WSL2 the command also sets up a Windows scheduled task. See What the service sets. For builtin:vm hooks on Linux, --service also installs the microVM helper as the unit <unit>-helper. The helper’s files are in /usr/local/libexec/outerlayer/<unit>-helper/ and /etc/outerlayer/. On a Mac, --service works for a runner with builtin:sandbox hooks. It writes ~/Library/LaunchAgents/ai.outerlayer.sandbox-runner.<unit name>.plist and loads it with launchctl bootstrap gui/<uid>. The agent runs as you, and needs no sudo. It starts at login, and launchd starts it again after a failure or an update. A runner that runner stop ended stays stopped. The file holds no credential: the runner reads claude.env beside its config. The runner’s log is <config dir>/runner/runner.log. If launchd refuses the load, as it does over SSH, the command says the agent is not loaded and exits 1. Run it again from a session at the Mac’s screen. For any other hooks, a Mac refuses and points to runner init --vm. With --service, the command exits 1 and sets nothing up when:
  • the host has no systemd, and it is not a Mac with builtin:sandbox hooks;
  • the hooks are your own executables;
  • runner.concurrency times runner.build.memory does not fit in the memory the runner can use;
  • --build-memory-max is less than runner.concurrency times runner.build.memory;
  • a --build- flag is given and the microVM helper is not installed.
Without the two --build- flags, the runner’s builds have no shared limit. See Limit the memory and CPU of a runner’s builds. The rules for a unit name:
  • It has up to 64 characters: letters, digits, _, - and ..
  • It starts with a letter or a digit, and holds no ...
  • Do not name a unit <name>-builds-<x> when a unit named <name> exists, such as acme-builds-x beside acme.
After you change the hooks or certain limits, run the command with --service again. See When a change takes effect.

outerlayer runner uninstall

Removes what runner install --service set up.
--service is required. --unit-name <name> names the unit to remove, when it is not the default outerlayer-runner. The command stops and disables the unit, and removes the unit file. It removes the microVM helper’s unit too. On WSL2 it also removes the scheduled task. On a Mac, it unloads the launch agent of a sandbox runner and removes its file. It leaves a unit that it did not write alone. On WSL2, when schtasks.exe cannot start, the command prints this line. Run it in Windows:

outerlayer runner update-steps

Prints the commands that update the runner to the version its factory names. It changes nothing.
In the runner image, run it with docker exec:
It prints these steps:
  1. docker pull of the new image.
  2. docker stop of the container, then docker rename to <name>-old.
  3. A docker run command with the same name, mounts, restart policy and network.
  4. A check that the new runner is up: docker logs <name>.
  5. docker rm <name>-old, only after the check.
Docker does not record your env file, so the docker run command shows a placeholder for it. The output names the variables the container sets and never prints a value. For a container that Docker Compose started, it prints docker compose pull and docker compose up -d. When the runner cannot read its container, it prints the pull step and the reason. Outside the image, it prints the npm install -g @outerlayer/cli command, then runner install. A service runner updates itself. A runner image older than 0.34.0 does not have this command. To update one, follow Update a runner.

outerlayer runner request-variables

Asks a member to approve this runner for the factory’s build variables.
Set runner.build.factoryVariables to true in the runner config first. Then run the command. It prints the fingerprint of the host key of this machine. A member with the Approve runners for build variables permission confirms the request in Settings, Runners. The member compares the fingerprint with the one the command printed. The command sends no request in these cases:
  • runner.build.factoryVariables is not true. The message names the setting.
  • The runner is personal. A personal runner cannot be approved.
  • The runner key is tied to no machine yet.
  • The runner is already approved.
A new request replaces a waiting one. A runner key can ask once a minute. A request that nobody confirms in 7 days expires. See Build variables on a self-hosted runner.

outerlayer runner image

Builds the image that a repository’s builds run in. That is the universal image, whatever devcontainer file the repository holds.
The image build gets the runner.build.memory of the runner config, or 8g when there is no config. Without a runner config, the command treats the repository as one that governs itself. A private repository needs a git login on this host. See Image builds. When the image is built or reused, the command exits 0. It prints one of ✓ built <tag>, ✓ reused <tag> and ✓ rebuilt the tools layer of <tag>. A not applied: line names a devcontainer file that the command left out. It names the repository that holds the file and says that setup belongs in .outerlayer/setup.sh. With --json, the recipe of the result is default. Otherwise the command exits 1 with a code. With --json, it prints { "error": { "code", "message" } }, and logPath when a build log exists. See The build image.

Commands the runner starts

You do not run these two commands by hand:

Kept sessions

An agent job continues the Claude Code session of the item’s previous build or agent job. So the agent starts with what the earlier job learned.
  • The runner keeps one session for each work item, on its own host. A newer session replaces the older one.
  • The kept session is the full transcript. It never leaves the host. OuterLayer gets the build’s session as it does for any build.
  • The runner keeps a session of at most 512 MiB, or 64 MiB for a sandbox build. It does not keep a larger one, and the older session stays.
  • Housekeeping removes a kept session after runner.housekeeping.jobsKeepDays days.
A new build of an item starts from the issue, with no kept session. To have a build continue the earlier session, see Continue the session of the previous build. An agent job starts with no kept session when one of these is true:
  • The runner holds no session for the work item. The item’s earlier builds can have run on another host.
  • Claude Code cannot load the kept session. The job still runs.
  • The build runs under hooks of your own.
  • The agent is OpenCode.
On the item page, the Overview line of an agent job says whether it continued a session. See The Overview tab.

Upgrading the runner

To update a runner, follow Update a runner. To check that the update worked, see Check that it worked. A CLI older than this release refuses a config that lists runner.agents. Before you install an older CLI, remove runner.agents from the runner block. A runner that updates itself never switches to such a version, because the version fails runner check first.

How a runner says it needs an update

A runner that is too old keeps polling but takes no work. Its log says why, in one of these lines:
In the runner image, the second line continues with the steps that outerlayer runner update-steps prints. The support window says which versions OuterLayer accepts. After a self-update, a new version that fails its first checks goes back to the previous version. The runner then takes work again. To pause or hold updates for every runner of a factory, see Pausing or holding updates for a factory.

Permissions

A runner’s key needs four permissions. The Runner preset holds them. See API keys. work.claim is on no dashboard role by default. A key without hosts.ingest still claims work, but the factory does not list the runner. The runner’s log names the refusal.