Skip to content

What is an AI agent sandbox?

An AI agent sandbox is a separate, disposable computer where an agent runs the code it writes. What one contains, why agents need it, the kinds on offer, and what to check before you pick one.

Harshraj

7 min read

What is an AI agent sandbox?#

An AI agent sandbox is a separate computer, created on demand, where an agent can run the code it writes, install packages and change files without touching your laptop, your servers or your data. It has its own filesystem and its own processes. Rules decide what it can reach on the network, and its life is in your hands: you start it, pause it, copy it and throw it away. The agent gets a real place to work. You keep a wall between that work and everything you care about.

Why agents need one#

A chatbot answers. An agent acts. Once a model can call tools, run shell commands and edit a repository, every one of those actions is code nobody reviewed before it ran. Most of the time that code is fine. Sometimes it is wrong in an ordinary way: a test script that deletes a directory, a dependency that pulls in half the internet, an infinite loop that eats a machine. And sometimes the instructions came from somewhere hostile, such as a web page or an issue comment written to steer the agent.

The OWASP GenAI Security Project names the risk in its 2025 list for LLM applications as Excessive Agency, the flaw "that enables damaging actions to be performed in response to unexpected, ambiguous" output from a model. Its first mitigation is to limit what an agent may call to "only the minimum necessary". A sandbox is how you apply that rule to code execution: whatever the agent runs, it runs inside a boundary you drew.

Anthropic made the same point when it added sandboxing to Claude Code in October 2025. Its engineering post says "effective sandboxing requires both filesystem and network isolation", because an agent that can read your files and also reach the internet can send those files anywhere. The payoff was practical as well as safer. Anthropic reports that in its own use, sandboxing "safely reduces permission prompts by 84%". Fewer prompts means the agent works longer without a person clicking approve.

What is inside a sandbox#

The parts vary by product, but a sandbox that is useful for agents has five things.

A filesystem of its own#

The agent needs somewhere to clone a repository, install dependencies and write output. That disk belongs to the sandbox. Nothing on it is shared with another sandbox unless you share it, and deleting the sandbox deletes it.

Processes and a shell#

Real work means running commands: test suites, compilers, package managers, sometimes a database or a browser. A good sandbox gives them a normal Linux shell where those tools behave as they do on a developer's machine, so the agent does not have to work around a cut-down environment.

Network rules#

This is where most of the safety lives. A sandbox should let you turn the network off, allow only the hosts a task needs, or open it fully when the task calls for that. OpenAI's Codex cloud takes a strict default here: "During the agent phase, internet access is off by default", with limited or unrestricted access available as settings.

A way to handle secrets#

Tools call APIs, and APIs want keys. The question is whether the agent can read those keys. Codex removes secrets before the agent starts, and Claude Code's cloud environments store network secrets "that sessions use without seeing them". Both designs come from the same fear: an agent that can read a key can also be talked into printing it.

A lifecycle you control#

You start it, pause it while the agent waits, keep a prepared copy and delete it when the task is done. Much of an agent's time goes to waiting on a model, so a sandbox that can pause without losing its state saves money, and one that can snapshot a prepared environment saves the setup time on every task after the first.

The kinds you will find#

Products that call themselves sandboxes cover a wide range, and the word hides real differences.

Some run code inside the same process as your application, with language-level limits on what the code may touch. These are fine for a calculator. They are a poor fit for an agent that needs to install packages and run a test suite, and their limits are only as strong as the language runtime that enforces them.

Others give each task a container on a machine shared with other customers. Containers start fast and are familiar, and for code you mostly trust they work well. The trade-off is that many containers share one operating system kernel, so the wall between neighbours is thinner than it looks.

A third group gives each sandbox a full Linux machine of its own, with its own kernel. That costs more engineering from the provider, and it is the safer default when the code is untrusted by definition, which agent code is.

The fourth option is to build it yourself on your own cloud account. That gives full control, and it gives you the pager too: patching and capacity become your job, and so do isolation and the network rules.

What changes when the user is an agent#

A sandbox for a person and a sandbox for an agent look alike from the outside. They are used very differently.

