Create and connect

Two ways to get a running sandbox: the fused run endpoint when you want a sandbox and an immediate first command, and a full create when you need to provision first, write files, start a preview server, or keep the ID for a longer session.

Fast path: create and run

For agents that need a sandbox and immediately run the first command, use the fused run endpoint. It is faster because MIOSA owns the readiness wait on the server and avoids an extra client poll loop plus a second public exec request.

Response shape:

{
  "data": {
    "id": "sbx_a1b2c3d4",
    "state": "running",
    "template_id": "miosa-sandbox",
    "ready": true
  },
  "exec": {
    "stdout": "2\n",
    "stderr": "",
    "exit_code": 0
  },
  "timings": {
    "server_wait_and_exec_ms": 512
  }
}

Create with full options

Use full create when you need to provision the sandbox first, write files, start a preview server, attach databases, or keep the ID for a longer session.

The response body contains id, state, template_id, size, resource_contract, cpu_count, memory_mb, and created_at. Save the id; every subsequent call needs it.

Context manager (auto-destroy)

The Python SDK supports with / async with; the sandbox is destroyed on exit even if an exception is raised:

Connect to an existing sandbox

List and filter sandboxes

Was this page helpful?