# What is an agent sandbox?

Guides, Engineering · 30 November 2026 · Mapier Labs

> An agent sandbox is an isolated computer an AI agent gets to itself, started by an API call. What one is, how they differ, and what they are used for.

## What is an agent sandbox?

An agent sandbox is a computer an AI agent gets to itself: an isolated machine, started by an API call, where the agent can run commands, install software and work on files without touching yours or anyone else's. Most run Linux and execute code; some add a screen the agent can see and act on, and keep their state between runs.

The word covers a wide range. At one end is a short-lived container that runs a snippet of generated code and returns its output. At the other is a whole virtual machine with a desktop, a disk that outlives it, and a session the agent can come back to tomorrow. Both are sandboxes. Which one you need depends on what the agent does there.

## Why does an AI agent need a sandbox?

Because an agent runs code nobody has read. It writes a script, installs a package it found, opens a page it was sent. On your laptop or a production server, any of those can reach files, keys and networks the task never needed. In a sandbox the worst case is a broken sandbox, which you delete.

There are practical reasons too. A laptop runs out of room long before a swarm of agents does, so the rest have to run somewhere else. A product that gives agents to its own users needs each user's agent kept apart from the next. And a long task needs a machine that keeps going when the person who started it closes the lid.

We wrote about the wider shift in [why agents need their own cloud](https://mapier.ai/blog/why-agents-need-their-own-cloud). This guide is about the machine itself.

## How do agent sandboxes differ?

Every provider calls its product a sandbox, so compare them on what the agent actually gets. These are the questions that separate them:

- Isolation: a container sharing the host's kernel, a container under a stronger runtime, or a virtual machine with a kernel of its own.
- Operating system: Linux alone, or also Windows, macOS and phones.
- A screen: whether the agent can take a screenshot and click, type or tap, or only run commands.
- State: whether a sandbox can sleep and wake where it left off, be saved as a snapshot, or be forked into copies.
- Start: a boot from an image, or a restore from a snapshot with the setup already done.
- Network: what a sandbox can reach, what can reach it, and which address it leaves from.
- Scale and billing: how many run at once, and whether you pay only while one runs.

| If the agent… | Look for |
| --- | --- |
| Runs a snippet and returns its output | Fast start; a container may be enough |
| Works on a repository for hours | A disk that outlives it, sleep and wake, snapshots |
| Serves your own users | A machine for each user, and labels to cap what each spends |
| Uses desktop apps | A screen, input, and the operating system the app runs on |
| Runs the same task many times | Snapshots to restore from, and forks |

## How is a sandbox kept apart from everything else?

By the boundary underneath it. A plain container shares the host's kernel with every other container on it. Some providers add a stronger runtime: Modal's docs describe Sandboxes on gVisor, or in a virtual machine with its own Linux kernel. Others give each sandbox a lightweight virtual machine: Vercel's docs say each of its sandboxes runs in a Firecracker microVM with its own filesystem and network.

On Mapier Pod each sandbox is a virtual machine of its own, with its own kernel, disk and network address, and one sandbox cannot see another's memory, files or processes. Pod's docs are as plain about the other side: inside one sandbox nothing is kept apart, so every process, user and container in it shares that machine. If you give sandboxes to your own users, give each user one of their own.

*Three of a project's sandboxes on Pod, each labelled with the user it belongs to: two running, and one asleep until its user comes back.*

## What does starting a sandbox look like?

One call. These lines are from the TypeScript steps of [Pod's Linux quickstart](https://docs.mapier.ai/pod/sandboxes/quickstart/linux): create a Linux sandbox, which waits until it is running, then run a command in it. A test key sees only test sandboxes.

When the work is done, delete the sandbox or let it sleep. A Pod sandbox sleeps by itself when nobody uses it and wakes where it left off; it is billed by the second while it runs, and while it sleeps it is billed only for what its disk and snapshots store.

```ts
import { Pod } from "@mapier/pod";

const pod = new Pod({ apiKey: process.env.POD_API_KEY! });
const sandbox = await pod.sandboxes.create({ system: "linux" });

const { stdout } = await sandbox.run("uname -a && cat /etc/os-release");
console.log(stdout);
```

## What do people run in agent sandboxes?

The common shapes are few. Pod's docs and [Pod's use cases](https://mapier.ai/pod/use-cases) cover most of them:

- Coding agent sessions: one sandbox to each session, started from a snapshot with the agent's tools and everything the repository needs installed, asleep when idle.
- Evals and reinforcement learning: an environment saved once as a snapshot, and every episode a clean sandbox made from it.
- CI for the code agents write, on runners restored from a snapshot rather than booted.
- Experiments split across many sandboxes, one for each run, each result collected as it finishes.
- A personal agent's computer of its own, beside yours, kept as the agent left it.

*An eval run on Pod: every episode is its own sandbox, restored from one snapshot of the environment, so each starts clean and identical.*

## Where does Mapier Pod fit?

[Mapier Pod](https://mapier.ai/pod) gives each agent a whole virtual machine, from one API, with snapshots, forks into running copies, sleep and wake, and billing by the second. Sandboxes run in the US West.

What runs today, plainly: Linux sandboxes run today; macOS, Windows, iOS and Android do not run yet. Pod's docs describe a screenshot call and a screen action call for [agents that work on a screen](https://mapier.ai/pod/computer-use), and mark them as not offered yet; on a Linux sandbox today an agent has commands, files and ports.

If you are choosing between providers, [our comparison of agent sandboxes](https://mapier.ai/blog/ai-agent-sandboxes-compared) sets Pod beside E2B, Daytona, Modal, Vercel, Cua and Browserbase, and says where each fits better. For agents that work through a screen, see [what a computer-use agent needs from its machine](https://mapier.ai/blog/what-a-computer-use-agent-needs).

## Questions

### Is an agent sandbox the same as a container?

Sometimes. Some sandboxes are containers, some run containers under a stronger runtime, and some are virtual machines with their own kernel. A Pod sandbox is a virtual machine.

### Is a sandbox only for running code?

No. A sandbox can hold a whole working environment: a repository, tools, files and a session that outlives one task. Some also give the agent a screen to see and act on.

### Which operating systems do agent sandboxes run?

Most run Linux, and some also run Windows or macOS. On Mapier Pod, Linux sandboxes run today; macOS, Windows, iOS and Android do not run yet.

### Does a sandbox keep its state?

It depends on the provider. By default a Pod sandbox keeps its disk while it sleeps or stops; it can sleep with its memory kept, and can be saved as a snapshot to start new ones from.

### How is a sandbox billed?

On Pod, by the second while it runs. A sleeping or stopped sandbox is billed only for the disk and snapshots it stores.

## Sources

- [Modal: Sandboxes](https://modal.com/docs/guide/sandboxes)
- [Vercel: Vercel Sandbox](https://vercel.com/docs/sandbox)
- [Mapier: Pod sandboxes](https://docs.mapier.ai/pod)
- [Mapier: Pod concepts](https://docs.mapier.ai/pod/sandboxes/concepts)
- [Mapier: Pod isolation and secrets](https://docs.mapier.ai/pod/sandboxes/security)
- [Mapier: Pod quickstart for Linux](https://docs.mapier.ai/pod/sandboxes/quickstart/linux)
- [Mapier: Pod, your users](https://docs.mapier.ai/pod/sandboxes/your-users)
- [Mapier: Pod coding agent sessions](https://docs.mapier.ai/pod/sandboxes/agent-sessions)
- [Mapier: Pod evals and RL environments](https://docs.mapier.ai/pod/sandboxes/evals)
