Which sandbox is best for LangChain and LangGraph?
It depends on where your graph already lives. For a shell and files that follow each thread, Runtime has the lowest cost of the sandboxes priced below: $22.78 for ten thousand runs, compared with $70.76 on Vercel Sandbox and $110.40 on Daytona. It bills measured CPU. A paused thread keeps its memory, and the same machine is a Deep Agents backend. Pick Bedrock AgentCore or Azure dynamic sessions if code must stay inside AWS or Azure. Pick LangSmith's sandboxes if your team runs everything in LangSmith.
Which sandboxes work with LangChain?
LangChain's docs, read on 25 October 2026, list these sandboxes:
| Kind | Examples | What the model gets |
|---|---|---|
| Code interpreter tools | Amazon Bedrock AgentCore, Azure Container Apps dynamic sessions, Capsule | Runs a snippet and returns its output |
| Deep Agents sandbox backends | LangSmith, Daytona, E2B, Modal, Runloop, Vercel, AgentCore, NVIDIA OpenShell | A shell and files behind the harness |
Any Python function can also be a tool. A sandbox's own SDK can therefore be wrapped as tools, with no extra layer in between.
What should a LangGraph agent's sandbox do?
- Follow the thread. A sandbox named after the LangGraph
thread_idlets the next turn find the same files, installed packages and running processes. - Branch with the graph. When a graph explores two approaches, a copy of the running sandbox, including its memory, lets each branch start from the same state without rerunning its setup.
- Run what the model writes, not just Python. An in-process interpreter
stops at Python. A microVM runs
npm test,cargo buildor a database. - Keep the host out of it. A tool that calls
subprocessruns on the machine serving your graph. A sandbox tool sends the command to a machine with its own kernel.
What do LangGraph runs cost on each sandbox?
Ten thousand runs a month, each four minutes on a 2 vCPU, 4 GiB sandbox and busy for 40 CPU-seconds, at each provider's published rates:
| Provider | Isolation | A month of runs | Runtime costs less by |
|---|---|---|---|
| Runtime Cloud | Firecracker microVM | $22.78 | |
| Vercel Sandbox | Firecracker microVM | $70.76 | 68% |
| E2B | Firecracker microVM | $110.40 | 79% |
| Daytona | Containers by default | $110.40 | 79% |
| Modal | gVisor, a shared kernel | $158.64 | 86% |
| Runloop | A microVM, container inside | $213.03 | 89% |
When might another sandbox fit better?
- LangSmith's own sandboxes. A team running everything inside LangSmith may prefer the sandboxes listed beside its tracing and deployments.
Runtime Cloud
Runtime's sandbox_tools(sbx) gives a LangChain agent or a LangGraph
ToolNode a shell and a filesystem in a Firecracker microVM, through four
plain functions. It is also a Deep Agents backend. RuntimeSandbox(sbx) from
withruntime.deepagents implements BaseSandbox, so execute, grep and
edit_file all act on the microVM (Deep Agents in a
sandbox).
- Name the sandbox after the
thread_idwithSandbox.getOrCreate. It resumes from pause on the first tool call of the next turn. A paused sandbox costs no compute. sbx.fork()copies the running sandbox, including its memory, for each branch.
The ten thousand runs above cost $22.78 on Runtime, 68% less than Vercel Sandbox and 79% less than Daytona, at rates checked 25 October 2026.
Runs on Runtime, recorded 1 October 2026
The same four functions serve both frameworks:
Pythonfrom langchain.agents import create_agentfrom langchain_core.tools import toolfrom withruntime import Sandboxfrom withruntime.tools import sandbox_toolswith Sandbox.create() as sbx: agent = create_agent("claude-sonnet-4-6", tools=[tool(f) for f in sandbox_tools(sbx)]) result = agent.invoke({"messages": [{"role": "user", "content": "Fit a line to (1,2), (2,4.1), (3,6.2) and give the slope."}]}) print(result["messages"][-1].content)We ran create_agent from LangChain 1.4.3, and a LangGraph 1.2.12 graph
with a ToolNode and tools_condition. Each used a scripted chat model in
place of Claude. The tool calls were fixed, and the frameworks ran them
against live sandboxes:
textLangChain create_agent runtime_write_file slope.py Wrote 79 bytes to /workspace/slope.py runtime_exec python3 slope.py exit_code 0, stdout "2.1"LangGraph ToolNode runtime_write_file fizzbuzz.py Wrote 85 bytes to /workspace/fizzbuzz.py runtime_exec python3 fizzbuzz.py exit_code 0, stdout "1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz"The slope came from NumPy, which is already in the image. The graph wiring and the per-thread sandbox are in LangGraph in a sandbox. The agent's options are in LangChain in a sandbox.
Run your graph on free usage after npx withruntime login. Tools that call
E2B, Daytona or Vercel Sandbox today move with the
migration guide.
Sources
Checked 25 October 2026.
- LangChain tool integrations: the code interpreter integrations
- Deep Agents sandboxes: the sandbox backend providers
- Each provider's published rates, checked 25 October 2026, as the pricing guide lists them
- The recorded runs: Runtime's Python SDK with LangChain 1.4.3 and LangGraph 1.2.12 on Python 3.12, against production on 1 October 2026