docs/cli/commands/agent-proxy.mdx
# Example
infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- claude
```
`run` on its own is the whole setup.
# On each agent host
infisical secrets agent-proxy connect [options] -- [agent start command]
# Examples
infisical secrets agent-proxy start --port 17322
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --projectId=<project-id> --env=prod --path=/ai-agents -- claude
```
`start` and `connect` work as a pair, on different hosts.
These subcommands run the Infisical Agent Proxy, which brokers real credentials onto your agents' traffic on the wire. Which you use depends on where the agent runs:
run is for an agent on your own computer. It does the proxy's work and the agent's launch in one process, authenticating as your logged-in user, and sandboxes the agent. It always starts its own proxy, so --proxy is rejected rather than ignored. See Local Agent Proxy.start runs the proxy as a long-running service on a host of its own, serving agents across your network.connect launches an agent behind a proxy already running elsewhere, setting up proxy routing, CA trust, and placeholder credentials. It needs a proxy address, which is why it goes with start. Both authenticate with a machine identity via Universal Auth, and the proxy's is always separate from your agents'; see Standalone Agent Proxy.Each arrangement stands on its own: run is complete by itself, and a deployed proxy pairs only with connect. All three read the same proxied services and secrets from Infisical.
Because the proxy and the agent share a machine, the sandbox is the boundary: the agent cannot read your keyring, your credential files, or the proxy's CA key, and its only route to the network is the proxy. Real secret values are never placed in the agent's environment, and it gets no Infisical token, only proxy routing, CA trust, and the placeholders for secret-substitution services.
Requires macOS, or Linux with bubblewrap installed; see Requirements for the per-distribution command. Where no OS sandbox is available, run refuses to start unless you pass --no-sandbox.
$ infisical secrets agent-proxy run --projectId=<project-id> --env=<env-slug> --path=<secret-path> -- [agent start command]
# Example
$ infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- claude
# Example (project, environment, and path from .infisical.json)
$ infisical secrets agent-proxy run -- claude
```bash
# Example
export INFISICAL_PROJECT_ID=<project-id>
export INFISICAL_ENVIRONMENT=dev
export INFISICAL_SECRET_PATH=/coding-agent
```
```bash
# Example
export INFISICAL_AGENT_PROXY_SANDBOX=0
```
```bash
# Example
export INFISICAL_DOMAIN=https://eu.infisical.com
```
```bash
# Example
infisical secrets agent-proxy run --env=dev -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --path=/coding-agent -- claude
```
Default value: `/`
```bash
# Example
infisical secrets agent-proxy run --env=dev --projectId=<project-id> -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --token=<token> -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --no-sandbox -- claude
```
Default value: `--sandbox` (the sandbox is on)
```bash
# Example
infisical secrets agent-proxy run --env=dev --allow-read ~/.aws/config -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --allow-write ~/scratch -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --unmatched-host=block --allow-host=registry.npmjs.org -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --pass-env ANTHROPIC_API_KEY -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --set-env GH_CONFIG_DIR=/tmp/gh-cfg -- claude
```
```bash
# Example
infisical secrets agent-proxy run --env=dev --unmatched-host=block -- claude
```
Default value: `allow`
```bash
# Example
infisical secrets agent-proxy run --env=dev --poll-interval 30 -- claude
```
Default value: `60`
```bash
# Example
infisical secrets agent-proxy run --env=dev --log-file=/tmp/broker.log -- claude
```
These two are used together, on different hosts: start on the proxy host, connect on each agent host.
Agents reach HTTPS services through standard CONNECT tunnels and plain-HTTP services through regular forward-proxy requests; credentials are brokered on both. Requests for https:// URLs sent as plain forward-proxy requests (rather than CONNECT) are rejected so the proxy can never be used to downgrade TLS.
$ infisical secrets agent-proxy start
# Example
$ infisical secrets agent-proxy start --port 17322 --unmatched-host=block
```bash
# Example
export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>
export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>
```
```bash
# Example
export INFISICAL_DOMAIN=https://eu.infisical.com
```
```bash
# Example
infisical secrets agent-proxy start --port 18000
```
Default value: `17322`
```bash
# Example
infisical secrets agent-proxy start --unmatched-host=block
```
Default value: `allow`
<Note>
`block` blocks every host without a matching proxied service, including your Infisical instance itself. Since agent traffic routes through the proxy, Infisical CLI commands run from inside the agent (using the `INFISICAL_TOKEN` from its environment) will also be rejected in this mode.
</Note>
```bash
# Example
infisical secrets agent-proxy start --poll-interval 30
```
Default value: `60`
```bash
# Example
infisical secrets agent-proxy start --client-id=<client-id> --client-secret=<client-secret>
```
```bash
# Example
infisical secrets agent-proxy start --log-format=json
```
Default value: `console`
```bash
# Example
infisical secrets agent-proxy start --log-file=/var/log/infisical/agent-proxy.log
```
```bash
# Example
infisical secrets agent-proxy start --log-level=warn
```
Default value: `info`
HTTPS_PROXY / HTTP_PROXY pointing at the agent proxy, plus NO_PROXY (always includes localhost,127.0.0.1, merged with any NO_PROXY already in your environment and the --no-proxy flag).~/.infisical/agent-proxy/mitm-ca.pem and trusted via SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO, and DENO_CERT.infisical run). This is opt-in; an agent identity scoped to just the proxy permission has no read access, and brokered credentials never appear in the agent's environment. If the agent can read a secret that a proxied service brokers to it, connect refuses to start, since the agent would receive the real value directly and bypass the proxy; fix the permissions or pass --allow-readable-brokered-secrets to override.INFISICAL_TOKEN set to the agent's access token, so the agent can run Infisical CLI commands itself.The client ID and client secret used to authenticate are stripped from the child environment. The wrapper forwards signals to the agent process and exits with its exit code.
<Note> Every input below resolves from the same sources, in order: **the flag → an environment variable → `.infisical.json` → the built-in default.** An explicitly-passed flag always wins. This is why, where the environment variables are already set on the host, the command collapses to `infisical secrets agent-proxy connect -- claude`. </Note>$ infisical secrets agent-proxy connect --proxy=<host>:<port> --projectId=<project-id> --env=<env-slug> -- [agent start command]
# With flags
$ infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --projectId=<project-id> --env=prod --path=/ai-agents -- claude
# With configuration from environment variables (see below) or .infisical.json
$ infisical secrets agent-proxy connect -- claude
```bash
# Example
export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-client-id>
export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-client-secret>
```
```bash
# Example
export INFISICAL_PROJECT_ID=<project-id>
```
```bash
# Example
export INFISICAL_ENVIRONMENT=prod
```
```bash
# Example
export INFISICAL_SECRET_PATH=/ai-agents
```
```bash
# Example
export INFISICAL_AGENT_PROXY_ADDRESS=<proxy-host>:17322
```
```bash
# Example
export INFISICAL_DOMAIN=https://eu.infisical.com
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod -- claude
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=staging -- codex
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod --path=/ai-agents -- claude
```
Default value: `/`
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod --no-proxy=internal.corp.com -- claude
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod --projectId=<project-id> -- claude
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod --client-id=<client-id> --client-secret=<client-secret> -- claude
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod --token=<access-token> -- claude
```
```bash
# Example
infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --env=prod --allow-readable-brokered-secrets -- claude
```
Default value: `false`
```bash
# Example
infisical secrets agent-proxy start --domain=https://your-instance.com
```
Default value: `https://app.infisical.com`