Tangle vs Beam: hand the coding agent a task and get back its result and cost
Create a sandbox with Prime Agent or any other installed agent, give it a task, and one call returns the result, token usage and cost.
Create a sandboximport { 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({
git: { url: "https://github.com/tangle-network/sandbox-demo" },
backend: { type: "prime" },
});
try {
const run = await box.prompt("`npm test` fails. Find the cause and fix it.");
console.log(run.success, run.response);
console.log(run.usage, run.costUsd);
} finally {
await box.delete();
}The result, token usage and cost come back from one call (docs.tangle.tools/sandbox/cloud-agents). Prime Agent's first reply arrives 3.3s after create at p50 and 8.8s at p95, over 41 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)
- The agent needs no model key: its model calls go through Tangle Router and bill to your Tangle balance. (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 Beam
-from beam import Sandbox
+import os
+
+from tangle_sandbox import Sandbox, SandboxStatus
-sb = Sandbox(cpu=1, memory="1Gi", keep_warm_seconds=600).create()
-print(sb.process.run_code("print(sum(range(10)))").stdout)
-sb.terminate()
+client = Sandbox(api_key=os.environ["TANGLE_API_KEY"], base_url="https://sandbox.tangle.tools")
+box = client.create()
+box.wait_for(SandboxStatus.RUNNING)
+print(box.exec("python3 -c 'print(sum(range(10)))'").stdout)
+box.delete()
+client.close()For everything else, the Python SDK page 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)
- Run records
- Every agent turn is traced, and an Intelligence report summarizes what the agent did (docs.tangle.tools/sandbox/observability)