Sandboxes and controlled environments

Home Learn Sandboxes and controlled environments

In short

A sandbox is a controlled place where an AI agent can work with limited access. It can reduce what a mistake reaches, but its protection depends on the files, network, credentials, and actions actually allowed inside it.

Why it matters

An agent that edits code or uses a command line can do useful work quickly. It can also modify the wrong files or reach a service you didn’t intend to expose. A separate work area gives you a chance to inspect the proposed change before it reaches a real system. The word sandbox by itself says nothing about the strength of its isolation.

How it works

Place a copy of the relevant material in a controlled environment. Limit mounted folders, network destinations, user privileges, and available secrets. Set a time or resource limit. The agent can read and edit within that space, run approved checks, and produce a difference for review. A person or a separate release process then decides whether to bring the change into the main environment.

Anthropic’s 2025 account of sandboxing its coding agent explains the value of filesystem and network restrictions around autonomous work. Its 2024 agent guide also recommends testing agents in sandboxed environments before wider use. These are implementation examples, not a guarantee that any system called a sandbox has identical controls. Review the actual configuration and verify what happens when an action is blocked. A sandbox with production credentials or unrestricted outbound access may still reach outside the intended work area.

The boundary should match the job. A code-editing task might need one repository copy and a test runner; it doesn’t need customer records. Keep an original copy, inspect the diff, and use independent tests for the behavior you care about. A passing test inside the sandbox checks a specified case. It doesn’t show that the proposed change is safe in every later environment. Plan the handoff: who reviews, who merges, and how a faulty change can be reversed.

Example

Illustrative example: this scenario is invented.

Eli, 28, is reviewing a small public website. He gives an agent a copy of one stylesheet and an example page. The agent adjusts spacing and runs a local layout check. It has no access to the live host, publishing account, or unrelated folders. Eli reviews the diff and notices that a mobile breakpoint changed more than requested. He asks for a narrower patch before deciding whether to use it. The isolated run makes the proposal inspectable without letting it alter the site.

He also keeps a clean copy of the original page. That lets him compare the altered layout and return to the starting point if the change creates a problem elsewhere.

What it doesn’t mean

A sandbox isn’t an approval and doesn’t make the model’s judgment reliable. A preview can miss accessibility, data, or deployment problems. Isolation also doesn’t erase information the agent was given; sensitive inputs still need their own controls. Ask what is mounted and what can leave the environment before relying on the label.

Try it

Sketch a sandbox for an imaginary public recipe-site typo fix. List the one file it may edit, the check it may run, and the network access it needs. Ask any assistant to find unnecessary permissions in your sketch. Add a review step that compares the proposed change with the original text.

Keep going

Sources

Share this page