# Sandbox

> Canonical: https://skillalmanac.com/glossary/sandbox | Last verified: 2026-11-24 | Index status: index-eligible

For coding agents, a sandbox is an operating-system-enforced boundary around commands they run, limiting which files they can write and which network hosts they can reach. Claude Code and Codex both document one.

Also called: AI sandbox, sandboxing, sandboxed agent, code sandbox, agent sandbox.

## In plain language

A sandbox is a fenced-off area for an AI agent that runs commands on your computer. Claude Code's documentation says its sandbox covers shell commands only, is off by default, and does not run on native Windows. The same page says sandboxing reduces risk but is not a complete isolation boundary.

## Technical definition

Claude Code's documentation describes its sandbox as a boundary that the shell commands Claude runs, and the processes they start, begin inside. By default sandboxed commands can write to the working directory, a per-user temp directory and added directories, while reads cover most of the machine. Network connections go through a proxy that checks each host against allowed domains, which start empty. The docs name Seatbelt on macOS and bubblewrap on Linux and WSL2, and call sandboxing, permission rules and permission modes complementary layers. They state that file tools, local MCP servers and hooks run outside the sandbox. OpenAI's Codex documentation lists the common sandbox modes read-only, workspace-write and danger-full-access, and says the approval policy decides when the agent must stop and ask.

## How it shows up when you use agents

When a coding agent runs shell commands, a sandbox sets what those commands can reach. Claude Code's documentation says its sandbox is off by default and is turned on with /sandbox, and that it does not run on native Windows, where commands run unsandboxed. In Codex the sandbox mode is a named setting, and the approval policy is a separate setting beside it.

Codex's documentation says the sandbox reduces approval fatigue: the agent can keep working inside the boundary, and the approval flow takes over when it needs to go beyond it. Claude Code's documentation says the sandbox covers shell commands only, and that file tools, local MCP servers and hooks run outside it. It lists reads as covering most of the machine, including credential files such as ~/.ssh and ~/.aws/credentials, unless you change that.

Related ideas: [guardrails](/glossary/guardrails), [prompt injection](/glossary/prompt-injection) and [human in the loop](/glossary/human-in-the-loop).

## Common confusions

- **Sandbox versus permissions.** In Claude Code's documentation, permission rules control which tools can be used and are evaluated before a tool runs, while the sandbox gives OS-level enforcement on what shell commands can access. The page calls them complementary layers.
- **Sandbox versus approval policy.** In Codex's documentation, the sandbox defines technical boundaries, and the approval policy decides when the agent must stop and ask before crossing them.
- **Myth: a sandbox is a complete boundary.** Claude Code's documentation says sandboxing reduces risk but is not a complete isolation boundary.

## Worked examples in this catalogue

### [coding-agent-guardrails](https://skillalmanac.com/skills/skill-almanac/coding-agent-guardrails)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A pre-action checklist for coding agents plus a read-only audit of a repo's guardrail setup.

Why it exercises the concept: It checks the guardrail setup of a repository that coding agents work in.

### [Codex](https://skillalmanac.com/tools/codex)

```
codex
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Codex's documentation lists the sandbox modes read-only, workspace-write and danger-full-access.

Why it exercises the concept: The same page says the sandbox sets technical boundaries and the approval policy decides when the agent must stop and ask.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

```
claude
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's documentation says its sandbox is off by default and is turned on by running /sandbox.

Why it exercises the concept: The same page calls sandboxing, permission rules and permission modes complementary layers.

## Related terms

- [Guardrails](https://skillalmanac.com/glossary/guardrails.md)
- [Prompt injection](https://skillalmanac.com/glossary/prompt-injection.md)
- [Coding agent](https://skillalmanac.com/glossary/coding-agent.md)
- [Agent harness](https://skillalmanac.com/glossary/agent-harness.md)
- [AI safety](https://skillalmanac.com/glossary/ai-safety.md)
- [Human in the loop (HITL)](https://skillalmanac.com/glossary/human-in-the-loop.md)

## Sources

- [Sandboxing](https://code.claude.com/docs/en/sandboxing), Anthropic (Claude Code Docs) (accessed 2026-11-24)
- [Sandboxing](https://learn.chatgpt.com/docs/sandboxing), OpenAI (Codex docs) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
