---
title: "Sandboxing pattern for AI agents | Agentic Pattern Language"
description: "Run the agent inside set limits on files and network so it can act without asking each time. Sourced from Anthropic, OpenAI, and Google."
url: https://agenticpatternlanguage.com/patterns/sandboxing/
---

21 [One agent](https://agenticpatternlanguage.com/#one-agent)

# Sandboxing

Run the agent inside set limits on files and network so it can act without asking each time.

SW Anthropic, OpenAI, Google, Simon Willison

[How to read this](https://agenticpatternlanguage.com/notation/)

## Part of

* [Agent loop](https://agenticpatternlanguage.com/patterns/agent-loop/)
* [Code actions](https://agenticpatternlanguage.com/patterns/code-actions/)
* [Asynchronous coding agent](https://agenticpatternlanguage.com/patterns/background-agent/)

## Alternatives

* [Human approval](https://agenticpatternlanguage.com/patterns/human-approval/)
* [Guardrails](https://agenticpatternlanguage.com/patterns/guardrails/)

## The problem

Approving every action wears people down until they stop paying attention, and code a model writes can compromise the machine it runs on.

> Constantly clicking "approve" slows down development cycles and can lead to ‘approval fatigue’, where users might not pay close attention to what they're approving, and in turn making development less safe.

Anthropic [Making Claude Code safer with sandboxing](https://www.anthropic.com/engineering/claude-code-sandboxing) Oct 20, 2025

> Code execution is a special tool that has extra security implications: sandboxing must be used to prevent model-generated code to compromise the local environment, potentially creating security issues.

Google [Safety and Security for AI Agents](https://google.github.io/adk-docs/safety/)

## Therefore

> Sandboxing creates pre-defined boundaries within which Claude can work more freely, instead of asking for permission for each action.

Anthropic [Making Claude Code safer with sandboxing](https://www.anthropic.com/engineering/claude-code-sandboxing) Oct 20, 2025

> The sandbox is the boundary that lets the agent act autonomously without giving it unrestricted access to your machine.

OpenAI [Sandbox](https://developers.openai.com/codex/concepts/sandboxing)

> Run your agent in a secure sandbox that restricts the files and secrets it can access and the network connections it can make.

SW Simon Willison [Designing agentic loops](https://simonwillison.net/2025/Sep/30/designing-agentic-loops/) Sep 30, 2025

## In use

Claude Code

> In our internal usage, we've found that sandboxing safely reduces permission prompts by 84%.

Anthropic [Making Claude Code safer with sandboxing](https://www.anthropic.com/engineering/claude-code-sandboxing) Oct 20, 2025

Codex

> When a local chat runs commands in the ChatGPT desktop app, Codex CLI, or IDE extension, those commands run inside a constrained environment instead of running with full access by default.

OpenAI [Sandbox](https://developers.openai.com/codex/concepts/sandboxing)

claude.ai

> When Claude runs code inside claude.ai, it does so in a gVisor container on isolated infrastructure.

Anthropic [How we contain Claude across products](https://www.anthropic.com/engineering/how-we-contain-claude) May 25, 2026

## Where it breaks

Each new capability needs configuring, network or host access breaks isolation, and agents’ built-in sandboxes lack documentation you can trust.

> Sandboxing is safe but high-maintenance: each new capability needs configuring, and anything requiring network or host access breaks isolation.

Anthropic [How we built Claude Code auto mode: a safer way to skip permissions](https://www.anthropic.com/engineering/claude-code-auto-mode) Mar 25, 2026

> Coding agents themselves implement various levels of sandboxing, but so far I’ve not seen convincing enough documentation of these to trust them.

SW Simon Willison [Designing agentic loops](https://simonwillison.net/2025/Sep/30/designing-agentic-loops/) Sep 30, 2025

## Sources

1. [Making Claude Code safer with sandboxing](https://www.anthropic.com/engineering/claude-code-sandboxing) David Dworken and Oliver Weller-Davies, Anthropic, Oct 20, 2025
2. [How we built Claude Code auto mode: a safer way to skip permissions](https://www.anthropic.com/engineering/claude-code-auto-mode) John Hughes, Anthropic, Mar 25, 2026
3. [How we contain Claude across products](https://www.anthropic.com/engineering/how-we-contain-claude) Anthropic, May 25, 2026
4. [Sandbox](https://developers.openai.com/codex/concepts/sandboxing) OpenAI
5. [Safety and Security for AI Agents](https://google.github.io/adk-docs/safety/) Google
6. [Designing agentic loops](https://simonwillison.net/2025/Sep/30/designing-agentic-loops/) Simon Willison, Sep 30, 2025

Added Nov 14, 2026
