# Sandboxes and runners

> Agents need machines to fetch the code, install the tooling, run the app and run the tests. Those machines should be isolated, disposable and have no standing access to production.

A sandbox is an isolated, disposable environment, often remote, defined by a Docker image, a Kubernetes pod or another service. It starts fast, sets up the toolchain and can be paused, resumed or moved. Some products need Linux, macOS and Windows runners, especially for native and mobile apps.

Isolation limits the damage. An agent that runs commands and reads the web can make mistakes or be tricked by a prompt injection. In CI, it runs in a container with a network policy, short-lived tokens with limited scope and no production credentials by default. It can still read production logs and metrics, read-only, through the observability tool, to follow the rollout of its change (see Maintenance and the closed loop). The token inside the sandbox can even be a placeholder: a gateway outside the sandbox checks each outbound request and swaps in a real, short-lived token. On developer machines, an OS-level sandbox blocks what the tool’s own permissions let through, such as a network call started from the shell. By default, Claude Code runs commands without isolation if the sandbox cannot start. A setting makes it stop instead: turn it on.

These machines also help verify the work. With computer use, the agent opens the app it built, clicks through it and reports before-and-after screenshots or a short recording. This helps with interfaces that are hard to test any other way, such as a mobile app on a simulator.

These machines can run in the vendor’s cloud or on your infrastructure. That choice decides where your code runs and where your secrets travel.

**When**: As soon as an agent runs code anywhere other than a developer’s machine.

**Trade-offs**: The stricter the isolation, the more network rules and secret injection you have to plan. Multi-OS runners and computer use take a lot of compute. A recording comes on top of automated tests.

## Where to start

- Define the build environment in an image
- Check that tests and build pass in the sandbox as they do in CI
- Restrict the network to an allowlist of domains
- Keep secrets out of the agent’s environment
- Plan for the operating systems you need: Linux, macOS, Windows

## Common mistakes

- Giving the agent standing production credentials
- Relying on the tool’s permissions alone, without OS-level isolation
- Letting a command blocked in the sandbox rerun outside it

## Metrics

- Environment startup time
- Compute cost per successful task

## Sources

- [Warp, The Factory Stack](https://www.warp.dev/blog/the-factory-stack)
- [Warp, 7 core components for building a software factory](https://www.warp.dev/blog/7-ways-to-build-a-software-factory)
- [Anthropic, The AI-native SDLC playbook](https://claude.com/fr/resources/articles/the-ai-native-sdlc-playbook)
- [Claude Code, Sandboxing](https://code.claude.com/docs/en/sandboxing)
