Why no network by default
Agent code is written by an LLM and can be influenced by prompt injection. Three risks that require outbound network access:- Data exfiltration — code that sends your files to an attacker’s server
- Cryptomining — code that connects to a mining pool and consumes your compute
- Supply-chain attacks —
pip installof a hallucinated package name that runs malicious code on install
How to get data in and out
Use these two patterns to move data between your agent and the sandbox:upload() / download()
Push files into the sandbox before running code; pull result files back out afterward.
run_code stdout
Run computation inside the sandbox and read the output through the return value’s stdout field.
The recommended pattern
Your agent process has full network access. The sandbox does not. Keep network calls in your agent code, then push the results into the sandbox viaupload():
Planned: allowlisted egress
For workloads that genuinely need outbound access from inside the sandbox — such aspip install or calling a specific API — Podflare will add allowlisted egress. You’ll be able to specify a list of allowed domains when creating a sandbox:
Until allowlisted egress ships,
upload() and download() are the only way to move data between the internet and a sandbox.Related concepts
Sandboxes
Isolation guarantees and what the microVM boundary means
Python REPL
Run computation inside the sandbox and stream results out