- Routing internet traffic into services running inside a sandbox through
*.sandbox.tensorlake.ai - Restricting the sandbox’s own outbound internet access
Sandbox Public URL
Every running sandbox is reachable through sandbox-specific ingress.https://<sandbox-id-or-name>.sandbox.tensorlake.airoutes to the sandbox management API on port9501https://<port>-<sandbox-id-or-name>.sandbox.tensorlake.airoutes to a user service listening on<port>inside the sandbox
*.sandbox.tensorlake.ai hostname pattern. The returned sandbox_url is the management URL on port 9501.
Route Traffic Into Sandbox Apps
There are two access modes for internet-facing sandbox traffic:Authenticated requests: the caller sends TensorLake auth credentials, and the proxy authorizes the request before forwarding it.Unauthenticated requests: the sandbox owner explicitly makes selected user ports public, and the proxy skips auth for those user ports.
Expose a User Port
Port9501 is the built-in management API and is always routable through the bare sandbox hostname.
For any other port, the proxy only forwards requests if that port is listed in exposed_ports.
allow_unauthenticated_access does not expose a port by itself. User ports still have to be present in exposed_ports.Authenticated-Only Exposure with the HTTP API
Use this when a port should be routable from the internet but still require TensorLake auth on every request.- Python
- TypeScript
- HTTP
Unauthenticated Public Internet Access with the CLI
Use this when you want anyone on the internet to be able to reach a sandbox app without TensorLake credentials. Common cases include webhook receivers, demo apps, public APIs, browser clients, and temporary preview environments.- CLI
- Python
- TypeScript
- HTTP
port expose workflow sets both:
exposed_portsallow_unauthenticated_access=true
Authenticated Requests
Authenticated routing is the default model for sandbox access.- The management URL on port
9501always requires auth - User ports can also require auth when they are exposed but
allow_unauthenticated_access=false
Browser session authentication
Browser applications can authenticate requests to the sandbox proxy with the user’s Tensorlake Cloud session cookie. This is a browser-facing proxy flow, not SDK authentication; Python and TypeScript SDK clients continue to use only a project-scoped API key. The browser sends the currenttl.session_token cookie automatically. The
legacy tl-session name also remains supported during migration. Because a
user session can access more than one project, include the organization and
project currently selected in the application as the organizationId and
projectId query parameters:
The sandbox proxy consumes the Tensorlake session cookie and removes it before
forwarding the request to the sandbox. Your application does not receive the
platform session credential; its other cookies are preserved.
Unauthenticated Requests
To make a user port public on the internet, both of these conditions must be true:- the port is in
exposed_ports allow_unauthenticated_access=true
Unauthenticated access only applies to user ports. The management API on port
9501 never becomes public.If a named sandbox is suspended, the proxy can auto-resume it when a request arrives for an exposed port.
Outbound Internet Access
By default, sandboxes have outbound internet access enabled. Disable it for untrusted code:- Python
- TypeScript
- HTTP
- CLI
allow_internet_access=False failed DNS resolution for https://example.com, confirming that outbound internet access was disabled.
Setting allow_internet_access=false with an empty allow_out blocks all outbound traffic, including DNS requests. Combined with a non-empty allow_out, the listed destinations stay reachable, but DNS remains blocked unless the resolver’s IP address is itself listed in allow_out. In the CLI, --no-internet (or -N) cannot be combined with --network-allow or --network-deny.
Allow Specific Destinations
Useallow_out when you want a sandbox to reach only selected destinations.
- values can be domains, leading-wildcard domains like
*.example.com, IPv4 addresses, or IPv4 CIDR ranges deny_outtakes precedence: a destination matched by bothallow_outanddeny_outis blocked- hostname rules are followed across DNS changes, so a CDN-backed domain keeps working as its IP addresses rotate
*.example.com matches api.example.com and v1.api.example.com, but not example.com. Add the apex as a separate entry if you need it too. Wildcards are only supported in allow_out, not deny_out.
- Python
- TypeScript
- HTTP
- CLI
--network-allow is -A. Quote wildcard entries in the shell so * is not expanded.
Block Specific Destinations
- Python
- TypeScript
- HTTP
- CLI
deny_out=["example.com"] blocked https://example.com while https://api.openai.com/v1/models still returned 401, confirming outbound connectivity was still available for destinations that were not denied.
The short form of --network-deny is -D. You can combine -A and -D; deny rules take precedence when a destination matches both lists.
Update the Policy on a Running Sandbox
You can change a sandbox’s egress policy without recreating or suspending it. The new policy is applied to the running sandbox’s firewall as a single atomic swap, so there is no window where egress is unprotected. Every policy update closes the connections that the previous policy allowed. This is intentional: a firewall change must also apply to traffic that was already flowing. After an update, processes in the sandbox must open new connections, and each new connection is checked against the new policy. Clearing the policy also closes existing connections. Thenetwork argument is tri-state:
- omit it to leave the current policy unchanged (you can update
nameor exposed ports without touching the network policy), - pass a policy to replace the whole policy, or
- clear it to return the sandbox to unrestricted egress.
- Python
- TypeScript
- HTTP
- CLI
tl sbx update command replaces or clears the complete network policy. Repeat -A or -D to add multiple rules to the replacement policy. --no-internet is an absolute block-all mode and cannot be combined with either rule flag; --clear-network cannot be combined with any replacement-policy flag.
If a hostname in the new policy cannot be resolved, the update is rejected and the previous policy stays fully enforced — the sandbox keeps running under the policy it already had.
Network Configuration Summary
How allow_internet_access and allow_out combine
In short: when
allow_out is empty, allow_internet_access is a simple switch for all outbound traffic. A non-empty allow_out makes the sandbox default-deny in both modes, and allow_internet_access then only controls DNS. With allow_internet_access=false, hostname entries in allow_out cannot resolve unless the resolver’s IP is also listed, so in this case, either add the resolver IP alongside them or use IP and CIDR entries only.