Quick Start¶
This page shows the fastest host-side path from Python or Node.js.
What Runs Where¶
- Host code runs in your app and uses the
isolaorisola-coreSDK to build templates, create sandboxes, and configure policy. - Guest code runs inside the sandbox and uses Python
sandbox.*modules or JavaScript globals likehostcall(...)andfetch(...). - For guest-side APIs, see Python Guest API and JavaScript Guest API.
Python SDK¶
Install the SDK:
Run a small Python guest:
import asyncio
from isola import build_template
async def main() -> None:
template = await build_template("python")
async with template.create() as sandbox:
await sandbox.load_script(
"def add(a, b):\n"
" return a + b\n"
)
print(await sandbox.run("add", 1, 2))
asyncio.run(main())
Expected output:
Use build_template("js") instead to run a JavaScript guest.
If runtime_path is omitted, the SDK downloads and caches the runtime on first
use. For hostcalls, mounts, environment variables, and HTTP policy, see
Python Host API.
JavaScript / TypeScript SDK¶
Install the SDK:
Run a small Python guest from Node.js:
import { buildTemplate } from "isola-core";
const template = await buildTemplate("python");
const sandbox = await template.create();
try {
await sandbox.start();
await sandbox.loadScript("def add(a, b):\n return a + b\n");
console.log(await sandbox.run("add", [1, 2]));
} finally {
sandbox.close();
}
Expected output:
Use buildTemplate("js") instead to run a JavaScript guest.
If runtimePath is omitted, the SDK downloads and caches the runtime on first
use. For hostcalls, mounts, environment variables, and HTTP policy, see
Node.js Host API.