Skip to main content

Sandbox SDK

Run untrusted code safely. The Sandbox API gives your AI agent a real Linux environment: create it, run anything, delete it.

Each sandbox is a Firecracker microVM: hardware-isolated, not a container. Boot time is ~125ms. Everything is deleted when you're done.

What's in this section

The three-line version

import { Sandbox } from '@codecapsules/sandbox';

await Sandbox.using(async (sb) => {
const r = await sb.exec('python -c "print(2 ** 32)"');
console.log(r.stdout); // "4294967296\n"
});
// sandbox deleted automatically
from codecapsules_sandbox import Sandbox

with Sandbox.create() as sb:
result = sb.exec('python -c "print(2 ** 32)"')
print(result.stdout) # "4294967296\n"

Access

The API is in private beta. Join the waitlist and you'll get an API key when your spot is ready.