Tegoby Attention SpanBlogBook a demo

Five ways to sandbox an AI agent

There are five common ways to fence in an AI agent, and each one keeps out different things. None of them stops data leaving through a place you allowed.

We make Tego, so read this with that in mind. Every claim about another tool comes from its own docs, read on 2 or 5 November 2026 (dates in the sources), and docs change, so check the links.

Sandboxes built into the agent

Claude Code fences its shell commands with Seatbelt on macOS and bubblewrap on Linux and WSL2, with network through a proxy whose allowlist starts empty. Its sandboxing guide states the edge: "The sandbox covers shell commands only." It is off by default, allows reads of most of the machine unless you deny them, and runs commands unsandboxed on native Windows, or when it cannot start unless failIfUnavailable is set.

Anthropic's sandbox runtime, srt claude, wraps "the whole Claude Code process, including file tools, MCP servers, and hooks". It is "a beta research preview".

Codex sandboxes the commands it runs. Its default, workspace-write, limits writes to the workspace with network off and keeps .git read-only. On Linux it "uses bwrap plus seccomp by default" (Codex agent approvals and security), and its danger-full-access mode "removes the filesystem and network boundaries".

Both know their agent's tools. Each covers one agent, and each can be switched off.

Containers and dev containers

A container gives the agent its own view of the files, and a dev container makes that setup the same for a whole team. Anthropic's reference adds an outbound firewall and suits unattended runs with --dangerously-skip-permissions.

Its stated limits: the project is mounted in, so edits land on your machine, and with prompts off a malicious project can exfiltrate "anything accessible inside the container, including the Claude Code credentials". Codex's docs warn the same.

Virtual machines, local or hosted

A VM runs its own kernel, the core of the operating system. Anthropic calls that "the strongest separation" and recommends it for untrusted repositories (Choose a sandbox environment).

Lima's AI agents page recommends mounting only the project folder, and rates its sync mode, which reviews changes before they reach your machine, safer than a mount.

Docker Sandboxes runs agents "in isolated environments on your machine or on Docker-managed cloud infrastructure". Its architecture page says local stdio MCP servers do not run inside the sandbox VM, and a directly mounted workspace sees your real files.

Hosted VMs move everything off your machine: Claude Code's cloud sessions run in an "isolated, Anthropic-managed virtual machine", and E2B offers "isolated cloud sandboxes" for agents. The trade is trusting a provider with your code.

Supervised runtimes: NVIDIA OpenShell

OpenShell keeps the agent in a Docker, Podman, Kubernetes or microVM sandbox. Files are limited with Landlock, a Linux feature that lets a process give up file access, and every connection goes through a supervisor outside that "checks requests against policy, supplies credentials, resolves DNS, opens approved connections".

Agents "never see real credentials", a policy prover checks proposed network rules, and each proposal waits for human review by default. Its best practices warn that an endpoint without request rules lets the agent "send any request or data to the destination".

Kernel rules around the agent's processes

These wrap the agent itself, on your real machine.

  • bubblewrap is the building block under Claude Code's and Codex's Linux sandboxes. Its README calls it "not a complete, ready-made sandbox with a specific security policy".
  • firejail is "an SUID sandbox program" with profiles for common programs.
  • nono runs with no root on Linux 5.13 (Landlock), macOS and WSL2. It blocks paths such as ~/.ssh by default, injects credentials through a proxy, keeps a tamper-evident audit and snapshots files to restore. Its docs say "Network is allowed by default" and "nono cannot protect files within allowed paths" (overview).
  • Sandlock needs Linux 6.12 and no root. It adds HTTP rules by method, host and path, and a workspace whose changes you keep or discard. Its paper puts kernel bugs and side channels out of scope.
  • ai-jail wraps one agent. A coding agent in bubblewrap with a fresh home gets Landlock and seccomp too, with network off except the model API and hosts you list. It can hold a connection to an unlisted host until you answer, and runs on macOS with sandbox-exec. It calls itself "not a lockdown or hard-security tool".
  • landrun applies Landlock rules to any command, with no root. Its rules name ports, not hosts.

The Landlock project keeps a list of integrations; read each README before you rely on one.

Where Tego fits

Tego runs an agent under a contract, one short file that lists what it may write, run and connect to. The kernel and Tego's supervisor, a process outside the agent, enforce it while the agent works in your real project.

At every protection level the kernel refuses writes and programs outside the contract. Basic needs no root, and the supervisor decides network hosts; at Plus and Max, with root, the kernel decides hosts and records file reads too.

It covers any agent that runs as a Linux process and everything it starts, and can hold a file open or a connection until you answer. Every run leaves a record that tego events <run> --verify checks for tampering. Ready contracts exist for Claude Code and Codex.

Its limits, in its own words: "It is not a sandbox that hides the machine. The agent can read any path that is not in deny_read." Every allowed host is a way out, an allowed interpreter can do anything in its own memory, and at the Basic protection level some rules are best effort.

It does not inject credentials or restore files, and its rules match host:port, not HTTP paths (FEATURES.md). It is Linux only, its first release (v0.1.0) came out on 4 November 2026, and no external review of its trusted code has been done. The full list is on security and known limits.

Which one for which job?

Anthropic's guidance is a good default: the sandboxed Bash tool for everyday work, a container, VM or the sandbox runtime for unattended sessions, and a dedicated VM or cloud session for an untrusted repository.

Pick Tego to keep working on your own Linux machine, with any agent, under rules you can read in one file. For a separate kernel, use a VM; Tego runs inside it. For Kubernetes, OpenShell. For macOS without a VM, nono or ai-jail.

Can you combine them?

Mostly, yes.

  • Tego inside a VM works as on any Linux machine. It is also the way to run Tego on a Mac or Windows PC, in a Lima VM or in WSL2, though the Mac path is not fully tested yet and the Windows path has not been run on a real PC.
  • Tego inside a container runs at the Basic level, per the container guide; nobody has run it by hand under Docker or Podman yet.
  • An agent's own bubblewrap sandbox inside Tego does not start, because Landlock refuses the mounts it needs. For Codex, the repository turns Codex's sandbox off and lets the contract hold the agent (Codex under Tego).

What every option leaves open

Anthropic's guide puts it plainly: "Any approach that allows network egress can still leak data the agent can read, and any approach that mounts your project directory writable can still modify that code." Tego's own list of gaps says the same about every host a contract allows.

So keep allowed destinations few and secrets out of reach. To try Tego, follow lock down Claude Code on Linux; for the risks in one place, read AI agent security on Linux.

Sources (28 links)

All read on 2 November 2026, except as marked.