Quickstart
Create a sandbox, run a command, and delete it when the work finishes.
Get an API key
Create a key at id.tangle.tools and add credit to your account.
Set TANGLE_API_KEY in your environment.
Keep this key on your server.
See Authentication for key setup.
Install
npm install @tangle-network/sandbox
npm install --save-dev tsxTypeScript and JavaScript use the Sandbox SDK. Python uses the HTTP API through HTTPX.
Run a command
Save TypeScript as example.ts. With Node.js 22 or later, run npm pkg set type=module in your project, then npx tsx example.ts.
For JavaScript, use example.mjs and node example.mjs.
For Python, use example.py and python example.py.
import { Sandbox } from "@tangle-network/sandbox";
const client = new Sandbox({
apiKey: process.env.TANGLE_API_KEY!,
baseUrl: "https://sandbox.tangle.tools",
});
const box = await client.create();
try {
const { stdout } = await box.exec(
"python3 -c 'print(sum(range(1_000_000)))'",
);
console.log(stdout);
} finally {
await box.delete();
}