Skip to content

Egress proxy

The egress proxy limits which hosts a tool can reach and logs every attempt. Use it on projects you don't fully trust, to keep the agent from sending data anywhere it likes. It can also hold API keys for the tool: see Credential injection.

Usage

agentic run --proxy claude           # block hosts not on the allowlist
agentic run --proxy-monitor claude   # log only, block nothing
agentic run --no-proxy claude        # turn off a proxy enabled in config

Or per project, with the keys in [run.proxy]:

[run.proxy]
enabled = true
allowed_hosts = ["registry.npmjs.org", ".github.com"]

With the proxy on, the tool has no direct internet access. agentic sets HTTP_PROXY/HTTPS_PROXY (and lowercase), plus NODE_USE_ENV_PROXY=1 so Node 22.21+ and 24.5+ use them too. The proxy image builds on first use; agentic proxy update rebuilds it.

Allowlist

Each tool allows these hosts by default, and allowed_hosts adds to them. agentic config shows the resolved settings, apart from this baseline.

Tool Baseline host Purpose
claude .anthropic.com Claude API and telemetry subdomains
claude .claude.ai installer and asset downloads
claude .claude.com OAuth/login flow and docs
copilot .githubcopilot.com Copilot API and subdomains
copilot api.github.com GitHub API used for authentication
copilot docs.github.com Copilot CLI docs
opencode opencode.ai OpenCode auth, update checks, docs

OpenCode supports many model providers, so add your provider's hosts, e.g. allowed_hosts = ["api.openai.com"].

Monitor mode

--proxy-monitor (or mode = "monitor") never blocks. To find what a tool needs:

  1. Run with --proxy-monitor and use the tool as usual.
  2. At the end, the run lists the hosts and paths that would have been blocked.
  3. Add the ones you trust to allowed_hosts or allowed_paths.
  4. Switch to --proxy.

Path rules

[[run.proxy.allowed_paths]] allows a host only on some paths, e.g. one repo on raw.githubusercontent.com:

[[run.proxy.allowed_paths]]
host = "raw.githubusercontent.com"
paths = [
  "/anthropics/claude-code/*/*/main/CHANGELOG.md", # refs/heads/main
  "/dylanvgils/agentic-cli/**",
]

A pattern matches the whole path, not the query: a literal segment exactly, * one segment, and a final ** everything below, including nothing.

  • A rule limits its host even when allowed_hosts, a wildcard or the tool's baseline allows it whole. A rule for a baseline host like api.anthropic.com limits the tool too.
  • The proxy decrypts the host's HTTPS to read the path, with the same CA trust as credential hosts. Tools that pin certificates fail.
  • Other paths get a 403, logged as path-blocked. So do paths an upstream may read differently: %2F, %5C, %2E, %25, %3B, ;, \, non-printable ASCII, or a segment that is ., .. or ends in a dot or space. This also blocks npm's scoped packages (/@scope%2Fname).
  • Only WebSocket upgrades reach the host; others, such as h2c, are dropped.
  • Credentials are only injected on the allowed paths.

Local and private addresses

The proxy checks the IP an allowed host resolves to, also in monitor mode, so a DNS record can't point it at your machine or network. A refused attempt gets a 403 and is logged as blocked-address.

  • Always refused: loopback, link-local (incl. the 169.254.169.254 cloud metadata address), unspecified, multicast and reserved (240/4) addresses, Teredo, SIIT and local-use NAT64 addresses, and the AWS, Azure and Alibaba metadata endpoints.
  • Refused for wildcard entries: private ranges (10/8, 172.16/12, 192.168/16, 100.64/10, 198.18/15, fc00::/7). List internal hosts exactly, e.g. "artifactory.corp.example".
  • NAT64 and 6to4 addresses are checked by the IPv4 address inside them.

Tools that ignore proxy env vars

Some tools need a literal host:port in their own config. Use agentic-proxy:3128, which is the same on every run. Don't point a tool at an external corporate proxy, as that traffic skips the allowlist.

agentic configures Maven and Gradle for you when you list them in integrations, or for one run with --proxy-integration maven,gradle:

[run.proxy]
enabled = true
integrations = ["maven", "gradle"]
allowed_hosts = ["repo.maven.apache.org"]

Also allow the other hosts your build downloads from, such as the Gradle wrapper and plugin portal; monitor mode lists them.

  • Maven needs the java base and Maven 3.9+, directly or through mvnw. Your ~/.m2/settings.xml and MAVEN_ARGS still apply.
  • Gradle works through gradlew and the daemon. Set daemon memory with org.gradle.jvmargs in gradle.properties, as GRADLE_OPTS is reserved.

With microsandbox

With the microsandbox runtime, msb's own network rules enforce the allowlist by default. Set backend = "agentic" (or --proxy-backend agentic) to use agentic-proxy instead. Docker runs always use agentic-proxy.

msb rules (default) agentic-proxy
Access log, summary, monitor mode No Yes
Path rules Not enforced: the host, and its credentials, are allowed on every path, with a warning Yes
Credentials Injected by msb Injected by the proxy
Proxy env vars, integrations Not set, not needed Yes, with a per-run token
Reachable DNS and allowed hosts on ports 80 and 443 Only the proxy, no DNS
  • msb rules inspect all HTTPS, so the tool must trust msb's CA (curl, git, Bun and Java do) and tools that pin certificates fail. Internal hosts that resolve to a private address aren't reachable. allowed_hosts entries must be hostnames.
  • agentic-proxy runs on your local Docker (the Docker context must be on this machine) on a random 127.0.0.1 port. Anyone who can read the run's environment can use the proxy token while the run lasts. With --dind, pulls, builds and containers in the VM go through the proxy, except under run -- <cmd>.

Access log

Blocked hosts are printed at the end of the run. Every attempt is logged as JSON lines in proxy.jsonl in the run's log dir, with "decision" allow or deny. Monitor mode logs the real decision, tagged "enforced": false.

  • "upstream_connect_ms" and "dns_ms": a tunnel's connect and DNS time, to tell a slow upstream from a slow tool.
  • "handshake_ms": a decrypted tunnel's TLS handshake time with the tool.
  • "event": "close": a tunnel's closing line, with "duration_ms", and for an undecrypted tunnel "bytes_sent", "bytes_received" and "closed_by".
  • Decrypted hosts log "intercepted": true. With credentials, a tunnel is logged allowed first, then each refused request gets its own deny line.

Failed requests get a "reason", with the cause in "error":

Reason Tool sees When
upstream-failed 502 The upstream host fails. "error" can name resolved IPs the tool shouldn't see.
proxy-failed 500 The proxy itself fails, e.g. on a TLS handshake the tool rejects.
client-closed - The tool hung up before the response. Harmless when it races connections.
path-blocked 403 No path rule allows the "path".
blocked-address 403 The host resolves to a refused address.
sni-mismatch Closed tunnel The tunnel's TLS server name isn't the host it asked for, or it isn't TLS (e.g. SSH through CONNECT). Plain HTTP works through HTTP_PROXY.

Limits

  • The proxy filters by host and path, not content: data can still go to any allowed host.
  • See Leftover risk for domain fronting and DNS leaks on other engines.