LangSmith Sandboxes: why your agent needs a virtual machine

LangSmith Sandboxes: why your agent needs a virtual machine
500+npm packages backdoored by the Shai-Hulud worm (September 2025)
9.9severity out of 10 of one of the six n8n vulnerabilities disclosed in a single day
732bytes of Python in Copy Fail, which gets root on Linux
10 ≈ 1ten parallel branches cost about the same as one, according to LangChain
Why your AI agent needs a virtual machine, not a container: LangSmith Sandboxes
I also explain it in this video, on my channel Articulator EN. The figures in this post are frames from the video.

Why an agent needs a sandboxlink

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.

An agent needs something like a computer: file system, package manager, shell and state
What an agent that runs code needs, and where that code can come from.

Three risks that aren't theoreticallink

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.
The second Shai-Hulud wave: 796 more packages, more than 20 million weekly downloads and more than 25,000 repositories
The second Shai-Hulud wave, in numbers.
Copy Fail: a 732-byte Python script that gets root on Linux
Copy Fail: 732 bytes and root access.

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 enoughlink

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.

A container shares the kernel with the host machine and the attack escapes into it
The container shares the kernel: if it breaks, the attack reaches the host.

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 islink

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.

A sandbox as a micro virtual machine with its own kernel, separate from your services and other sandboxes
Each sandbox, with its own kernel, separate from your services and from other sandboxes.

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
The code example and the production controls: credentials, resource limits, lifecycle and access permissions
The article's example and the controls production needs.

It also ships with the controls production needs: credentials, resource limits, lifecycle and access permissions.

The six new featureslink

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.
Ten branches from one snapshot costing almost the same as one
Ten branches from one snapshot: about the same cost as one, according to LangChain.
The auth proxy adds the key on the network: there are no secrets inside the sandbox
The proxy adds the key on the network: zero secrets inside the sandbox.

Who's using it alreadylink

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 nextlink

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.
The four announced items: local to cloud, shared volumes, volume mounts and full tracing
What's coming: announced, not available yet.

In shortlink

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.

In one sentence

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?

Sourceslink

Continue reading

Last posts -->

Have you seen these projects?

Gymnasia

Gymnasia Gymnasia
Expo
React Native
TypeScript
OpenAI
Anthropic

Fitness app with two agents that run entirely on the device, with no backend, so the user's data never leaves the phone. A BYOK conversational coach with local tools and a remote system prompt with offline fallback, plus a food estimator that pulls macronutrients out of a photo of the plate, with barcode scanning against OpenFoodFacts.

LangGraph Deep Researcher

LangGraph Deep Researcher LangGraph Deep Researcher
Python
LangGraph
FastAPI
React
TypeScript
Docker

Multi-agent research system built with LangGraph. A supervisor breaks your question down into topics and launches search sub-agents in parallel; each one compresses its findings before handing them to a writer agent that produces the final sourced markdown report. Live streaming over WebSockets, a configurable model per role and bring-your-own API keys that are never persisted server-side.

Tau

Tau Tau
Python
LangChain

Multi-agent tutoring system for secondary school students, with one agent per subject and course material written and validated by a team of teachers. It was used with real students at a private school in Spain and at a secondary school in Colombia.

View all projects -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to watch any talk?

Last talks -->

Do you want to improve with these tips?

Last tips -->

Use this locally

Hugging Face spaces allow us to run models with very simple demos, but what if the demo breaks? Or if the user deletes it? That's why I've created docker containers with some interesting spaces, to be able to use them locally, whatever happens. In fact, if you click on any project view button, it may take you to a space that doesn't work.

Flow edit

Flow edit Flow edit

FLUX.1-RealismLora

FLUX.1-RealismLora FLUX.1-RealismLora
View all containers -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to train your model with these datasets?

short-jokes-dataset

HuggingFace

Dataset with jokes in English

Use: Fine-tuning text generation models for humor

231K rows 2 columns 45 MB
View on HuggingFace →

opus100

HuggingFace

Dataset with translations from English to Spanish

Use: Training English-Spanish translation models

1M rows 2 columns 210 MB
View on HuggingFace →

netflix_titles

HuggingFace

Dataset with Netflix movies and series

Use: Netflix catalog analysis and recommendation systems

8.8K rows 12 columns 3.5 MB
View on HuggingFace →
View more datasets -->