8 languages. Stateful sessions. gVisor isolation. MCP-native. Build agents that execute code safely, validate generated snippets, or run programming lessons without local Docker.
Every other code-execution API stops at "send code, get output." We ship the full toolkit AI agents and modern developer tooling actually need.
Persistent sandboxes retain files and installed packages across calls. Interpreter globals reset between calls, so agents store state on disk.
# Files persist → POST "open('x.txt','w').write('42')" → POST "print(open('x.txt').read())" → stdout: "42"
Stable pip and npm install direct requested artifacts from a curated cache behind the managed install proxy. List every required package explicitly; transitive resolution is planned.
# Controlled cached install path manager: "pip" packages: ["pandas", "numpy"]
Server-Sent Events deliver live stdout/stderr as code runs. No polling, no buffering. Render to a terminal in real time.
# SSE events → stdout: "Step 1" → stdout: "Step 2" → result: exit 0
Enabled in production: submit a long-running job, get a job ID, and poll until it finishes. Ultra supports 300s and Mega 600s here; an unavailable async queue returns 503 instead of falling back to sync.
# Fire-and-poll async: true job_id: "job_abc" GET /v1/executions/job_abc
Python 3.12, Node 22, TypeScript 5.6.3, Go 1.22, Java 21, GCC 12 for C/C++, and Bash 5.2. Focused coverage for the languages agents and coding platforms use most.
# Current runtimes "python3" // 3.12 "javascript" // Node 22 "typescript" // 5.6.3 via esbuild "go" // 1.22
gVisor mediates application syscalls through a user-space kernel, adding an isolation boundary beyond the container runtime. Production requires the runsc runtime.
# Isolation stack code → Docker → gVisor (runsc) → host kernel
Current, verified runtime versions. Pre-warmed pools. Strict resource limits. Each runs in its own isolated gVisor sandbox.
Same API, four execution patterns. Pick the one that matches your workflow.
curl -X POST .../v1/execute \ -H "X-RapidAPI-Key: $KEY" \ -d '{"language":"python3","code":"print(2+2)"}'
curl -N -X POST .../v1/execute/stream \ -H "X-RapidAPI-Key: $KEY" \ -d '{"language":"python3","code":"..."}'
curl -X POST ".../v1/execute?async=true" \ -H "X-RapidAPI-Key: $KEY" \ -d '{"language":"python3","code":"..."}'
curl -X POST .../v1/sessions/$SID/execute \ -H "X-RapidAPI-Key: $KEY" \ -d '{"code":"print(open(\"state.txt\").read())"}'
The hosted Streamable HTTP adapter exposes four stateless tools and routes every invocation through RapidAPI. Sessions, package install, managed HTTPS, streaming, and async remain REST-only.
Claude Code, Codex, Cursor, VS Code, and Antigravity can connect over Streamable HTTP using your RapidAPI key as a Bearer token. Pick your client's setup in the integration guide.
# Codex: ~/.codex/config.toml # Provide the key through the Codex environment. [mcp_servers.sandboxapi] url = "https://mcp.sandboxapi.dev/mcp" bearer_token_env_var = "SANDBOXAPI_RAPIDAPI_KEY" tool_timeout_sec = 180
Field-level mapping, honest comparison, and recommendations by persona.
Real-world examples you can run right now. Click any example to try it in the playground.
Run AI-generated functions against a test harness, get structured pass/fail results
Try it →Stateful sessions and package install for a debugging agent that retries on errors and learns from compile failures
See pattern →Run generated business rules to validate records with detailed error reporting
Try it →Run submitted code against a harness and return stdout, stderr, exit code, time, and memory usage
Try it →Benchmark solutions at scale and verify time complexity meets O(n) requirement
Try it →Run the same challenge across 8 languages and verify output consistency in your own harness
Try it →Score student code against a weighted rubric with 14 test cases across 3 categories
Try it →Validate student functions against hidden test suites with detailed feedback
Try it →Test student expressions with stdin input and automated evaluation
Try it →Check production configs against security rules, flag errors and warnings
Try it →Transform raw sales data into formatted reports with leaderboards and breakdowns
Try it →Run ETL pipeline steps and validate each transformation produces correct output
Try it →All plans include 8 languages, gVisor isolation, stdin, batch execution, and streaming. Pro is the recommended first paid step; Ultra is built for serious workflows, and Mega is the high-volume RapidAPI plan.
Network is off by default; Basic and playground traffic cannot enable it. Paid API requests can opt in to managed public HTTPS with network.enabled, while Ultra and Mega can optionally set allowed_domains. This is an explicit HTTPS_PROXY path: clients must honor or be configured for that proxy, and raw public sockets are unavailable. One endpoint call is one RapidAPI request; batch limits are maximum accepted items, processed through bounded workers within a 150-second request wall-clock budget. RapidAPI's gateway maximum is 180 seconds, leaving 30 seconds for delivery and cleanup. RapidAPI meters bandwidth in 1 MB units, with 10,240 MB/month currently included on every plan, then $0.001 per MB above that allowance and owns each subscription-period request allowance; SandboxAPI applies per-minute burst limits per RapidAPI subscriber identity. Session caps are per-RapidAPI-account ceilings. Shared service capacity is not reserved; during saturation, session creation may return HTTP 503 with Retry-After.
Get your API key and start executing code in minutes. Basic includes 500 requests per RapidAPI subscription period.