
TL;DR
AI agents are getting their own computers. Here is how to choose a sandbox architecture: filesystem isolation, network policy, secrets boundaries, snapshots, and when shell access is overkill.
AI agents are starting to need computers of their own.
That sounds dramatic, but the architecture shift is simple. Once an agent can write code, run shell commands, edit files, install packages, inspect outputs, and keep working across sessions, a plain tool call is not enough. You need a runtime boundary around the work.
That boundary is the sandbox.
The question is no longer whether sandboxes matter. The question is which sandbox shape fits the job.
Last updated: June 23, 2026
LangChain's recent guide on choosing the right sandbox for AI agents puts the risk plainly: agent-written code can create threats to data and systems, so teams need to control where code runs and what it can access. The post calls sandboxes computers your agent can safely use.
OpenAI's Agents SDK docs now route builders toward sandbox agents when work needs files, commands, packages, snapshots, mounts, or provider links. The TypeScript sandbox-agent docs describe persistent workspaces where agents can search document sets, edit files, run commands, generate artifacts, and resume from saved sandbox state.
Flue's repo frames the same category from another angle: a sandbox agent framework where agents can keep context, use tools, modify files, and complete real work in a secure environment. That puts it in the same practical lane as the agent harness question in Flue: Agent Harness Framework, Different or Just Shiny?.
The trend is clear: sandboxing is becoming agent backend infrastructure.
The lazy version of sandboxing is "run it in Docker."
That may be part of the answer. It is not the whole answer.
A useful agent sandbox answers seven questions:
| Question | Why it matters |
|---|---|
| What filesystem can the agent see? | Prevents accidental access to secrets, unrelated repos, or private data |
| What network can it reach? | Limits exfiltration and malicious downloads |
| Where do credentials live? | Keeps secrets out of untrusted code execution |
| Can the workspace be snapshotted? | Enables resume, rollback, and incident review |
| What resource limits apply? | Stops runaway CPU, memory, disk, and token-adjacent loops |
| Which tools are mounted? | Keeps agent capability tied to task need |
| What evidence is captured? | Makes the run reviewable after the model says it is done |
If your sandbox only isolates processes but leaves secrets, network, logs, and snapshots vague, you still have a weak agent runtime.
For the broader team-control-plane layer, read Sandboxed Agents Are Becoming the Team Control Plane. This piece is the lower-level architecture guide.
LangChain uses a useful security frame: agents become risky when three ingredients combine.
That is the agent version of the lethal trifecta.
The sandbox should break at least one side of that triangle. Ideally, it weakens all three:
This is why "just ask the model not to leak secrets" is not a security control. The model may be tricked. The sandbox should make the trick less useful.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
From the archive
Jun 23, 2026 • 8 min read
Jun 23, 2026 • 8 min read
Jun 23, 2026 • 9 min read
Jun 23, 2026 • 7 min read
The first architecture choice is where the sandbox lives.
| Sandbox type | Best for | Watch out for |
|---|---|---|
| local process sandbox | fast iteration, private repos, developer-controlled tasks | weak isolation if it can see the whole machine |
| Docker sandbox | repeatable builds, file work, package installs | secrets and network need explicit policy |
| cloud sandbox | team workflows, background jobs, scalable runs | data residency, cost, vendor lock-in |
| hosted provider sandbox | fastest path with managed lifecycle | opaque internals and provider-specific limits |
| self-hosted remote sandbox | stronger control over data and models | operational burden and patching |
There is no universal winner.
A docs summarizer probably does not need a shell. A code migration agent probably does. A security triage agent may need an isolated workspace with no outbound network except approved package mirrors. A customer support agent may need no filesystem at all.
The architecture should follow blast radius, not ambition.
The most important sandbox design question is where credentials live.
If secrets are mounted as plain files or environment variables inside the sandbox, untrusted code can try to read and leak them. That may be acceptable for a throwaway API key in a toy demo. It is not acceptable for production systems.
LangChain's sandbox post describes an authorization-proxy pattern: credentials get injected into outbound traffic after it leaves the sandbox, so untrusted code inside the sandbox does not directly hold the secret.
That is the shape teams should copy.
The policy:
Do not put durable production credentials inside an agent sandbox.
Give the sandbox scoped capabilities.
Inject credentials at a controlled boundary.
Log which capability was used, not only which command ran.
For coding-agent workflows, pair this with Permissions, Logs, and Rollback. Permissions without logs are weak. Logs without rollback are a documentary.
OpenAI's sandbox-agent docs emphasize saved sandbox state and snapshots. That is not a minor convenience.
Snapshots solve three practical problems:
Resume. Long-running work can continue from the same files, packages, and generated artifacts instead of rebuilding context from scratch.
Rollback. A bad edit, bad package install, or bad generated artifact can be compared against a previous state.
Review. The team can inspect what the agent actually had in its workspace when it made a decision.
Without snapshots, a failed agent run is often unreproducible. You have logs, but not the state those logs refer to.
That connects directly to agent workflows as code. If a workflow has typed gates, the sandbox snapshot is one of the receipts those gates should preserve.
Not every agent needs a computer.
Giving an agent shell and filesystem access increases capability, but it also increases attack surface. Before adding a sandbox, ask whether the agent can do the job with narrower tools:
If a narrow tool solves the workflow, use the narrow tool.
Reach for a general sandbox when the agent genuinely needs to create or transform artifacts over multiple steps: code patches, notebooks, generated files, package experiments, build outputs, data analysis scripts, or long-running project work.
That is the difference between useful autonomy and unnecessary blast radius.
Before choosing a sandbox provider or framework, answer these questions:
If a vendor cannot answer those clearly, do not treat it as production-grade yet.
The counterargument is strong: sandboxes are infrastructure, and infrastructure has cost.
Many useful agents do not need general code execution. A support agent can answer from retrieved documents. A sales agent can draft follow-ups from CRM fields. A release-note agent can summarize merged pull requests. A documentation agent can propose edits through a narrow patch tool. That is also why the managed-agent decision in Managed Agents vs LangGraph vs DIY should start with the runtime boundary, not the marketing category.
For those agents, a full sandbox may be ceremony.
The better default is least capability:
Sandboxes are powerful because they let agents do real work. That is also why they should not be handed out casually.
An AI agent sandbox is an isolated runtime where an agent can work with files, commands, packages, tools, and artifacts without directly touching the host system or production environment. A good sandbox also controls network access, credentials, resource limits, snapshots, and logs.
Docker can be part of a sandbox, but it is not sufficient by itself. You still need filesystem scoping, network policy, secrets handling, resource limits, snapshots, logs, and approval gates.
An agent needs shell access when the task depends on running commands, installing packages, executing tests, transforming files, or generating artifacts. If the task can be handled through narrow structured tools, avoid shell access.
Prefer keeping durable secrets outside the sandbox and injecting scoped credentials at a controlled boundary, such as an authorization proxy. Avoid placing production credentials directly into files or environment variables that untrusted code can inspect.
Log the task contract, mounted files, allowed tools, commands, file changes, network-relevant actions, approvals, snapshots, verification output, cost, latency, and final receipt. The goal is to make the run reproducible and reviewable.
Read next
Runtime's Launch HN thread is a useful signal: teams do not just want isolated coding agents. They want a control plane for approvals, secrets, telemetry, review, and merge policy.
8 min readA practical security playbook for running Codex cloud tasks safely in 2026 using OpenAI docs: internet access controls, domain allowlists, HTTP method limits, and review workflows.
10 min readAI coding agents become safer when permissions, logs, and rollback are designed as one system. Here is the operating loop I would put around any agent that can edit code, run tools, or open pull requests.
9 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Open-source cloud sandboxes for AI agents. Isolated environments that start in under 200ms, run code in Python, JavaScri...
View ToolOpen-source terminal agent runtime with approval modes, rollback snapshots, MCP servers, LSP diagnostics, and a headless...
View ToolCognition Labs' autonomous software engineer. Handles full tasks end-to-end - reads docs, writes code, runs tests, and...
View ToolFrontend stack for agent-native apps. React hooks, prebuilt copilot UI, AG-UI runtime, frontend tools, shared state, and...
View ToolConfigure Claude Code for maximum productivity -- CLAUDE.md, sub-agents, MCP servers, and autonomous workflows.
AI AgentsWhat MCP servers are, how they work, and how to build your own in 5 minutes.
AI AgentsA complete, citation-backed Claude Code course with setup, prompting systems, MCP, CI, security, cost controls, and capstone workflows.
ai-development
Runtime's Launch HN thread is a useful signal: teams do not just want isolated coding agents. They want a control plane...

A practical security playbook for running Codex cloud tasks safely in 2026 using OpenAI docs: internet access controls,...

AI coding agents become safer when permissions, logs, and rollback are designed as one system. Here is the operating loo...

A long-form technical read on Flue from Fred K Schott, with deeper comparisons against OpenAI Agents, Vercel AI SDK, Goo...

The 2026 agent decision is not CrewAI vs LangGraph. It is whether your loop lives in vendor infrastructure, a self-hoste...

Aharness, LangChain's custom harness pattern, and OpenAI's code-first migration all point to the same next step: agent p...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.