VOOZH about

URL: https://apify.com/apify/ai-code-sandbox

โ‡ฑ AI Code Sandbox ยท Apify


Pricing

Pay per usage

Go to Apify Store

Provides a secure execution environment for code generated by AI agents. Interact with the sandbox through web shell, REST API, or MCP. Supports Python and Node.js runtimes, Claude Code, Codex CLI, and OpenCode coding agents, and persists state.

Pricing

Pay per usage

Rating

5.0

(3)

Developer

๐Ÿ‘ Apify

Apify

Maintained by Apify

Actor stats

2

Bookmarked

46

Total users

5

Monthly active users

4 hours ago

Last modified

Share

Apify AI Code Sandbox

Secure, isolated container for executing arbitrary code, built for AI coding agents and untrusted code. Connect over MCP, a REST API, or an interactive browser shell. Ships with Claude Code, Codex CLI, and OpenCode pre-configured and ready to launch.

This Actor launches a web server on the Actor container URL that provides interface to the sandbox.

Use cases

  • ๐Ÿ”’ Run untrusted or AI-generated code safely in an isolated container with controlled resources.
  • ๐Ÿค– Give AI agents a managed workspace to write, run, and test code โ€” with state that survives container migrations.
  • ๐Ÿ”Œ Drop in over MCP so any MCP client gains code-execution and filesystem tools, no glue code.
  • ๐Ÿ’ป Pair with coding agents (Claude Code, Codex CLI, OpenCode) right in the browser shell.
  • ๐ŸŒ Expose internal services (dev servers, dashboards, TUIs) at a public URL with bridges.
  • ๐ŸŽญ Orchestrate Apify Actors using the limited-permission APIFY_TOKEN available inside the sandbox to run other limited-permission Actors and build data pipelines.

Quickstart

  1. Run the Actor on the Apify platform (Console or API).
  2. Open the sandbox landing page (the container URL shown in the Actor output) for live links and connection details.
  3. Connect with an MCP client, call the REST API, or open the shell.

Examples below use https://UNIQUE-ID.runs.apify.net as the container URL โ€” replace it with your run's URL.

๐Ÿ–ฅ๏ธ Interactive shell โ€” /shell

Browser terminal (powered by ttyd) for hands-on work inside the sandbox.

  • https://UNIQUE-ID.runs.apify.net/shell โ€” plain Bash shell.
  • โ€ฆ/shell?launch=claude โ€” launch Claude Code.
  • โ€ฆ/shell?launch=codex โ€” launch Codex CLI.
  • โ€ฆ/shell?launch=opencode โ€” launch OpenCode.
  • โ€ฆ/shell?launch=<command> โ€” run any command, then drop into a shell.

The coding agents are installed on first use and start pre-configured against the Apify OpenRouter proxy, billed to your Apify account.

๐Ÿค– AI agent instructions

The sandbox landing page is also available as Markdown as the /llms.txt file:

https://UNIQUE-ID.runs.apify.net/llms.txt

๐Ÿ“ก Connect with MCP โ€” /mcp

Streamable-HTTP MCP endpoint, no authentication required:

https://UNIQUE-ID.runs.apify.net/mcp

Add it to an MCP client:

claude mcp add--transport http sandbox https://UNIQUE-ID.runs.apify.net/mcp
codex mcp add sandbox --url https://UNIQUE-ID.runs.apify.net/mcp
mcpc connect https://UNIQUE-ID.runs.apify.net/mcp @sandbox

Tools exposed: execute (shell / JS / TS / Python), read-file, write-file, list-files.

โšก Code execution API โ€” /exec

POST /exec runs a shell command or a code snippet.

  • Body: { command: string; language?: string; cwd?: string; timeoutSecs?: number }
  • language: bash/sh (or omit) for shell; js/javascript, ts/typescript, py/python for code.
  • Returns { stdout, stderr, exitCode, language } โ€” 200 on success, 500 on a non-zero exit or error.
curl-X POST https://UNIQUE-ID.runs.apify.net/exec \
-H"Content-Type: application/json"\
-d'{"command": "print(\"hi\")", "language": "py", "timeoutSecs": 10}'

