Install packages¶
Agent code usually needs third-party libraries. Install them inside the sandbox, then run code that uses them — all in the same VM so the install persists.
Python (pip)¶
Node (npm)¶
with Sandbox(stack="node") as sb:
sb.run("npm install -g cowsay")
print(sb.run("cowsay hello").stdout)
Install from a requirements file¶
Write the file into the VM, then install from it:
with Sandbox(stack="python") as sb:
sb.run("cat > /tmp/requirements.txt <<'EOF'\nnumpy\npandas\nEOF")
sb.run("pip install -r /tmp/requirements.txt")
print(sb.run("python3 -c 'import numpy, pandas; print(numpy.__version__, pandas.__version__)'").stdout)
Pick the right base image¶
The base image already has Python and Node. Use a language-specific image for a leaner start:
stack | Has |
|---|---|
base (default) | Python + Node |
python | Python toolchain |
node | Node.js toolchain |
debian13 / ubuntu24.04 | OS only — install what you need |
See Images for the full catalog.
Reuse, don't reinstall
Installs live for the life of the sandbox. Keep one sandbox alive across an agent session instead of reinstalling each call. To carry installed state between sandboxes, use volumes — see Persist data with volumes.