from runloop import Runloop
client = Runloop(api_key="rl_live_...")
# Create an isolated sandbox
sandbox = client.sandboxes.create(
image="python:3.12",
resources={"cpu": 2, "memory": "4Gi"}
)
# Execute commands
result = sandbox.exec("python -c 'print(42)'")
print(result.stdout) # 42
# Attach credentials securely
sandbox.credentials.attach("OPENAI_API_KEY")
import { Runloop } from "@runloop/sdk";
const client = new Runloop({ apiKey: "rl_live_..." });
// Spin up a sandbox environment
const sandbox = await client.sandboxes.create({
image: "node:20",
resources: { cpu: 2, memory: "4Gi" },
});
// Run code inside the sandbox
const result = await sandbox.exec("node -e 'console.log(42)'");
console.log(result.stdout); // 42
// Securely inject credentials
await sandbox.credentials.attach("OPENAI_API_KEY");
# Install the Runloop CLI
curl -fsSL https://runloop.dev/install | sh
# Authenticate
runloop auth login
# Create a sandbox
runloop sandbox create --image python:3.12 --cpu 2
# Execute a command
runloop sandbox exec --id sb_abc123 "python -c 'print(42)'"
# List active environments
runloop sandbox list --status running
# Attach credentials
runloop credentials attach OPENAI_API_KEY --sandbox sb_abc123