Skip to content

base ​

Minimal Ubuntu sandbox environment — a lightweight starting point for custom setups. Boots in ~60ms with basic system utilities and nothing else. Install exactly what you need, keep resource usage low, and build your own workflow from scratch.

Specs ​

PropertyValue
Template IDbase
Default Timeout300s (5 min)
CPU2 vCPU
Memory512 MB
Disk5 GB
Boot Time~60ms
InternetEnabled
Working Directory/home/user

What's Included ​

  • Ubuntu 22.04 — minimal base image
  • curl, wget — HTTP clients
  • git — version control
  • bash, sh — shell environments
  • apt — package manager (install anything you need)
  • Basic coreutils — ls, cat, grep, find, etc.

TIP

The base template is intentionally minimal. Use apt-get install via the exec endpoint to add any packages your workflow requires.

Use Cases ​

  • Custom environments — Install specific language runtimes, frameworks, or tools not available in other templates
  • Lightweight tasks — Run simple scripts, cron jobs, or data processing without overhead
  • CI/CD steps — Execute build steps, linting, or deployment scripts in isolation
  • Prototyping — Quickly test ideas without committing to a full template
  • Reproducible builds — Start from a known minimal state and install exact dependencies

Create a Sandbox ​

POST/sandboxes
bash
curl -X POST https://api.sandbase.ai/sandboxes \
  -H "Authorization: Bearer sk-sb-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateID": "base",
    "timeout": 300
  }'

Response:

json
{
  "sandboxID": "sbx_01abc...",
  "templateID": "base",
  "clientID": "SandBase",
  "status": "running",
  "startedAt": "2024-07-01T12:00:00Z",
  "endAt": "2024-07-01T12:05:00Z"
}

Customizing the Environment ​

Once the sandbox is running, install packages and configure tools via the exec endpoint:

Install a language runtime ​

bash
curl -X POST https://api.sandbase.ai/sandboxes/sbx_01abc.../processes \
  -H "Authorization: Bearer sk-sb-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "bash",
    "args": ["-c", "apt-get update && apt-get install -y python3 python3-pip"]
  }'

Install Node.js ​

bash
curl -X POST https://api.sandbase.ai/sandboxes/sbx_01abc.../processes \
  -H "Authorization: Bearer sk-sb-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "bash",
    "args": ["-c", "curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs"]
  }'

Install custom tools ​

bash
curl -X POST https://api.sandbase.ai/sandboxes/sbx_01abc.../processes \
  -H "Authorization: Bearer sk-sb-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "bash",
    "args": ["-c", "apt-get install -y ffmpeg imagemagick jq"]
  }'

Full Example — Custom Python Environment ​

python
import requests

BASE = "https://api.sandbase.ai"
HEADERS = {"Authorization": "Bearer sk-sb-YOUR_KEY"}

# 1. Create a minimal sandbox (~60ms)
sandbox = requests.post(f"{BASE}/sandboxes", headers=HEADERS, json={
    "templateID": "base",
    "timeout": 300
}).json()

sandbox_id = sandbox["sandboxID"]

# 2. Install Python and dependencies
requests.post(
    f"{BASE}/sandboxes/{sandbox_id}/processes",
    headers=HEADERS,
    json={"cmd": "bash", "args": ["-c", "apt-get update && apt-get install -y python3 python3-pip"]}
).json()

# 3. Install project-specific packages
requests.post(
    f"{BASE}/sandboxes/{sandbox_id}/processes",
    headers=HEADERS,
    json={"cmd": "bash", "args": ["-c", "pip3 install pandas numpy requests"]}
).json()

# 4. Run a script
result = requests.post(
    f"{BASE}/sandboxes/{sandbox_id}/processes",
    headers=HEADERS,
    json={
        "cmd": "python3",
        "args": ["-c", "import pandas as pd; print(pd.__version__)"]
    }
).json()

print(result["stdout"])  # e.g. "2.2.0"

# 5. Clean up
requests.delete(f"{BASE}/sandboxes/{sandbox_id}", headers=HEADERS)

Configuration Options ​

OptionTypeDefaultDescription
timeoutinteger300Sandbox lifetime in seconds (max 3600)
metadataobject{}Custom key-value metadata
envVarsobject{}Environment variables injected at boot

Minimal creation ​

json
{
  "templateID": "base",
  "timeout": 300
}

With environment variables ​

json
{
  "templateID": "base",
  "timeout": 600,
  "envVars": {
    "APP_ENV": "staging",
    "DATABASE_URL": "postgres://..."
  }
}

With metadata ​

json
{
  "templateID": "base",
  "timeout": 900,
  "metadata": {
    "task": "data-processing",
    "pipeline": "etl-daily"
  }
}