Skip to main content
Often, task authors want to constrain the network access of the agent or verifier during a rollout for security, reproducibility, or reward hacking mitigation. Network policies can be specified in the task.toml file at varying degrees of granularity. How you choose to specify depends on your environment affordances and use case.

Example

task.toml
Diagram showing the public environment baseline, the allowlist during the agent phase, and no network during the verifier phase

Network policy across phases in the shared sandbox

In this example, downloading and installing the agent still works because agent.setup() uses the public [environment] baseline. [agent] applies only to agent.run(). If a phase has no override, it inherits its sandbox’s baseline policy.

Network modes

Harbor supports three network modes: public, no-network, and allowlist.
¹ Single-container tasks only (not in Docker Compose mode).
² Docker Compose (multi-container) tasks only.
³ Docker and Podman support requires Linux containers; Windows containers do not support this network policy mode.
⁴ Docker and Podman support requires Linux containers and local runtime support for the nftables kernel features used by Harbor’s egress-control sidecar.
⁵ Beam resolves concrete hostnames to IP CIDRs before applying the policy; wildcard host entries are not supported.
⁶ TensorLake allowlists accept exact hostnames, leading-wildcard hostnames (a wildcard matches subdomains at any depth but not the apex domain), IPv4 literals, and IPv4 CIDR ranges, but not IPv6 targets.
⁷ Vercel allowlists are available for single-container tasks only. They match domain rules on the TLS SNI, accept exact and leading-wildcard hostnames but not IP literals or CIDR ranges, and deny plain-text HTTP to an allowlisted host. The policy applies from sandbox creation and can be updated on a running sandbox. Compose tasks support public and no-network only.
⁸ Islo supports dynamic network policy only when no custom gateway profile or gateway configuration is supplied.

Phases

Network policies can be specified for the following phases: Baseline phases are subject to the environment supporting the requested network mode (see the table above). These phases can also be specified at the step-level, when using multi-step tasks.

Capabilities

Each BaseEnvironment implementation declares an EnvironmentCapabilities model describing what it can do. The following capabilities govern network policy enforcement:
¹ Single-container tasks only (not in Docker Compose mode).
² Docker Compose (multi-container) tasks only.
³ Docker and Podman support requires Linux containers; Windows containers do not support this network policy mode.
⁴ Docker and Podman support requires Linux containers and local runtime support for the nftables kernel features used by Harbor’s egress-control sidecar.
⁵ Beam resolves concrete hostnames to IP CIDRs before applying the policy; wildcard host entries are not supported.
⁶ TensorLake allowlists accept exact hostnames, leading-wildcard hostnames (SDK 0.5.110+; a wildcard matches subdomains at any depth but not the apex domain), IPv4 literals, and IPv4 CIDR ranges, but not IPv6 targets.
⁷ Vercel allowlists are available for single-container tasks only. They match domain rules on the TLS SNI, accept exact and leading-wildcard hostnames but not IP literals or CIDR ranges, and deny plain-text HTTP to an allowlisted host. The policy applies from sandbox creation and can be updated on a running sandbox. Compose tasks support public and no-network only.
⁸ Islo supports dynamic network policy only when no custom gateway profile or gateway configuration is supplied.
If a task requests a network mode the environment does not declare a capability for, Harbor rejects the trial at validation time rather than running with a weaker policy.

Why phases?

Often, task authors want to enforce different network policies for the agent (or verifier), but do not want those policies enforced when setting up an agent in the environment. For example, you may want to be able to install Claude Code into the environment but then turn off all network access except for Anthropic’s API during the rollout.

Support

Environment implementations declare whether they support network policy configuration at start time and during runtime. Configuration at start time is more widely supported than during runtime, however, support is growing for both.