Network rules
The network object on a sandbox create controls outbound traffic: what code inside the sandbox can reach. It has four modes.
Next step: pick a mode and add it to your create request. You can replace the rules later with one call: see Change the rules on a running sandbox.
The rules cover outbound traffic only. Your exec and file calls go through the provider’s own channel and work in every mode.
How we checked each mode
Every result on this page comes from the same script, run inside a python:3.12-slim sandbox on each provider. It tries four addresses:
With no network field, on both providers:
Block everything
The image is pulled before the rule applies, so any registry image still works. Installing packages inside the sandbox does not. Build what you need into an image first.
Allow some domains
An entry is a host name, optionally with one leading *. label, such as *.pythonhosted.org. A plain name does not cover its subdomains. With the allowlist above, https://test.pypi.org/simple/ was blocked on both providers, and it answered 200 from a sandbox with no rules. List each name you need, or use the *. form.
The allowlist above is enough for pip: pip install six==1.16.0 worked on both providers.
What an allowed name opens
Meadow sends each entry to the provider as you wrote it, and the provider applies it. Two things follow.
A wildcard also covers the bare name. With "allow_domains": ["*.iana.org"], https://www.iana.org/, https://data.iana.org/ and https://iana.org/ all answered on both providers. Both providers document this. If the bare name must stay blocked, a wildcard cannot do that on either provider.
The ports differ by provider. We ran one script in a python:3.12-slim sandbox made with each provider’s own SDK, with www.iana.org and github.com on the list:
On Modal a host name opens TLS on port 443 and nothing else. An https:// URL that redirects to http:// fails there: https://www.iana.org/domains/example does this, and urllib reports Network is unreachable. On Daytona the same URL works. The result was the same for rules given at create and rules set by a change. Other ports were not checked on Daytona. Modal’s documentation states the rule: its domain allowlist allows TLS traffic on port 443 only. We found no setting for ports in either provider’s API, so Meadow cannot make the two match.
If you need another port on Modal, add the host’s address range to allow_cidrs next to the name. With "allow_domains": ["www.iana.org"] and both of its addresses as /32 entries in allow_cidrs, http://www.iana.org/ answered 200 on Modal. A range opens every port and every host on those addresses. On a shared CDN that is more than the one name, and the addresses can change. Daytona cannot combine the two lists, so such a request is served by Modal.
These results are from 2026-11-27, with no Meadow in the path.
What a blocked call looks like differs. Daytona sets the HTTPS_PROXY and HTTP_PROXY variables in the sandbox and filters there, so a client that uses them fails with Tunnel connection failed: 403 Forbidden, and a client that ignores them fails at the name lookup with Name or service not known. Both are blocked.
An allow_domains entry that is not a host name returns 400: a URL, a port, a path, an IP address, or a wildcard in another position.
Seen on the hosted beta on 2026-11-28.
Allow some address ranges
Each entry is a CIDR range. A bare address such as 1.1.1.1 returns 400 with network.allow_cidrs entries must be valid cidr ranges. Write 1.1.1.1/32.
The host names in our check sit outside the allowed range and were blocked. Name lookups differ by provider in this mode: on Daytona a lookup of example.com failed, and on Modal it returned an address that the sandbox then could not connect to. Use addresses in your code, or use a domain allowlist.
What we tried beyond HTTPS
The checks above use HTTPS. We also ran a short Python script as nobody in a python:3.12-slim sandbox on each provider and mode. It opened plain TCP connections to 1.1.1.1 on ports 443, 80, and 53 and to a public SSH server on port 22, sent a DNS query to 1.1.1.1 over UDP, and looked up example.com. With no rules, every one of these worked on both providers.
What this means:
- Apart from the DNS answers below, no data came back from a blocked host in any mode on either provider.
- A completed TCP connection does not prove a host is reachable. On Daytona a filter accepts connections on ports 443 and 80 and then closes them.
- On Daytona, DNS queries are answered by a resolver even under
block_all. On Modal, a name lookup works under both allowlists. A lookup that leaves the sandbox can carry a few bytes out in the name itself. We did not test whether these resolvers pass lookups for names you did not allow to the internet. If that matters to you, useblock_allon Modal, where the lookup failed. - These results come from a few connections on one day. Nobody has run a security test of the rules, and the provider applies them.
Change the rules on a running sandbox
PATCH /v1/sandboxes/{sandbox_id} replaces the rules of a running sandbox. Use it to give setup the hosts it needs, then narrow the rules before untrusted code runs.
The response is 200 with the sandbox, and its network field holds the new rules:
On Daytona the rules were in force when the call returned, in every change we ran. On Modal a change that removed access was in force when the call returned in every run. A newly allowed address range on Modal was open at once in two runs and still blocked right after the call in three: in one of those it was open 15 seconds later, and in the other two we did not check again. Check from inside the sandbox before you rely on a new allowance.
What to know:
- The whole rule set is replaced. A field you leave out is reset, so send every rule you want to keep.
{"network": {}}opens the network. {"network": {"block_all": true}}blocks everything.- Sending the same rules again is safe.
- The sandbox must be
running. Otherwise the call returns 409. - Connections that are already open may be cut when the new rules no longer allow them.
- On Daytona a change to the allow list also stalled open keep-alive connections to hosts that stayed allowed (seen on the hosted beta on 2026-11-24). A new connection worked. Reconnect after a change.
- A rule set the provider cannot apply returns 400 and changes nothing. The message names the cause, for example
modal can change network rules only on a sandbox created with allow_domains or allow_cidrs; this one was created with an open network. - Change one sandbox’s rules one call after another. Two calls at the same moment both return 200 and the last to finish wins.
The providers differ:
On Modal, decide at create which kind of rule you will need later. A sandbox that starts on host names can move to other host names or to block_all. To be able to open the network later, create the sandbox with at least one host name and one address range.
On Daytona, the provider’s documentation says only organisations on its tier 3 or tier 4 can change rules on a running sandbox. We have not seen what a lower tier returns.
A change returns 502 with error.code sandbox_unreachable and Retry-After when the provider answers “not found” for a sandbox it still reports as running. The rules were not changed, so send the change again. This is on the hosted beta since 2026-11-27, and we have not seen it on a live sandbox.
Every row above was run on the hosted beta on 2026-11-24, with the check script from the top of this page run inside the sandbox after each change. The Daytona organisation we used could change rules.
Provider differences
The check script at the top of this page gave the same results on Daytona and Modal in all four modes. The providers differ in which ports an allowed name opens (see What an allowed name opens) and in what you can combine.
block_all cannot be combined with either allowlist on any provider. That returns 400 with network.block_all cannot be combined with allow_domains or allow_cidrs.
A request with both allowlists is served by Modal when your route allows it, and the skipped Daytona attempt is recorded:
On Modal, a sandbox with block_all cannot be reached from outside at all. A create with block_all and ports or ssh: true skips Modal, and the attempt says why:
When your route allows Daytona, the sandbox is created there. When it does not, the sandbox is failed. Both outcomes were seen on the hosted beta.
If you need inbound access and tight outbound rules on Modal, use an allowlist. With "allow_domains": ["pypi.org"] both the port URL and SSH worked.
On Modal, SSH with any rule that blocks the package mirror needs openssh-server in the image already. See Files, ports, and SSH.
Give a sandbox access to Meadow
To let code in a sandbox call Meadow, create a narrow key and pass it in env. With a domain allowlist, add the host of your MEADOW_BASE_URL to allow_domains. Meadow does not add it for you.
This script mints a key that can make five calls to one model for one hour, creates a sandbox that can reach only Meadow, and runs a model call from inside it as a non-root user. MEADOW_API_KEY is a key with the admin and sandboxes scopes, and PROJECT_ID is its project.
With "provider": {"only": ["modal"]} added to the create, the same script printed the same three lines with modal.
The key in env is readable by every process in the sandbox. Give it only the models scope, allowed_models, limits, and a short expires_at, and revoke it when the sandbox is gone. Run a coding agent in a sandbox builds on this flow.
More in Known limits.
API reference
Operations on this page: createSandbox, updateSandbox.