Read this when you need to upload, process, or download binary files (images, PDFs, executables) in a sandbox.
Resize this image in a sandbox
Process this PDF file
Convert this image format
Generate an image/PDF from data
cd .claude/skills/agent-sandboxes/sandbox_cli
grep "E2B_API_KEY" ../../../../.envuv run sbx init
# YOU capture and remember: sandbox_id = "sbx_img456resize"Use sbx files upload for binary files (images, PDFs, executables):
uv run sbx files upload sbx_img456resize ./input.jpg /home/user/input.jpgImportant: Use upload/download for binary files, not write/read (which are for text).
Install uv and the required library (e.g., Pillow for images):
uv run sbx exec sbx_img456resize "curl -LsSf https://astral.sh/uv/install.sh | sh" --shell --timeout 120
uv run sbx exec sbx_img456resize "/home/user/.local/bin/uv pip install --system pillow"uv run sbx files write sbx_img456resize /home/user/resize.py "from PIL import Image; img = Image.open('/home/user/input.jpg'); img.resize((800,600)).save('/home/user/output.jpg')"
uv run sbx exec sbx_img456resize "python3 /home/user/resize.py"uv run sbx files download sbx_img456resize /home/user/output.jpg ./output.jpguv run sbx sandbox kill sbx_img456resize- Use
upload/downloadfor binary files (images, PDFs, executables) - Use
write/readfor text files only - Upload source files before processing
- Install required libraries (PIL, reportlab, etc.)
- Download processed files back to local system
- Common libraries:
- Images:
pillow(PIL) - PDFs:
reportlab,pypdf2 - Data processing:
pandas,numpy
- Images:
- Always clean up the sandbox when done
- Images: jpg, png, gif, bmp, tiff, webp
- Documents: pdf, docx, xlsx
- Archives: zip, tar, gz
- Executables: any binary format