python template has Python 3.12 with numpy, pandas, requests and httpx in /opt/venv, which is on the PATH. Files moves data in and out.
1
Upload, run, read back
analyze_csv.py
commands.run raises with the exit code and stderr. Hand that back to the model and let it try again in the same sandbox: the file is still there.2
Get files back
Read text with
files.read, and binary output such as a chart image with files.read(path, format="bytes"). Extra packages install with pip install in the sandbox on a plan with public egress, or ship in your own template.3
Keep state between questions
For a chat that asks follow-up questions about the same data, keep the sandbox and its loaded files between turns, and pause it when idle. For a stateful Python kernel (variables kept between calls), the
code-interpreter template runs E2B’s code-interpreter server.examples/python/analyze_csv.py in the public SDK repository. It prints what happens at each step.