Tangle vs Cloudflare Sandboxes: drive sandboxes from your own app in TypeScript or Python
The Python SDK starts a sandbox with Claude Code in it, gives the agent its task and returns the result and token usage.
Create a sandboximport os
from tangle_sandbox import BackendConfig, CreateSandboxOptions, GitConfig, Sandbox, SandboxStatus
client = Sandbox(api_key=os.environ["TANGLE_API_KEY"], base_url="https://sandbox.tangle.tools")
box = client.create(
CreateSandboxOptions(
git=GitConfig(url="https://github.com/tangle-network/sandbox-demo"),
backend=BackendConfig(type="claude-code"),
)
)
try:
box.wait_for(SandboxStatus.RUNNING)
run = box.prompt("`npm test` fails. Find the cause and fix it.")
print(run.success, run.response, run.usage)
finally:
box.delete()
client.close()The result and token usage come back from one call (docs.tangle.tools/sandbox/cloud-agents). Claude Code's first reply arrives 3.4s after create at p50 and 12s at p95, over 45 measured runs (tangle.tools/benchmarks).
What else you get
- Claude Code, Codex, OpenCode, Pi, Hermes, OpenClaw, Kimi Code and Prime Agent come installed, and /benchmarks times each one's first reply from create. (tangle.tools/benchmarks)
- One prompt call returns the agent's result, token usage and cost. (docs.tangle.tools/sandbox/cloud-agents)
- Set a dollar budget for a fleet of agents, and the platform refuses any charge past it. (docs.tangle.tools/sandbox/agents-fleet)
Move your code from Cloudflare Sandboxes
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 run = await box.exec("echo hello");
console.log(run.stdout);
} finally {
await box.delete();
}From any server or script, one call creates a sandbox, one runs a command and one deletes it.
For everything else, the SDK reference lists every call.
What every sandbox includes
- Isolation
- A container or a Firecracker microVM, chosen per sandbox (docs.tangle.tools/sandbox/security)
- Snapshots and forks
- Snapshot, revert, and split a running sandbox into copies (docs.tangle.tools/sandbox/snapshots)
- Secrets
- Stored once; you choose whether the sandbox can read a secret or only the network proxy can (docs.tangle.tools/sandbox/secrets)
- Network
- Open, a strict allowlist, or blocked, changeable while the sandbox runs (docs.tangle.tools/sandbox/egress)
- Getting a shell
- SSH, a PTY or a browser terminal (docs.tangle.tools/sandbox/terminals)