# AI Code Sandbox (`apify/ai-code-sandbox`) Actor

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.

- **URL**: https://apify.com/apify/ai-code-sandbox.md
- **Developed by:** [Apify](https://apify.com/apify) (Apify)
- **Categories:** Agents, Developer tools, Open source
- **Stats:** 39 total users, 7 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 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](https://docs.apify.com/platform/actors/development/permissions) and build data pipelines.


### Quickstart

1. Run the Actor on the [Apify platform](https://console.apify.com/) (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](https://apify.com/apify/openrouter),
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:

```bash
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.

```bash
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.

```bash
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.

```bash
## 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.

| Input                                          | Description                                                                                                                                                             |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **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](https://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](https://www.debian.org/releases/trixie/) with [Node.js 24](https://nodejs.org/) and [Python 3](https://www.python.org/) (`venv` at `/sandbox/py/venv`).
- **Pre-installed tools:** [git](https://git-scm.com/), [openssh-client](https://www.openssh.com/), [curl](https://curl.se/), [wget](https://www.gnu.org/software/wget/), [jq](https://jqlang.org/), [build-essential](https://packages.debian.org/trixie/build-essential), [`tsx`](https://tsx.is/), [`apify-cli`](https://docs.apify.com/cli/), [`mcpc`](https://github.com/apify/mcpc), and [`ttyd`](https://github.com/tsl0922/ttyd). The [`apify-client`](https://docs.apify.com/api/client/js/) library is preinstalled in the Node environment, and the [Python `apify-client`](https://docs.apify.com/api/client/python/) in the venv.
- **Pre-configured coding agents:** [Claude Code](https://code.claude.com/), [Codex CLI](https://github.com/openai/codex), and [OpenCode](https://opencode.ai/) — installed on first launch and wired to the [Apify OpenRouter proxy](https://apify.com/apify/openrouter) (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`](https://agents.md/) and `CLAUDE.md` are placed in `/sandbox` to guide the coding agents.

### Learn more

- [Apify Actors documentation](https://docs.apify.com/platform/actors)
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [Apify SDK reference](https://docs.apify.com/sdk)

# Actor input Schema

## `agentSkills` (type: `string`):

Skill packages to install for the AI coding agent — SKILLS.md files with specialized instructions (see https://skills.sh/). One skill per line — a GitHub `owner/repo` (e.g. `anthropics/skills`) or repo URL (e.g. `https://github.com/anthropics/skills`); blank lines and `#` comments are ignored. Also accepts a JSON array like `["apify/agent-skills", "anthropics/skills"]`.

## `nodeDependencies` (type: `string`):

npm packages for JavaScript/TypeScript code execution (/sandbox/js-ts). One `package@version` per line — same syntax `npm install <pkg>` accepts (omit `@version` for `latest`; blank lines and `#` comments are ignored). Also accepts a package.json-style JSON object like `{"zod": "^3.0", "axios": "latest"}`.

## `pythonRequirements` (type: `string`):

Python packages for Python code execution (/sandbox/py), in requirements.txt format — one package per line, blank lines and `#` comments are ignored.

## `mcpConnectors` (type: `array`):

One or more MCP connectors that will be available to the sandbox. They are pre-configured in Claude Code, Codex, and OpenCode, as well as written to `/sandbox/mcp.json` so tools like `mcpc connect` pick them up immediately.

## `initBashScript` (type: `string`):

Bash script execute run on startup, after Node and Python dependencies are installed. Use it to install system packages, create directories, or set up the environment.

## `envVars` (type: `string`):

Secret environment variables that are exposed **only to the setup script**, then deleted before the shell, MCP server, and code execution start. Encrypted at rest by Apify.

Accepts dotenv format (`KEY=VALUE` per line with # comments), or a JSON object, e.g. `{"KEY": "VALUE"}`.

## `idleTimeoutSecs` (type: `integer`):

The container shuts down automatically after this many seconds of inactivity (no requests or shell interaction). Set to 0 to disable. Recommended: set the standard Actor timeout to 0 (infinite) when using this setting.

## `bridges` (type: `array`):

Expose web servers that you start **inside** the sandbox at a public URL path on this container, so they're reachable from the browser or other services. Each bridge forwards `<container-url>/<path>` to `http://127.0.0.1:<port>/...` over HTTP and WebSocket. Use for your own dev server, a TUI gateway, an admin UI, etc.

Example: `[{"path": "/myapp", "target": "http://127.0.0.1:3000/myapp"}]` — visiting `<container-url>/myapp` forwards to the local server on port 3000.

Bridges can also be added/removed at runtime via the `/bridges` API.

## Actor input object example

```json
{
  "agentSkills": "apify/agent-skills\n# One skill per line — owner/repo or a GitHub repo URL:\n# anthropics/skills\n# https://github.com/anthropics/skills",
  "nodeDependencies": "# One package@version per line (omit @version for latest):\n# zod@^3.0\n# axios",
  "pythonRequirements": "# One package per line:\n# requests==2.31.0\n# pandas",
  "mcpConnectors": [],
  "initBashScript": "#!/bin/bash\n# Runs on startup. Uncomment or add your own:\n# apt-get update && apt-get install -y jq\n# mkdir -p /sandbox/data",
  "idleTimeoutSecs": 900,
  "bridges": [
    {
      "path": "/myapp",
      "target": "http://127.0.0.1:3000/myapp"
    }
  ]
}
```

# Actor output Schema

## `url` (type: `string`):

No description

## `shellUrl` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "agentSkills": `apify/agent-skills
# One skill per line — owner/repo or a GitHub repo URL:
# anthropics/skills
# https://github.com/anthropics/skills`,
    "nodeDependencies": `# One package@version per line (omit @version for latest):
# zod@^3.0
# axios`,
    "pythonRequirements": `# One package per line:
# requests==2.31.0
# pandas`,
    "initBashScript": `#!/bin/bash
# Runs on startup. Uncomment or add your own:
# apt-get update && apt-get install -y jq
# mkdir -p /sandbox/data`,
    "idleTimeoutSecs": 900,
    "bridges": [
        {
            "path": "/myapp",
            "target": "http://127.0.0.1:3000/myapp"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("apify/ai-code-sandbox").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "agentSkills": """apify/agent-skills
# One skill per line — owner/repo or a GitHub repo URL:
# anthropics/skills
# https://github.com/anthropics/skills""",
    "nodeDependencies": """# One package@version per line (omit @version for latest):
# zod@^3.0
# axios""",
    "pythonRequirements": """# One package per line:
# requests==2.31.0
# pandas""",
    "initBashScript": """#!/bin/bash
# Runs on startup. Uncomment or add your own:
# apt-get update && apt-get install -y jq
# mkdir -p /sandbox/data""",
    "idleTimeoutSecs": 900,
    "bridges": [{
            "path": "/myapp",
            "target": "http://127.0.0.1:3000/myapp",
        }],
}

# Run the Actor and wait for it to finish
run = client.actor("apify/ai-code-sandbox").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "agentSkills": "apify/agent-skills\\n# One skill per line — owner/repo or a GitHub repo URL:\\n# anthropics/skills\\n# https://github.com/anthropics/skills",
  "nodeDependencies": "# One package@version per line (omit @version for latest):\\n# zod@^3.0\\n# axios",
  "pythonRequirements": "# One package per line:\\n# requests==2.31.0\\n# pandas",
  "initBashScript": "#!/bin/bash\\n# Runs on startup. Uncomment or add your own:\\n# apt-get update && apt-get install -y jq\\n# mkdir -p /sandbox/data",
  "idleTimeoutSecs": 900,
  "bridges": [
    {
      "path": "/myapp",
      "target": "http://127.0.0.1:3000/myapp"
    }
  ]
}' |
apify call apify/ai-code-sandbox --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=apify/ai-code-sandbox",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Code Sandbox",
        "description": "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.",
        "version": "1.0",
        "x-build-id": "GkBfypAeARqQM8N83"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/apify~ai-code-sandbox/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-apify-ai-code-sandbox",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/apify~ai-code-sandbox/runs": {
            "post": {
                "operationId": "runs-sync-apify-ai-code-sandbox",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/apify~ai-code-sandbox/run-sync": {
            "post": {
                "operationId": "run-sync-apify-ai-code-sandbox",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "agentSkills": {
                        "title": "Agent skills",
                        "type": "string",
                        "description": "Skill packages to install for the AI coding agent — SKILLS.md files with specialized instructions (see https://skills.sh/). One skill per line — a GitHub `owner/repo` (e.g. `anthropics/skills`) or repo URL (e.g. `https://github.com/anthropics/skills`); blank lines and `#` comments are ignored. Also accepts a JSON array like `[\"apify/agent-skills\", \"anthropics/skills\"]`.",
                        "default": "apify/agent-skills"
                    },
                    "nodeDependencies": {
                        "title": "Node.js dependencies",
                        "type": "string",
                        "description": "npm packages for JavaScript/TypeScript code execution (/sandbox/js-ts). One `package@version` per line — same syntax `npm install <pkg>` accepts (omit `@version` for `latest`; blank lines and `#` comments are ignored). Also accepts a package.json-style JSON object like `{\"zod\": \"^3.0\", \"axios\": \"latest\"}`."
                    },
                    "pythonRequirements": {
                        "title": "Python requirements",
                        "type": "string",
                        "description": "Python packages for Python code execution (/sandbox/py), in requirements.txt format — one package per line, blank lines and `#` comments are ignored."
                    },
                    "mcpConnectors": {
                        "title": "MCP connectors",
                        "type": "array",
                        "description": "One or more MCP connectors that will be available to the sandbox. They are pre-configured in Claude Code, Codex, and OpenCode, as well as written to `/sandbox/mcp.json` so tools like `mcpc connect` pick them up immediately.",
                        "default": []
                    },
                    "initBashScript": {
                        "title": "Setup script",
                        "type": "string",
                        "description": "Bash script execute run on startup, after Node and Python dependencies are installed. Use it to install system packages, create directories, or set up the environment."
                    },
                    "envVars": {
                        "title": "Environment variables",
                        "type": "string",
                        "description": "Secret environment variables that are exposed **only to the setup script**, then deleted before the shell, MCP server, and code execution start. Encrypted at rest by Apify.\n\nAccepts dotenv format (`KEY=VALUE` per line with # comments), or a JSON object, e.g. `{\"KEY\": \"VALUE\"}`."
                    },
                    "idleTimeoutSecs": {
                        "title": "Idle timeout",
                        "minimum": 0,
                        "type": "integer",
                        "description": "The container shuts down automatically after this many seconds of inactivity (no requests or shell interaction). Set to 0 to disable. Recommended: set the standard Actor timeout to 0 (infinite) when using this setting.",
                        "default": 900
                    },
                    "bridges": {
                        "title": "Bridges",
                        "type": "array",
                        "description": "Expose web servers that you start **inside** the sandbox at a public URL path on this container, so they're reachable from the browser or other services. Each bridge forwards `<container-url>/<path>` to `http://127.0.0.1:<port>/...` over HTTP and WebSocket. Use for your own dev server, a TUI gateway, an admin UI, etc.\n\nExample: `[{\"path\": \"/myapp\", \"target\": \"http://127.0.0.1:3000/myapp\"}]` — visiting `<container-url>/myapp` forwards to the local server on port 3000.\n\nBridges can also be added/removed at runtime via the `/bridges` API.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "path": {
                                    "title": "Exposed path",
                                    "type": "string",
                                    "description": "External URL path (e.g., /openclaw)"
                                },
                                "target": {
                                    "title": "Local service URL",
                                    "type": "string",
                                    "description": "Full URL of local service (e.g., http://127.0.0.1:18789/openclaw)"
                                }
                            },
                            "required": [
                                "path",
                                "target"
                            ]
                        },
                        "default": []
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
