Safety & security

Sandboxing

AI-assisted editorial review:

A term from AI security for a method that restricts, at the operating-system level, where an AI agent can run commands and edit files, and which network destinations it can reach.

What does Sandboxing mean in simple terms?

AI coding tools and work agents can run commands and edit files directly on the user's computer. Sandboxing isolates this workspace so the agent cannot edit files outside designated folders or connect to servers that have not been allowed. Because the fence is enforced by the operating system rather than by the AI's judgment, it is hard for the AI to go beyond that scope even if it is tricked by malicious instructions. As a result, users need to approve execution requests less often and can hand more work to the agent. A sandbox and execution approval are separate mechanisms, so using them together is the baseline.

How can Sandboxing be explained with an analogy?

It is like letting a child play only inside a fenced play area rather than across the whole living room, so no serious accident happens even without watching every move.

Where is Sandboxing used?

Case 1

Anthropic — Introducing the Claude Code sandbox

On October 20, 2025, Anthropic introduced a sandbox feature for Claude Code that restricts file access and network access separately.[1] Inside the working folder it can read and write files but cannot modify files outside it, the network connects only to approved servers, and the feature is built on operating-system features such as Linux bubblewrap and macOS seatbelt.[1]
Result: Reported that permission prompts fell by 84% in its own internal use (per Anthropic's internal measurement).[1]

Case 2

OpenAI — Per-task isolated environments in Codex

When OpenAI announced its cloud coding agent Codex on May 16, 2025, it explained that each task runs in a separate cloud sandbox containing the user's repository, and that internet access is turned off during the task.[2] The current Codex documentation sets out three levels—read-only, writing to the working folder, and full access—and explains that the sandbox and approvals are separate controls that work together.[3]
Result: Lets users choose, level by level, the boundaries for files outside the workspace and for the network (per OpenAI's official documentation).[3]

Learning steps, limitations and developments

  1. When handing a task to an AI agent, open only the folders that task needs.
  2. Allow the agent to connect only to the external sites it needs.
  3. Do not keep files containing passwords or authentication keys inside the sandbox.
  4. Use settings such as "full access" only briefly in a test environment, then switch them back.

A sandbox is effective only when both boundaries, files and network, are in place; with only one, information can leak or the agent can get outside the fence.[1] The 84% figure comes from Anthropic's internal use, so it cannot be assumed that other organizations will get the same result.[1]

How has Sandboxing evolved?

2025.05
Per-task cloud sandboxes
Coding agent tasks run without internet access in environments isolated per repository.
2025.10
Sandboxing
Two boundaries, files and network, are applied to local agents at the operating-system level.

Which concepts are related to Sandboxing?

  • Tool that uses it
    Claude CodeA coding agent that runs commands inside a sandbox
  • Underlying technology
    DockerRuns programs in isolated containers
  • Risk it aims to prevent
    Excessive AgencyA state in which AI can do too much
  • Related risk
    Lethal TrifectaBlocking outbound transfer paths reduces the risk of leaks

Execution approval vs Sandbox

ComparisonExecution approvalSandbox
Who enforces itA person decides each timeThe operating system blocks automatically
How it blocksAsks for permission before runningBlocks access outside the allowed scope
WeaknessRepeated prompts lead to habitual approvalLess effective if the scope is opened wide
Used togetherConfirms hard-to-reverse actionsOther tasks run automatically within the scope

Which sources explain Sandboxing?

  1. Anthropic — Beyond permission prompts: making Claude Code more secure and autonomous (2025-10-20) — https://www.anthropic.com/engineering/claude-code-sandboxing
  2. OpenAI — Introducing Codex (2025-05-16) — https://openai.com/index/introducing-codex/
  3. OpenAI — Sandboxing (accessed 2026) — https://learn.chatgpt.com/docs/sandboxing