Skip to main content
By default a sandbox can reach the whole internet. It can clone repositories, install packages and call APIs, which is exactly what most agents need. Sometimes, though, you run code you cannot fully trust: a file a user uploaded, code a model has just written, or a dependency nobody has checked. If that code can reach the whole internet, it could send whatever it finds to anyone, such as environment variables, API keys or your users’ files. The 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
2

Installing from PyPI works

curl: wait for it
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

What an allow list can hold

An allow list can hold up to 200 entries, of four kinds: These lists come up often:
Start with a short list and add to it only when needed. Run the job once. If it fails because it could not reach a host, the error names that host. Add it only if the code really needs it.

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
You can still do everything from the outside: put files in, run commands and read the results. The sandbox simply cannot open any connection of its own.

Good to know

A few rules about how network settings work:

Errors

An invalid network setting is refused when you create the sandbox:

Clean up

Security and isolation

What keeps each sandbox separate from the others.

API keys

A key that can only reach one sandbox.