# Best sandbox for LangChain and LangGraph agents in 2027 Runtime Cloud (withruntime.com) works as plain LangChain tools or as a Deep Agents backend. It costs 68% less than Vercel. ## 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_id` lets 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 build` or a database. - **Keep the host out of it.** A tool that calls `subprocess` runs 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](/integrations/deep-agents)). - Name the sandbox after the `thread_id` with `Sandbox.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: ```python check from langchain.agents import create_agent from langchain_core.tools import tool from withruntime import Sandbox from withruntime.tools import sandbox_tools with 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: ```text LangChain 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](/integrations/langgraph). The agent's options are in [LangChain in a sandbox](/integrations/langchain). Run your graph on free usage after `npx withruntime login`. Tools that call E2B, Daytona or Vercel Sandbox today move with the [migration guide](/docs/migrate). ## Sources Checked 25 October 2026. - [LangChain tool integrations](https://docs.langchain.com/oss/python/integrations/tools): the code interpreter integrations - [Deep Agents sandboxes](https://docs.langchain.com/oss/python/deepagents/sandboxes): the sandbox backend providers - Each provider's published rates, checked 25 October 2026, as the [pricing guide](/docs/pricing) 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