Skip to content

Guarded egress and secrets

Keep an environment's internet to an allowlist, and give it API keys it never holds.

A guarded environment is on a host-only network. Its only way out is Regent’s proxy on this Mac, which allows the hosts on its list and refuses the rest.

regent create sandbox --egress guarded
regent create sandbox --egress guarded --allow 'api.stripe.com,*.example.com'

The default list covers what agents and builds usually need: Anthropic and OpenAI APIs, GitHub, npm, PyPI, Debian, Go modules, uv and mise, and Tailscale.

Change the list

Changes apply at once, without a restart:

regent egress ls                          # guarded environments and their hosts
regent egress allow sandbox api.stripe.com
regent egress deny sandbox api.stripe.com
regent egress log sandbox                 # what it connected to, allowed and refused

Secrets

A secret is an API key the environment sees only as a placeholder. The proxy swaps in the real value on requests to the secret’s hosts, so an agent can use the key without being able to read it.

regent secret set anthropic --env ANTHROPIC_API_KEY --host api.anthropic.com
regent create sandbox --egress guarded --secret anthropic

secret set asks for the value and keeps it in the macOS Keychain. --ref stores a reference instead (op://..., keychain:SERVICE/ACCOUNT, file:PATH, env:NAME). regent secret ls shows names and hosts, never values.

Type to search…

↑↓ navigate↵ selectEsc close