Network isolation
The agent reaches the internet through the proxy, which checks each CONNECT against allowed_hosts. Allows and blocks the proxy sees become audit events when the run ends. The run's last moments can be missing.
On this page
Tip
Step by step
Limit where an AI agent can send data writes a minimal allowlist, tests the refusals and lists the channels an allowlist leaves open.
The path out of the sandboxLink to this section
Text description
The agent runs in a sandbox: on Docker its network has no default route and no IPv6. On Firecracker the proxy runs on the host, with nftables restricting the guest to it and the run’s gates. Through the Squid proxy, it reaches only the hosts you list: the proxy checks each CONNECT against network.allowed_hosts by dstdomain name match, not by IP. The run’s own MCP and A2A gates stay reachable.
api.groq.com is listed: CONNECT allowed, the TLS tunnel opens and the server replies. evil.example.com is not: CONNECT refused with a 403, and the tunnel is never opened.
Matching is by name, so raw IPs lose. The allowlist compares names as written, with reverse lookups off, so a destination given as a raw IP is refused unless that exact address was listed, the real IP of an allowed host included. Resolving a name yourself is not a way around it.
Both attempts appear in ~/.constle/logs/egress-probe-2026-08-08.jsonl: a network_allowed event for api.groq.com (HTTP 200) and a network_blocked event for evil.example.com (HTTP 403). Both attempts are logged either way: the blocked one is how you find out it happened.
The agent reaches the internet through the proxy, which checks each CONNECT against allowed_hosts, and it reaches its run's own MCP and A2A gates. Through the proxy, it reaches only the hosts you list. On Docker, the agent's network has no route out, and your host has no address on it. Whether DNS lookups can leave through Docker's own resolver is untested. On Firecracker, the host drops everything but the proxy and its gates, DNS included. Both backends render the proxy's policy from the same function (buildSquidConfig, internal/sandbox/docker.go), so Docker and Firecracker enforce the same ruleset.
Names, not addressesLink to this section
Resolving a hostname inside the sandbox and connecting to the resulting address does not get around the proxy. The raw IP of an allowed host is denied along with every other IP literal, because the allowlist is a dstdomain ACL built with reverse lookups disabled: an address is admitted only if that same address was itself listed, never by being resolved back to a name. A PTR record is written by whoever owns the address, not by whoever wrote the allowlist.
| Destination | Request | Result |
|---|---|---|
| declared hostname | https://api.groq.com/ |
CONNECT allowed |
| raw IP of the declared host | https://172.64.149.20/ |
Tunnel connection failed: 403 Forbidden |
| raw IP, undeclared | https://1.1.1.1/ |
Tunnel connection failed: 403 Forbidden |
| undeclared hostname | https://evil.example.com/ |
Tunnel connection failed: 403 Forbidden |
An allowed name is not a blank chequeLink to this section
An allowed name does not decide where it points, or what travels over it. A name resolving into the sandbox host, the host's own network, a cloud metadata address, or the CGNAT or unspecified ranges is refused at the proxy whatever DNS answered. That check is made on the resolved address, which is the only place it can be made. And a tunnel to an allowed host is a tunnel to its HTTPS port: a request may name port 80 or 443, and a CONNECT tunnel may name 443 alone, so an allowed hostname cannot become a raw TCP path to an SSH or database port, whose contents the proxy could not see in any case.
| Case | Request | Squid | Audit |
|---|---|---|---|
| allowed host, HTTPS | CONNECT api.groq.com:443 |
TCP_TUNNEL/200 |
network_allowed |
| allowed host, port 22 | CONNECT api.groq.com:22 |
TCP_DENIED/403 |
network_blocked |
| allowed name → 127.0.0.1 | CONNECT localtest.me:443 |
TCP_DENIED/403 |
network_blocked |
| address whose PTR is one | CONNECT 1.1.1.1:443 |
TCP_DENIED/403 |
network_blocked |
When the agent ignores the proxyLink to this section
Everything above is about traffic that goes through the proxy. Here is what each backend does with traffic that tries not to.
On Docker, the agent's network has no route out, and your host has no address on it: it is created --internal, with IPv6 off and the isolated-gateway option, and a Docker Engine that cannot show that mode is refused. Its routing table holds a single on-link entry and no default route at all, and the only address family present is IPv4. The agent container also runs without the NET_RAW capability, so on Docker the agent can't open raw sockets. Attempting to dial out directly on Docker, with the proxy environment cleared:
IPv6 2606:4700:4700::1111 OSError: [Errno 101] Network is unreachable
IPv4 1.1.1.1 OSError: [Errno 101] Network is unreachableOn Firecracker the proxy runs on the host, with nftables restricting the guest to it and the run's gates. The guest does have a default route, to its TAP gateway on the host, so that a bypass attempt leaves the guest and is dropped by the host firewall. The TAP is a /30 holding only the gateway and the guest, with no forwarding or NAT, and the run's own nftables inet table accepts only the guest's connections to the gateway on the proxy port and on each gate port, then drops everything else arriving from the tap, DNS and ICMP included, in both the input and forward hooks (internal/sandbox/firecracker_net.go). There, a direct IPv4 dial is dropped at the host rather than answered, and IPv6 has no route in the guest.
IPv6 in particular is closed on both backends, and closed deterministically rather than environment-dependently: the internal network is created with an explicit --ipv6=false instead of inheriting whatever the operator's Docker daemon defaults to, so this guarantee is a property of the code and not of the host it runs on. The Firecracker guest gets only a kernel-generated link-local fe80:: address, never a global one or a ::/0 route, and its per-run nftables table drops everything else from the tap in the dual-family inet table, so the same rule covers both families.
The proxy's own rules cover both families rather than relying on the sandbox only ever speaking one: the raw-IP refusal is a string comparison, which does not care what family an address is in, and the internal-destination rule lists the IPv6 loopback, link-local and unique-local ranges beside the IPv4 ones.
The proxy refuses a name outside the allowlist before it resolves it, so a refused name never reaches DNS through the proxy.
Writing allowed_hostsLink to this section
sandbox:
network:
allowed_hosts:
- api.groq.com
- .example.com # example.com and all of its subdomains- Entries are plain hostnames: lowercase ASCII letters, digits, hyphens and dots, with one optional leading
.to include subdomains. A scheme, port, path, wildcard, uppercase or non-ASCII name is rejected at validate time (use the punycode form). - An empty or absent list admits no host at the proxy. Constle's own MCP and A2A gates stay reachable. On Docker, so does Docker's embedded resolver, which the agent uses to find the proxy by name.
sandbox.network.egressis warned about and ignored: see limitation 3. - An IPv4 address in dotted-quad form is accepted, and then permitted literally. Listing one does not exempt it from the destination rule: a private or link-local address is refused either way.
- A host that also appears under
mcp.servers[].urlora2a.peers[].endpointis rejected, because allowlisting it would let the agent skip the gate. Only names are compared: another name for the same server, or its IP address, is not caught (limitation 2). Constle routes the agent's calls to declared MCP servers and A2A peers through their gates. You don't list them here. - With MCP servers or A2A peers declared,
localhost,127.0.0.1andhost.docker.internalcan't go on the list.
What this does not coverLink to this section
The proxy trusts DNS for public addresses. If a declared hostname resolves to a public address an attacker controls, the allowlist will let it through: name-based allowlisting is only as good as the name resolution behind it. What DNS cannot do is aim a declared name back inside: loopback, link-local, metadata and private destinations are refused on the resolved address, whatever the record says.
An allowed host is a destination you trust. Traffic to hosts you allow isn't gated. If an allowed host shares a server with an MCP server, a request can reach that MCP server past the gate. Its HTTPS tunnel can carry a request for another name the same server answers for (a CDN or a shared host, for example), including a declared MCP server's (limitation 2).
On Docker, whether DNS lookups can leave through Docker's own resolver is untested.
Network events are copied from the proxy's log when the run ends, and requests from the run's final moments can be missing (limitation 6). Traffic that skips the proxy is never logged.
If a document the agent reads contains a hidden instruction to send data to a host you didn't list, the request is refused at the proxy, below the model, whether or not the agent "knows" it is compromised, unless that host shares a server with one you allowed (above). The attempt lands in the audit log as a network_blocked event, which is how you find out it happened.