This guide walks through connecting a custom agent to Agent Vault. Use this when you’re building your own sandboxed agent, a CI pipeline, or any process that needs to make authenticated API calls through Agent Vault.Documentation Index
Fetch the complete documentation index at: https://docs.agent-vault.dev/llms.txt
Use this file to discover all available pages before exploring further.
If you’re using Claude Code, Cursor, or another supported agent, see the Quickstart guides instead. Those agents handle the connection protocol automatically.
Prerequisites
- A running Agent Vault server with the transparent proxy enabled (default)
- A user account with vault access (member or admin)
Get connection credentials
- vault run (simplest)
- Agent invite
For local development, wrap your agent process directly:
vault run sets AGENT_VAULT_ADDR, AGENT_VAULT_SESSION_TOKEN, and AGENT_VAULT_VAULT on the child, then pre-configures HTTPS_PROXY and the CA trust chain so standard HTTP clients transparently route through the broker. No invite needed.Environment variables
Your agent needs these values to operate:| Variable | Required | Description |
|---|---|---|
AGENT_VAULT_ADDR | Yes | Base URL of the Agent Vault server (e.g. http://127.0.0.1:14321) |
AGENT_VAULT_SESSION_TOKEN | Yes | Bearer token for authenticating control-plane requests (/discover, proposals) |
X-Vault header on every vault-scoped request. For vault-scoped sessions (from vault run), the vault is embedded in the session.
When the agent is launched via vault run, these additional variables are also set automatically on the child:
| Variable | Purpose |
|---|---|
HTTPS_PROXY | Routes HTTPS traffic through the transparent proxy |
NO_PROXY | localhost,127.0.0.1 — so agent-to-vault traffic skips the proxy |
NODE_USE_ENV_PROXY | Enables Node.js 22.21+ built-in proxy support |
SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO, DENO_CERT | Trust the Agent Vault root CA from standard HTTP libraries |
Make requests
When your agent is launched viavault run, HTTPS traffic already routes through Agent Vault transparently. Call the real API URL — standard HTTP clients honor HTTPS_PROXY automatically. Agent Vault intercepts the CONNECT, matches the host against the vault’s services, and injects the stored credential into the auth header for that service over HTTPS.
Set HTTPS_PROXY manually
If your agent wasn’t launched viavault run (e.g. an invited agent, a Docker container, a sandboxed runtime), configure the proxy yourself. The MITM listener is TLS-encrypted, so the proxy URL uses the https:// scheme and needs the root CA trusted.
buildProxyEnv(), which returns the complete environment block from a session’s containerConfig.
Explicit proxy endpoint (fallback)
For clients that can’t honorHTTPS_PROXY — HTTP/2-only runtimes, sandboxes without CA-mounting, or minimal environments — Agent Vault exposes an explicit endpoint. Rewrite the upstream URL to:
X-Vault: {vault_name}.
Discover available services
Your agent can call/discover to check which hosts have credentials configured before making requests.
Response
serviceslists the hosts configured in the vault. Requests to unlisted hosts go direct.available_credentialslists credential key names in the vault (values are never exposed).proxy_urlis the explicit endpoint fallback.
Handle errors
| Status | Meaning | What to do |
|---|---|---|
| 401 | Invalid or expired token | Re-authenticate. Contact the operator for a token rotation. |
| 403 | Host not allowed | Create a proposal to request access, or ask the vault admin to add it. |
| 429 | Too many requests | Respect the Retry-After header. |
| 502 | Missing credential or upstream error | A credential may need to be added to the vault. |
Next steps
Agent protocol
Full HTTP reference for sessions, discovery, and proposals.
Proposals
Request access to new services via the proposal API.
Credentials
Managing secrets in Agent Vault.
Agents overview
Agent lifecycle, vault access, and management.