
Why an agent needs a sandbox
Over the past year, a kind of agent has appeared that doesn't just call predefined functions. Tools like Cursor, Claude Code, Open SWE or Deep Agents generate code, install dependencies, run tests, inspect failures and edit files. Running code is now part of how they work.
The article lists three typical workloads:
- A coding assistant that runs and validates its own output before answering you.
- A CI-style agent that clones a repo, installs dependencies, runs the tests and opens a pull request, like Open SWE.
- A data analysis agent that runs Python against your dataset.
They all need something like a computer: a file system, a package manager, a shell and persistent state. And they also need isolation, because the code they run may have been generated by a model, pulled from an external dependency or supplied by a user. Most teams start by running it on a laptop. That's fine for a prototype; in production, the article says, that setup breaks down.
Three risks that aren't theoretical
According to the article, running agent code without a real isolation boundary isn't a theoretical risk. It illustrates this with three recent incidents:
- Supply chain attacks. In September 2025, a self-replicating npm worm, Shai-Hulud, backdoored more than 500 packages, including
@ctrl/tinycolor. Its code ran when the package was installed, before any test had run. In November a second wave hit 796 more packages, adding up to more than 20 million weekly downloads, and more than 25,000 GitHub repositories within hours. If your agent installs dependencies, an attack like this reaches the place where its code runs. - Not everything called a sandbox is one. n8n had six remote code execution vulnerabilities disclosed in a single day. One, CVE-2026-1470, with a severity of 9.9 out of 10, bypassed the JavaScript expression sandbox; another, CVE-2026-0863, escaped the Python task executor. The lesson: a JavaScript eval boundary is not isolation.
- Containers share a kernel, and kernels break. Copy Fail (CVE-2026-31431) is a 732-byte Python script that gets root on every major Linux distribution back to 2017, through the kernel's crypto API. According to the article, AI tooling surfaced it in about an hour.
One caveat: these are examples of the risk, not attacks on specific agents. They show what can happen when the code being run can't be trusted.
Why a container isn't enough
Copy Fail shows the underlying problem: a container shares the kernel with the machine that hosts it. If the agent runs the wrong script, it escapes the container and reaches the system underneath.
On top of that, the article says, containers weren't designed for this. They're built to run known, vetted code, statelessly, like a web server that handles fixed operations and goes away. An agent is the opposite: it wants a small stateful computer where it can install packages, edit files, follow long-running work and come back to where it left off. And the code it runs is untrusted by definition.
What a LangSmith sandbox is
Each sandbox is an ephemeral, hardware-virtualized microVM. It has its own file system, shell, package manager and network boundary, and it's kernel-isolated both from your services and from other sandboxes. Inside, the agent can write code, install dependencies, run tests and keep working across long-running sessions.
It's managed with the same SDK and API key as the rest of LangSmith, and it works with Deep Agents, Open SWE, LangSmith Deployment, LangSmith Fleet or your own code. This is the article's example: create a client, open a sandbox from a snapshot built from your Docker image and run a command.
from langsmith.sandbox import SandboxClient
client = SandboxClient()
# Sandboxes boot from a snapshot built from your Docker image
with client.sandbox(snapshot_id="my-agent-image") as sb:
result = sb.run("python -c 'print(2 + 2)'")
print(result.stdout) # "4\n"
print(result.success) # True
It also ships with the controls production needs: credentials, resource limits, lifecycle and access permissions.
The six new features
General availability brings six new capabilities:
- Snapshots and cheap forks. You capture a running sandbox, or build one from a Docker image, and boot new sandboxes from it. Forks share state through copy-on-write: only what changes gets copied. That's why, according to LangChain, ten parallel branches cost about the same as one. And if the agent goes down a wrong path, it restores the snapshot and tries another branch.
- Pause when inactive. An idle sandbox pauses on its own, so you don't pay for resources nobody is using.
- Service URLs. Authenticated HTTP access to anything running inside the sandbox: open a preview in your browser, hit it from a script or share it with a teammate, with no port forwarding.
- A sandbox CLI. It builds snapshots from Dockerfiles, manages sandboxes, opens interactive consoles, tunnels raw TCP and lets you use ssh, scp, rsync or sftp like with any Linux box.
- Creator-private by default. Only whoever launched the sandbox, plus workspace admins, can shell into it or open its URLs. When you're ready to share, you grant access to other members.
- An auth proxy. Outbound requests go through a proxy that injects credentials at the network layer, so secrets never touch the runtime. It now accepts custom callbacks to resolve secrets (per-tenant tokens, vault lookups, audit hooks) and domain allowlists and denylists.
Who's using it already
The article's example is monday.com: its assistant, Sidekick, uses these sandboxes to write and run code for its users' more advanced workflows. Omri Bruchim, AI Platform Group Manager at monday.com, puts it like this:
"With secure environments, Sidekick can write and run code, and use the results to create richer workflows, like running data analysis and generating multimedia."
What's coming next
LangChain announces four more things. They're plans, not features that already exist:
- Local to cloud: develop an agent against a sandbox on your laptop and promote it to a cloud sandbox with no code changes.
- Shared volumes: one agent writes to a volume and another picks up where it left off.
- Volume mounts: your own blob storage or git repository, available on startup.
- Full tracing: every process and network call inside the VM, which doubles as an audit log.
In short
Agents don't just answer anymore: they run code. And that code can't be trusted, whether it comes from the model, a dependency or a user. So, LangChain argues, it needs real isolation, not a container that shares the kernel. LangSmith Sandboxes gives each agent its own small virtual machine, with snapshots, cheap forks and secrets kept out of reach. The article doesn't compare it with other sandbox providers, so what it says about the product should be read for what it is: an announcement by the people selling it.
If your agent runs code, give it its own virtual machine, not a container that shares the kernel with everything else.
Where do your agents run their code?
Sources
- "LangSmith Sandboxes are Generally Available", by Mukil Loganathan (LangChain blog, May 13, 2026).
- The video, on my channels: English and Spanish.