Read this when you need to run Python code in a sandbox for testing or execution.
Run this Python script in a sandbox to test it
Test this Python code safely
Execute this script in isolation
cd .claude/skills/agent-sandboxes/sandbox_cli
grep "E2B_API_KEY" ../../../../.envcd .claude/skills/agent-sandboxes/sandbox_cliuv run sbx init
# Output: Created sandbox: sbx_abc123def456
# YOU remember: sandbox_id = "sbx_abc123def456"Using the captured sandbox ID:
uv run sbx files write sbx_abc123def456 /home/user/test.py "import sys; print(sys.version)"uv run sbx exec sbx_abc123def456 "python3 /home/user/test.py"uv run sbx sandbox kill sbx_abc123def456- Always capture and remember the sandbox ID from init output
- Use the captured ID directly in all subsequent commands
- Write files using
sbx files writecommand - Execute with
sbx execcommand - Always clean up by killing the sandbox when done