Agent Sandboxesagentsandboxes.org
Use case · Code interpreters

Choosing a sandbox for code interpreters and data analysis

Answer in brief

A code interpreter runs short, frequent bursts of Python for many users, so prioritize fast startup, stateful kernels (variables persist across calls), file upload and download, and no network by default. If you are already on one cloud or model provider, its managed tool (Azure, AWS, Google, OpenAI) is the least work. For model-agnostic apps, a hosted platform with a code-interpreter SDK such as E2B gives you more control.

By the Agent Sandboxes editors · Updated

What code interpreters need from a sandbox

A code interpreter lets a model run Python to analyse data, do maths, draw charts and convert files. Sessions are short and frequent, so the needs are:

  • Fast startup — users wait while the sandbox boots.
  • Stateful execution (Jupyter-style kernels) so variables persist across calls in a conversation.
  • File upload/download and rich outputs such as charts.
  • Strong isolation because every user’s code is untrusted, and ideally no network by default.

Sandboxes that fit, by kind

10 sandboxes document what this workload needs. They are grouped by kind and listed alphabetically; the order is not a ranking. Shortlist two or three, then pilot them with your own workload.

Hosted sandbox platforms

SDK-driven sandboxes you create, run code in and destroy through an API.

  • E2B

    Open-source cloud sandboxes for AI agents, each a Firecracker microVM, with pause/resume, snapshots and forking.

    • Firecracker microVM
    • Open source
    • Self-hostable
    • BYOC
    • Pause/resume

    Why it fits: A dedicated Code Interpreter SDK with stateful Jupyter-style execution and chart output, on Firecracker microVMs, with pre-built templates and generous free credit.

Compute platforms with sandboxes

General serverless or app platforms that also offer sandboxes, often with GPUs.

Cloud provider code execution

Managed code-execution tools from AWS, Azure, Google Cloud and OpenAI.

  • AWS Bedrock AgentCore

    AWS’s managed agent platform: a Code Interpreter tool for running agent-generated code and a Runtime that hosts each agent session in its own microVM.

    • MicroVM (Runtime)

    Why it fits: Managed Code Interpreter with sessions up to 8 hours, IAM/VPC integration and CPU billing that skips I/O wait.

  • Azure Container Apps dynamic sessions

    Azure service that hands out Hyper-V-isolated sessions from prewarmed pools, either as a built-in code interpreter or running your own container image.

    • Hyper-V VM

    Why it fits: Hyper-V-isolated Python and Node interpreters from prewarmed pools with egress disabled by default and first-party LangChain, LlamaIndex and Semantic Kernel tools. 220-second execution cap.

  • Claude code execution tool

    Server-side tool in the Claude API that runs Bash commands, Python and file edits inside an Anthropic-hosted container with no internet access.

    • Hosted Linux container

    Why it fits: A hosted container for Python and shell inside a Claude API conversation: data analysis, file generation and multi-step scripting with no sandbox to run.

  • Gemini API code execution

    Built-in Gemini API tool that lets the model write and run Python in a Google-hosted environment at no charge beyond tokens.

    • Hosted Python runtime

    Why it fits: The Gemini API tool that runs Python for calculation, analysis and charts inside the model call; the isolation technology is not documented.

  • Google Agent Platform Code Execution

    Google-managed sandbox API (formerly part of Vertex AI Agent Engine) that lets agents deployed anywhere run Python in stateful, network-isolated environments.

    • gVisor

    Why it fits: gVisor-isolated, no-network Python with state retained up to 14 days; fixed library set.

  • OpenAI Code Interpreter & Hosted Shell

    Hosted containers in the OpenAI Responses API that the model uses to run Python (Code Interpreter) or shell commands (Hosted Shell).

    • VM (unspecified)

    Why it fits: Zero extra infrastructure if you are already on the OpenAI Responses API; tied to OpenAI models.

Code execution APIs

Submit code, get output: online judges, compiler APIs and Jupyter kernels as a service.

  • Datalayer Runtimes

    Remote Jupyter kernels as a service for AI agents: stateful CPU or GPU runtimes created on demand from Python or TypeScript, with snapshots of installed packages, files and variables, and a hosted Jupyter MCP Server.

    • Not documented
    • GPU
    • Snapshots

    Why it fits: Stateful, snapshot-able Jupyter kernels (CPU or GPU) as a service, for agents that need a kernel rather than a one-shot run.

  • Judge0

    Open-source online code execution system (GPL-3.0) that runs each submission in an isolate sandbox, offered as Judge0 Cloud via RapidAPI or directly and as a self-hosted Docker Compose stack.

    • isolate (namespaces/cgroups)
    • Open source
    • Self-hostable

    Why it fits: Open-source submit-and-run API in 60 to 90+ languages with per-submission CPU, wall-clock and memory limits; hosted or self-hosted.

Side by side

SandboxIsolationOpen sourceSelf-host / BYOCCold start (vendor)Max sessionSnapshots / pauseGPUSDKs
AWS Bedrock AgentCoreMicroVM (Runtime)NoNo / NoNot documentedUp to 8 hNot documented / Not documentedNoPython (AgentCore SDK), AWS SDKs, AWS CLI
Azure Container Apps dynamic sessionsHyper-V VMNoNo / NoSub-second (pooled)220 s / execNo / NoNoREST API, Azure CLI, LangChain, LlamaIndex, Semantic Kernel
Claude code execution toolHosted Linux containerNoNo / NoNot documented30 days (container)No / Not documentedNoPython, JavaScript/TypeScript, Go, Java, C#, PHP, Ruby, REST API, CLI
Datalayer RuntimesNot documentedNoNo / NoNot documentedMinutes (set per runtime)Yes / Not documentedYesPython, JavaScript/TypeScript, CLI, MCP server, REST API
E2BFirecracker microVMYesYes / YesNot documented1 h / 24 h (Pro)Yes / YesNoPython, JavaScript/TypeScript
Gemini API code executionHosted Python runtimeNoNo / NoNot documented30 s per executionNo / NoNoPython, JavaScript/TypeScript, Go, Java, REST API
Google Agent Platform Code ExecutiongVisorNoNo / No<1 s (warm)14-day stateNo / Not documentedNoPython (Agent Platform SDK), REST API
Judge0isolate (namespaces/cgroups)YesYes / NoNot documented5 s wall (max 20 s)No / NoNoREST API, Python, JavaScript/TypeScript
Modal SandboxesgVisor or VMNoNo / Not documented<1 sUp to 24 hYes / YesYesPython, JavaScript/TypeScript, Go
OpenAI Code Interpreter & Hosted ShellVM (unspecified)NoNo / NoNot documented20 min idleNo / NoNoOpenAI Responses API, Containers API, OpenAI SDKs

Frequently asked questions

What is the easiest way to add a code interpreter to my AI app?
If you use OpenAI models, the built-in Code Interpreter tool needs no extra vendor. For model-agnostic apps, hosted platforms such as E2B offer a dedicated code-interpreter SDK, and Azure, AWS and Google offer managed equivalents inside their clouds.

Cite this page

Agent Sandboxes. (2026). Choosing a sandbox for code interpreters and data analysis. agentsandboxes.org. Last reviewed November 9, 2026. https://agentsandboxes.org/use-cases/code-interpreter/

Found an error or a missing sandbox? Submit a correction — every entry links to the sources it relies on.