Default working directories: shell โ†’ /sandbox, JS/TS โ†’ /sandbox/js-ts, Python โ†’ /sandbox/py. Override with cwd (must stay within /sandbox).

๐Ÿ“ Filesystem API โ€” /fs

Direct file operations over HTTP. All paths are relative to /sandbox and validated to stay inside it.

  • GET /fs/{path} โ€” read a file (raw bytes) or list a directory (JSON { path, entries }). Add ?download=1 to get a file as an attachment or a directory as a ZIP.
  • PUT /fs/{path} โ€” write/replace a file (creates parent dirs; up to 500 MB).
  • POST /fs/{path}?mkdir=1 โ€” create a directory; ?append=1 โ€” append to a file.
  • DELETE /fs/{path} โ€” delete; add ?recursive=1 for non-empty directories.
  • HEAD /fs/{path} โ€” return metadata in the response headers.
curl https://UNIQUE-ID.runs.apify.net/fs/app/log.txt # read
curl-X PUT https://UNIQUE-ID.runs.apify.net/fs/config.json -d'{"key":"value"}'# write
curl-X POST "https://UNIQUE-ID.runs.apify.net/fs/project/src?mkdir=1"# mkdir
curl-X DELETE "https://UNIQUE-ID.runs.apify.net/fs/temp?recursive=1"# delete

Prefer a UI? Browse the filesystem at /browse.

๐Ÿ”€ Bridges โ€” /bridges

Expose a web server you start inside the sandbox at a public URL path on the container, reachable over HTTP and WebSocket. Each bridge forwards โ€ฆ/{path} โ†’ http://127.0.0.1:{port}/โ€ฆ.

  • GET /bridges โ€” list current bridges.
  • POST /bridges โ€” add one: { "path": "/myapp", "target": "http://127.0.0.1:3000/myapp" }.
  • PUT /bridges โ€” replace all: { "bridges": [ โ€ฆ ] }.
  • DELETE /bridges/{path} โ€” remove one.
# Start a server inside the sandbox, then expose it:
curl-X POST https://UNIQUE-ID.runs.apify.net/bridges \
-H"Content-Type: application/json"\
-d'{"path": "/myapp", "target": "http://127.0.0.1:8080"}'
# Now reachable at https://UNIQUE-ID.runs.apify.net/myapp/

Bridges can also be set via the bridges input or by writing /sandbox/.bridges.json (changes are picked up live). Longest-path matching and Location-header rewriting are automatic, and bridges persist across restarts.

Health & status โ€” /health

GET /health reports the service state:

  • 200 { status: "healthy", idleTimeoutSecs, remainingSecs? }
  • 503 { status: "initializing" } โ€” dependencies / setup script still running.
  • 503 { status: "unhealthy", message } โ€” setup failed; check the run log.

remainingSecs counts down to idle shutdown and is present only while an idle timeout is active.

Configuration

All inputs are optional. Set them in the Actor input form or via the API.

InputDescription
Agent skills (agentSkills)SKILLS.md packages for the coding agents โ€” owner/repo or a repo URL per line, or a JSON array. Defaults to apify/agent-skills. See skills.sh.
Node.js dependencies (nodeDependencies)npm packages for JS/TS execution. One package@version per line (npm-style), or a package.json-style JSON object.
Python requirements (pythonRequirements)pip packages for Python execution, in requirements.txt format.
MCP connectors (mcpConnectors)MCP connectors to pre-load into Claude Code, Codex, and OpenCode, and write to /sandbox/mcp.json for mcpc.
Setup script (initBashScript)Bash script run on startup after dependencies install. Output streams to the log (tagged [init]) with a progress heartbeat; 5-minute timeout.
Environment variables (envVars)Secret variables exposed only to the setup script, then removed before the shell, MCP server, and code execution start. dotenv or JSON; encrypted at rest.
Idle timeout (idleTimeoutSecs)Seconds of inactivity before automatic shutdown (default 900; 0 disables). Activity includes HTTP requests and shell interaction.
Bridges (bridges)Bridges to create at startup (see above).

