Skip to content

Sandboxes quickstart

This guide takes you from signup to a forked sandbox. The flow is four calls: list the catalog, create a sandbox from a catalog image, exec against it, fork it.

  1. Get a key. Sign in to the console (Google or GitHub), then API keys → Create. A Demo key is free — no card:

    Terminal window
    export COLLIMATE_API_KEY="col_demo_a1b2c3d4e5f60718_..."
  2. Install the SDK (stdlib-only, zero dependencies):

    Terminal window
    pip install collimate-rl

The catalog is the ready-to-run image library — every entry is already baked and ready to fork, so there is nothing to build or wait for. Pick an id:

Terminal window
curl https://api.collimate.ai/v1/images \
-H "Authorization: Bearer $COLLIMATE_API_KEY"
# { "templates": [ { "id": "python", "name": "python", "visibility": "public",
# "tier": "demo", "description": "Python 3, ready to run" } ] }

Bringing your own image is the Pro upgrade — see the Pro quickstart.

Create a sandbox from the catalog id, then exec against it. Files and processes persist between execs, so you reuse the same sandbox across steps.

  1. Create a sandbox:

    Terminal window
    curl https://api.collimate.ai/v1/sandboxes \
    -H "Authorization: Bearer $COLLIMATE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "template": "python" }'
    # { "id": "sbx_9f2a1c7b3e40", "template": "python", "state": "running", ... }
  2. Exec against it as many times as you like:

    Terminal window
    curl https://api.collimate.ai/v1/sandboxes/sbx_9f2a1c7b3e40/exec \
    -H "Authorization: Bearer $COLLIMATE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "code": "print(sum(range(100)))" }'

    You get back the captured output plus timing:

    {
    "id": "sbx_9f2a1c7b3e40",
    "stdout": "4950\n",
    "stderr": "",
    "exit_code": 0,
    "fork_time_ms": 0.0,
    "exec_time_ms": 11.8,
    "total_time_ms": 15.1,
    "seed": "3a7f…",
    "seed_ack": "verified"
    }
  3. Delete it when you're done:

    Terminal window
    curl -X DELETE https://api.collimate.ai/v1/sandboxes/sbx_9f2a1c7b3e40 \
    -H "Authorization: Bearer $COLLIMATE_API_KEY"

The headline. Prepare a sandbox once, then fork it into N live children — each keeps the parent's process memory, so no reinstall and no replay.

Terminal window
# Prepare state once, then fork the running sandbox 4 ways.
curl https://api.collimate.ai/v1/sandboxes/sbx_9f2a1c7b3e40/exec \
-H "Authorization: Bearer $COLLIMATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "command": "pip install numpy" }'
curl https://api.collimate.ai/v1/sandboxes/sbx_9f2a1c7b3e40/fork \
-H "Authorization: Bearer $COLLIMATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "count": 4 }'
# { "parent": "sbx_9f2a1c7b3e40", "children": [ { "id": "sbx_1a4f…" }, ... ] }
# each child already has numpy installed

The parent keeps running; each child is an independent microVM. This is the building block for tree search and best-of-N.