People start an environment and keep it for a day. Coding agents start hundreds, run a short loop of edit and check many times in each, and stop. So the number that matters is how fast the loop runs, measured from a change to its result. We covered that in Time to feedback: a task with forty checks spends far more time in the checks than in the start.

Work also runs in parallel. One evaluation or a batch of training rollouts can ask for a hundred sandboxes at once, and the useful questions become what happens at the limit, how failures are reported and whether a failed environment is billed as if the task ran. Finally, agents need state handled for them: a prepared repository with its dependencies installed, copied for each new task so nobody waits for the install twice.

What to check before you pick one#

Start with the work. If the agent edits code, it needs a full shell, room for dependencies and fast checks. If it only evaluates small snippets, a lighter product is enough. Then look at four things.

Isolation comes first: how separate is one sandbox from the next, and from the provider's other customers? Network and secrets come second: can you block the network, allow named hosts and keep keys out of the agent's reach? Third is state. Can you pause an environment and keep a prepared copy of it, or does every task start from nothing? Last comes billing: per second or per minute, with a minimum or without one, and whether you can cap what a run may cost before it starts.

We go through those questions in more depth in a separate checklist. The short version is that the cheapest sandbox per hour is rarely the cheapest per finished task.

Where Promigence fits#

Promigence is a sandbox platform for AI agents. Each sandbox is a full Linux environment of its own, and through the CLI one is ready for its first command in 207 ms at p50. Sandboxes can pause themselves when idle and are not billed while paused, prepared environments are kept as snapshots and copied for each task, and a run of many sandboxes is quoted and capped before it starts. Usage is billed per second at $0.0504 per vCPU-hour and $0.0162 per GiB-hour, and a new account starts with free credit. Start with the quickstart; Run AI-written code safely shows the network and secret settings in practice.

FAQ#

What is an AI agent sandbox?#

It is an isolated, disposable computer where an AI agent runs the code it writes. It has its own filesystem and processes, rules for what it can reach on the network, and a lifecycle you control, so the agent can work freely without touching your own systems.

Why do AI agents need a sandbox to run code?#

Because everything an agent runs is code nobody reviewed first. Mistakes and hostile instructions both happen. A sandbox limits the damage to a machine you can throw away, which is the OWASP advice of giving an agent only the access it needs.

Is a container a sandbox?#

It can be one. Containers share the host's kernel, so they suit code you mostly trust. For untrusted agent code, a sandbox with its own kernel is the safer default.

What should an AI agent sandbox include?#

A full shell and filesystem, network controls with an off switch and an allowlist, a way to use secrets without exposing them, and a lifecycle you control from pause to delete. For agents at scale, add fast checks, many sandboxes at once and billing by the second.

How much does an agent sandbox cost?#

Most providers charge for CPU and memory by the second or the minute. On Promigence a small sandbox of 2 vCPU and 4 GiB costs $0.1656 an hour at list rates, billed per second, and paused time is not billed.

Sources#

SourceWhat it supportsRead
OWASP GenAI: LLM06:2025 Excessive Agencythe definition and the minimum-access mitigation25 Oct 2026
Anthropic engineering: Claude Code sandboxing (20 Oct 2025)filesystem plus network isolation; 84% fewer permission prompts25 Oct 2026
OpenAI Codex: cloud environmentsinternet off by default in the agent phase; secrets removed before it25 Oct 2026
Claude Code: cloud environmentsnetwork secrets used without being seen25 Oct 2026
Promigence pricingper-second rates, paused time, free credit25 Oct 2026

More in the Promigence blog, or follow it by RSS.

Run your own workload on it, free

Send a repo and the command you run against it, whatever that is: an eval suite, an RL rollout, a CI job, a queue of coding tasks. We build the environment once, run it a thousand times, and send back the timings, the failures and an exact price. Free, once, on your real workload.

  • 1,000 runs of your own command, on your own repo
  • What each one cost in wall clock, and anything that failed
  • Whether a failure was your code or the environment
  • An exact price for your real volume

A person replies, usually the same day. Or write to support@promigence.ai.

See our Privacy Policy for how we use what you send.

Not ready to hand over a repo? Read the quickstart or check the numbers first.

Request access

Leave your work email and we will email you an invite code with $100 in free credits.

See our Privacy Policy for how we use your email.