AI agents · OpenClaw · self-hosting · automation

Quick Answer

Best Agent Sandbox Platforms for Network & Secrets Control

Published:

The short answer

Pick the sandbox whose network boundary sits outside the VM and can attach credentials for you, so the agent never holds a key it could leak. As of November 16, 2026:

  1. Vercel Sandbox — best overall. Host-level firewall with allow-all, deny-all or user-defined policies, updated at runtime; credential brokering injects headers outside the microVM. Free on Hobby within quota.
  2. E2B — best for code-interpreter agents. allowOut/denyOut lists with domains and wildcards; per-host request transforms fill stored secrets at the egress proxy (public beta).
  3. Cloudflare Sandbox — best when policy should be code. enableInternet = false plus allowedHosts, and outbound handlers in your Worker that add the token.
  4. Daytona — cheapest compute with real egress controls. Domain or CIDR allowlists, block-all, and an outbound proxy you control; $200 of free compute.
  5. Modal — best when the agent needs a GPU. Full block, CIDR allowlist and a domain allowlist (beta); HTTPS inspection through a sidecar.

This page is the sandbox spoke of our best secrets managers for AI agents guide. For the full runtime ranking by price and isolation, see best AI agent sandboxes.

The comparison

PlatformDefault egressRestrict egressKeys kept out of the sandboxPrice facts (Nov 16, 2026)
Vercel SandboxAllow alldeny-all (blocks DNS too) or deny-by-default policy with allowed domains and CIDR ranges; change at runtime without restart✅ transform rules inject or replace headers at the host firewall; matchers on path, method, query, headersHobby: 5 active CPU-hours and 420 GB-hours a month free; Pro: $0.128 per active CPU-hour, $0.0212 per GB-hour (iad1)
E2BAllow allallowInternetAccess: false; denyOut all + allowOut IPs, CIDRs, domains, wildcards; updateNetwork on a running sandbox✅ Per-host request transforms with Secret.fill (public beta, HTTPS only)Hobby $0 with one-time $100 credit, 10 concurrent, 1-hour sessions; Pro $150/month, 100 concurrent, 24 hours
Cloudflare SandboxAllow allenableInternet = false; allowedHosts becomes a deny-by-default allowlist; deniedHosts✅ Outbound handlers / Worker entrypoint add the credential; sandbox never sees itBilled on Cloudflare Containers usage
DaytonaBy tier: Tiers 1–2 restricted, Tiers 3–4 full accessdomainAllowList, networkAllowList (CIDR) or networkBlockAll, mutually exclusive; update while running on Tiers 3–4⚠️ Not built in — chain outboundProxyUrl to your own proxy$0.0504 per vCPU-hour, $0.0162 per GiB-hour, $200 free compute
ModalAllow allblock_network, outbound_cidr_allowlist, outbound_domain_allowlist (beta, port 443)⚠️ Not built in — route HTTPS through a sidecar (experimental)Usage-based; GPU in the sandbox

1. Vercel Sandbox — best overall

Vercel runs the firewall on the host, outside the microVM, so code in the sandbox cannot switch it off. A policy can be allow-all (the default), deny-all — which also blocks DNS — or user-defined, which denies by default and allows the domains and address ranges you list. Policies change at runtime, which suits multi-step work: fetch dependencies with the internet open, then lock the network before the agent touches private data.

The credential feature is what puts it first. A transform rule on an allowed domain makes the firewall terminate TLS for that host and add or replace headers, for example Authorization: Bearer … for an AI gateway. The key never enters the VM, so a prompt-injected agent has nothing to print. Vercel shipped header injection on February 23, 2026 and opened every firewall feature to the free Hobby plan on August 5, 2026.

Read the caveats in Vercel’s own docs: an empty policy behaves as deny-all; a broad range such as 0.0.0.0/0 overrides domain scoping; and because ordinary allowed domains are matched on the TLS SNI only, domain fronting can reach another virtual host on the same CDN. For hosts that matter, add a transform rule — Vercel then terminates TLS and can force the Host header to the allowed domain.

2. E2B — best for code-interpreter agents

E2B sandboxes have internet access by default. Turn it off with allowInternetAccess: false, or deny all traffic and allow specific IPs, CIDR blocks and domains (wildcards such as *.mydomain.com work). Domain filtering covers HTTP on port 80 by Host header and TLS on port 443 by SNI; other ports fall back to CIDR rules, and QUIC is not supported. updateNetwork tightens or loosens a running sandbox without recreating it.

For secrets, E2B’s per-host request transforms (public beta) let you register rules keyed by host: the egress proxy injects headers on matching HTTPS requests, and a header value can reference a stored secret with Secret.fill, which the proxy replaces outside the sandbox. The proxy uses an E2B certificate authority, so clients with their own CA bundle (Python Requests, Node.js) need configuring. You can also send allowed traffic through your own SOCKS5 proxy.

3. Cloudflare Sandbox — best when policy should be code

Set enableInternet = false and only traffic you allow through allowedHosts or outbound handlers leaves the sandbox — and only on ports 80, 443 and DNS. Setting allowedHosts creates a deny-by-default allowlist with glob patterns. Outbound handlers run in the Workers runtime, outside the sandbox, so they can hold a secret and attach it before forwarding. For new apps on @cloudflare/sandbox 1.0, Cloudflare’s pattern routes HTTPS calls to a WorkerEntrypoint that checks method, host and path, returns 403 for anything else, and adds the token. That is the most expressive policy of the five: it is ordinary code.

4. Daytona — cheapest compute with real egress controls

Daytona applies network limits by billing tier. On Tiers 1 and 2 access is restricted and sandbox settings cannot override the organisation’s policy. On Tiers 3 and 4 the default is full access, and a sandbox-level domainAllowList, networkAllowList or networkBlockAll strictly replaces it — even GitHub, npm and PyPI are blocked unless you list them. The three options are mutually exclusive (a conflicting combination returns 400). There is no built-in credential injection, but outboundProxyUrl chains the sandbox’s HTTP(S) traffic to a proxy you run, where you can attach keys; pair it with a domain allowlist, because clients that ignore HTTP_PROXY bypass the proxy.

5. Modal — best when the agent needs a GPU

Modal offers three levels: block_network=True drops everything; outbound_cidr_allowlist allows listed ranges on any protocol; outbound_domain_allowlist (beta) allows TLS on port 443 to listed names. The two allowlists combine additively. Modal warns that DNS traffic is allowed without restriction unless all outbound traffic is blocked, so a DNS tunnel remains possible. For credential handling, the experimental proxy_traffic_via_sidecar sends port-443 traffic through a sidecar you configure.

How to choose

  • Agents calling paid APIs with keys you cannot afford to leak: Vercel Sandbox, or E2B if you already run code interpreters there.
  • Policy must check method and path, not just hostname: Cloudflare Sandbox.
  • Lowest compute bill, your own proxy already exists: Daytona.
  • GPU inside the agent loop: Modal, with a sidecar for HTTPS.
  • Whatever you pick: start from deny-all, allow narrow single-purpose hostnames, and keep the vault outside the sandbox — see how to lock down AI agent network egress and the best tools for brokering secrets at runtime.

Last verified: November 16, 2026.

Sources