network option lets you decide what a sandbox can reach:
You set it when you create the sandbox. Everything else keeps working as usual: you can still run commands,
read files and use the sandbox’s address. Only the connections that the sandbox itself tries to make to the outside
world are limited.
Let code install packages, and nothing else
A common setup for code written by a model: it may install Python packages from PyPI, the Python package index, and reach nothing else.1
Create the sandbox with an allow list
Response
Response
response
2
Installing from PyPI works
curl: wait for it
Output
Output
output
3
Anything else is refused
Now the code tries to send data to another server. The connection is refused, and nothing leaves the sandbox:
Response
Response
response
What an allow list can hold
An allow list can hold up to 200 entries, of four kinds:
These lists come up often:
No network at all
Some code needs no network at all: a calculation, a parser for user input, a data transformation. For that kind of work, cut the network off completely with{"block": true}:
curl: try to reach out
Response
Response
response
Good to know
A few rules about how network settings work:Errors
An invalidnetwork setting is refused when you create the sandbox:
Clean up
Related
Security and isolation
What keeps each sandbox separate from the others.
API keys
A key that can only reach one sandbox.