Skip to main content
A managed sandbox is a machine that OuterLayer starts for one build. The runner stays on your machine. It needs no Docker, no KVM and no sandbox provider account. It is the shortest way to a working runner on Linux or on a Mac. OuterLayer turns managed sandboxes on for an organization. Ask OuterLayer to do this before you set up the runner.

What stays on your machine

  • The runner, its config file and its host key.
  • The agent’s credential and the push token. They never enter the sandbox.
  • The agent’s session. The runner keeps it and continues it on the next job of the work item.
The sandbox holds a GitHub read token, which gh uses in the build. It covers one repository and lasts about an hour. It cannot write. See Build tokens. The sandbox has no direct network access. A build reaches the network through the runner’s tunnel, so runner.build.allowHosts still applies.

Which key each agent needs

A runner of your own uses the credential on your machine. That is CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY for Claude Code, and OPENAI_API_KEY for Codex. A managed runner of OuterLayer uses the factory’s key instead. See The model keys of a managed build.

Set up the runner

Run this command on a Linux machine, in WSL2 or on a Mac:
The command does not look at Docker or KVM. A machine that could run microVM builds gets the same setup: the flag decides, not the machine. It writes this block into the config file:
The factory’s Settings → Build settings sets the size of each sandbox. Small is at least 4 vCPU and 16 GiB of memory, and is the default. Large, with at least 8 vCPU and 32 GiB, is coming soon. The runner’s config does not set the size. The rest of runner init is as it is for any runner. It asks for the runner key and the agent’s credential, and it sets up the service. The machine still needs 5 GB of free disk. A Linux machine or WSL2 also needs systemd. See Set up your first host. After it writes the block, the command asks the gateway whether it provides sandboxes to this runner. It prints one line with the answer:
  • The gateway provides sandboxes. Nothing more to do.
  • The gateway refuses for a reason that can pass, such as managed sandboxes being off for the organization. The line gives the reason. The block stays, and the exit code is 0.
  • The check could not be made. The line says why. The block stays, and the exit code is 0.
  • The gateway provides no sandboxes. The command leaves no runner block, sets up no service and exits with a code other than 0.
Run outerlayer runner check at any time to ask again.

What it costs

The build’s time in the sandbox counts as managed build-hours, at the size of the sandbox. See Builds in a managed sandbox.

On a Mac

A Mac can host this runner with no Docker and no Linux VM. Run the same outerlayer runner init --sandbox command. It asks no question about a Linux VM. It writes the same block, and it keeps the runner running as a launch agent. The launch agent is the file ~/Library/LaunchAgents/ai.outerlayer.sandbox-runner.<unit name>.plist. The default unit name is outerlayer-runner. The agent runs as you, and the command needs no sudo. launchd starts the agent at login. It starts the runner again after a failure and after an update. A runner that you stopped with outerlayer runner stop stays stopped. The runner reads the agent’s credential from claude.env beside the config file. The launch agent’s file holds no credential. Check the agent with outerlayer runner status. It prints a launch agent line that says loaded or not loaded, or not installed when there is no agent file. To remove the agent, run outerlayer runner uninstall --service. If launchd refuses to load the agent, as it does over SSH with no session at the screen, the command says so and exits 0. It leaves the block and the file in place. Run outerlayer runner install --service from a session at the Mac’s screen to load the agent.
A build fails when the Mac sleeps. A sleeping Mac stops the runner, so the runner stops renewing the build’s claim, and the claim runs out. While a build runs, the runner keeps the Mac from going to sleep when it is idle. It cannot stop a sleep that you start, or a laptop that sleeps when you close its lid. Keep the lid of a laptop open while it runs builds.
The runner uses caffeinate, the macOS command for this. It holds it only while a build or a prepare job runs. It changes no energy setting. To check it, run pmset -g assertions while a build runs. To turn it off, set runner.keepAwake to false in the config file. The agent runs only while you are logged in. Set the Mac to log in at start.

Where it works

--sandbox works on Linux, WSL2 and macOS. It is refused on native Windows: run the command in WSL2 there. It is also refused with --vm, and with a config file that has a runnerVm block. Name another file with --config in that case.

Runs of schedule automations

A runner on managed sandboxes takes the runs of schedule automations. A run has no work item, so it differs from a build in four ways.
  • The sandbox is always the size Small. The factory’s machine size does not change it.
  • The sandbox ends with the run. OuterLayer never keeps or resumes it, and never saves a state from it.
  • A run starts from a saved state when the factory has one for the repository. Without a saved state, the run uses one sandbox and saves none.
  • The sandbox has the time limit of the run. The default is 30 minutes.
A run holds only a token that reads one repository and the key of the run. It holds no build variable and no credential that can write. OuterLayer bills the run’s time as managed build-hours. See Runs of schedule automations.

Limits

  • A kept sandbox lasts 24 hours. OuterLayer keeps the sandbox, paused, for the work item’s next job. After 24 hours, or when the factory has more than 10 kept sandboxes, the next job clones and sets up again. The next job also clones and sets up again when OuterLayer cannot wake the kept sandbox and makes a new one instead.
  • System packages come from a root setup script. The sandbox runs OuterLayer’s build image. No step of the build runs as root, and a devcontainer file changes nothing about it. Commit .outerlayer/setup-root.sh to install a package before the build starts. See Install system packages with a root setup script.
  • Restart the runner after you add or remove runner.sandbox.provider. A runner that is running keeps the provider it started with.
  • When OuterLayer makes no sandbox for a build, the build is not failed. The runner gives the item back, takes no work for 5 minutes, and then tries again.
The keys of the runner.sandbox block are in the config file reference.