Dependencies install at startup before any code runs. For cost efficiency, set the Actor's Execution Timeout to 0 (infinite) and let the idle timeout manage the lifecycle. Note that every request to the Actor has a 5-minute ceiling, so each operation must finish within that window.

Sandbox environment

  • Base image: Debian Trixie with Node.js 24 and Python 3 (venv at /sandbox/py/venv).
  • Pre-installed tools: git, openssh-client, curl, wget, jq, build-essential, tsx, apify-cli, mcpc, and ttyd. The apify-client library is preinstalled in the Node environment, and the Python apify-client in the venv.
  • Pre-configured coding agents: Claude Code, Codex CLI, and OpenCode โ€” installed on first launch and wired to the Apify OpenRouter proxy (authenticated with APIFY_TOKEN), with confirmation prompts auto-approved (safe inside the sandbox).
  • Working directories: /sandbox (shell), /sandbox/js-ts (npm packages in node_modules), /sandbox/py (Python venv).
  • Persistence: filesystem changes are backed up to the Actor's key-value store and restored after a container migration, so work survives restarts (dependency directories are excluded and reinstalled).
  • Agent context: AGENTS.md and CLAUDE.md are placed in /sandbox to guide the coding agents.

Learn more

You might also like

Google Maps Rank Tracker

vasram/google-maps-rank-tracker

Track Google Maps rankings across a geo-grid heatmap. Get SoLV score, competitor leaderboard, gap analysis, zone breakdown, trend tracking & interactive HTML dashboard. Bulk scan up to 10 businesses. White-label reports. Free LocalFalcon & BrightLocal alternative โ€” 50% cheaper, no monthly fees.

๐Ÿ‘ User avatar

Vasram Sonagara

4

5.0

Google Maps Scraper Orchestrator

lukaskrivka/google-maps-scraper-orchestrator

Run multiple locations and search terms together with parallel runs for maximum speed.

๐Ÿ‘ User avatar

Lukรกลก Kล™ivka

353

5.0

Dataset MCP Uploader

lukaskrivka/dataset-mcp-uploader

Dataset MCP Uploader allows you to process datasets on the Apify platform and then publish the results on other platforms that support the MCP protocol

๐Ÿ‘ User avatar

Lukรกลก Kล™ivka

3

Shopify Products Scraper

trovevault/shopify-products-scraper

Scrape every product from any Shopify store: title, vendor, price, compare-at price, variants, stock status, and images. Just enter the store domain. No API keys or category URLs needed. Export data, run via API, schedule and monitor runs, or integrate with other tools.

167

5.0

Universal MCP Connector

lukaskrivka/universal-mcp-connector

Universal MCP Connector allows you to run arbitrary workflows on the Apify platform and then publish the results on other platforms that support MCP protocol (most popular platforms do)

๐Ÿ‘ User avatar

Lukรกลก Kล™ivka

25

Walmart Fast Product Scraper

e-commerce/walmart-fast-product-scraper

Quickly scrape product details from search listing pages on walmart.com or walmart.ca

293

4.7

Merge, Dedup & Transform Datasets

lukaskrivka/dedup-datasets

The ultimate dataset processor. Extremely fast merging, deduplications & transformations all in a single run.

๐Ÿ‘ User avatar

Lukรกลก Kล™ivka

5.1K

5.0

Walmart Product Detail Scraper

e-commerce/walmart-product-detail-scraper

Scrape full product detail pages on walmart.com, walmart.ca or walmart.com.mx

598

4.7

Reddit Posts Scraper

parseforge/reddit-posts-scraper

Transform your Reddit research with ultra fast data extraction! Collect 1000+ posts per minute from any subreddit, search query, or URL. Track trending topics, monitor brand discussions, and analyze community engagement effortlessly. Start gathering valuable insights in minutes!

1.2K

2.4

Web Data to Notion Dashboard

grizzlygriff/web-data-to-notion-dashboard

Scrape local businesses (restaurants, real estate, gyms, hotels, schools) or social content (YouTube, Instagram, TikTok) and get a polished Notion dashboard with table, gallery, and map views โ€” one Actor run. Powered by Apify MCP Connectors: we never see your Notion token.

7