Sandboxes Aren't Optional: 4 Ways to Isolate Coding Agents

Robert Brennan, OpenHands14:23 · Oct 2026 · 103K views
Thumbnail for Sandboxes Aren't Optional: 4 Ways to Isolate Coding Agents Watch on YouTube
TL;DR
  1. 1

    Coding agents running locally with skipped permissions can access the same files, secrets, databases, and clusters as their user.

  2. 2

    The right sandbox follows least privilege, giving each agent only the repository, secrets, and systems it needs.

  3. 3

    Kubernetes pods provide ephemeral, isolated environments that can respond to schedules and events at cloud scale.

Summary

Robert Brennan traces coding agents from ChatGPT snippets and AI-powered IDEs to agents that run code, inspect errors, and complete development loops. As agents move into the cloud and operate without a person watching every action, he argues that sandboxing should enforce least privilege. He compares Docker containers on a laptop, Claude Code in GitHub Actions, a long-lived VM or Mac Mini, and one Kubernetes pod per session. Each option differs in local access, scale, isolation, persistence, and available triggers. Brennan is direct about the limits: agents have escaped sandboxes, and container escape attacks exist. He presents OpenHands Agent Canvas as an interface for switching between local Docker, remote VMs, and Kubernetes, depending on whether the work needs fast local iteration or autonomous cloud execution.

Key ideas
01:05

Coding agents have moved from generated snippets to autonomous development loops

Brennan describes a progression from asking ChatGPT for a SQL query, to copying generated code into an IDE, to AI-powered IDEs such as Cursor and GitHub Copilot. The major change arrived in early 2024, when agents began running the code they wrote, reading error messages, searching for answers, and continuing the development loop. Most developers still run tools such as Claude Code, OpenHands, or Codex on a laptop as manually prompted pair programmers. Organizations are moving agents into the cloud, where they can run without a person continuously approving every action.

03:32

Local agents with skipped permissions can reach everything their user can reach

Running an agent locally forces a choice between approving repeated actions and using a mode such as dangerously skip permissions. In the latter mode, the agent can access the whole local file system, secrets in environment variables and the home directory, production databases, and production Kubernetes clusters that the user can reach. Brennan says the agent therefore needs either close supervision or an environment that cuts off unnecessary access. This matters more as agents respond to GitHub, DataDog, and Slack events instead of waiting for manual prompts.

04:44

Least privilege limits the damage from agent mistakes and prompt injection

Brennan applies a familiar security rule to coding agents: give them only what they need for their job. An agent editing a GitHub repository might need that repository and a few secrets for a local database, but it should not receive every secret or file on the system. The sandbox should begin with a clear account of the agent's required access. Limiting that access limits the blast radius if a prompt injection attack occurs, if the agent becomes confused, or if something else goes wrong during execution.

05:42

Docker on a laptop gives local control and easy resets, but limited scale

With Docker, each new OpenHands conversation can get a fresh container. The container is ephemeral, so an agent can delete its files and the user can remove the container and start again. The user can selectively mount a Git repository, expose ports for an application, provide specific secrets and environment variables, and run MCP servers locally or in the container. The agent still edits a local copy of the code, while the user decides when to push changes. Brennan says this setup does not scale well because a laptop can run only so many containers and cannot easily listen for Slack or DataDog events.

07:02

GitHub Actions adds scheduled automation but ties agents to GitHub

In Brennan's second setup, Claude Code runs inside an ephemeral GitHub Actions environment. It clones the repository, performs its work, and disappears when the action ends. The platform provides isolated environments and a secrets registry, and teams can run as many actions as they are willing to pay for. Actions can start on a schedule, such as updating dependencies every Monday morning, or when a pull request opens for automated code review. The trade-off is that the setup is tied to GitHub Actions and its event model. It cannot directly respond to a Slack or DataDog webhook.

08:22

A dedicated VM or Mac Mini provides persistence but puts agents together

A long-lived virtual machine or Mac Mini lets agents keep changes between runs. That persistence can help agents work with an environment that remains configured, but it can also leave the machine in a bad state that someone must debug. A VM can listen for webhooks from Twilio, Slack, DataDog, and GitHub, so it supports automated agents beyond GitHub Actions. The isolation problem remains because agents share the machine. A code review agent might access DataDog used by an incident bot, and one agent might edit another agent's memory. Co-location gives agents more access than their individual tasks require.

09:47

Kubernetes isolates each session while supporting event-driven cloud execution

Brennan calls a Kubernetes pod per agent session the most robust of the four approaches. A pod starts, the agent works on a repository copy, and the environment disappears after the session. This avoids the long-term state problems of a VM and gives each agent its own workspace. Kubernetes also provides cloud scale, subject to available memory and CPU. Agents can run from cron jobs or HTTP events from Slack, GitHub, and Jira. The model supports fully automatic execution while keeping sessions separate from one another.

11:02

Sandbox choice depends on locality, scale, isolation, persistence, and triggers

Brennan compares the four setups across several practical dimensions. A laptop works with the user's local code, while a remote system must clone or maintain its own copy. Local execution supports only a small number of agents before the machine becomes uncomfortable, while Kubernetes can run thousands. Skipped permissions provide no isolation, a shared VM separates agents from the user's environment but lets them interfere with one another, and Kubernetes gives each session its own workspace. Local machines and VMs persist by default, while cloud sessions can save state externally. Manual prompts are typical locally; schedules and system events become available in the cloud.

12:22

A sandbox reduces risk, but it cannot guarantee containment

Brennan says sandboxing is not a complete security solution. He points to an Anthropic test of Mythos in which one instance broke out of its sandbox and gained internet access, and he mentions known container escape attacks, including attacks affecting old Docker versions. Users still need to be careful about the sandbox implementation and its dependencies. He presents isolation as a useful first pass that limits what an agent can do, rather than as proof that an agent cannot escape or reach forbidden systems.

"The agent does have access to a lot of things, right? It has access to your whole local file system, it has access to any secrets that are in your environment variables."04:11
Who should watch
  • You run Claude Code, Codex, or another coding agent locally and want to understand what skipped permissions expose.
  • Your team is deciding between GitHub Actions, a VM, Docker, and Kubernetes for automated coding work.
  • You are building cloud-based or event-triggered agents and need to limit their access without assuming a sandbox is perfect.