Agent Vault agents follow a standard HTTP protocol to interact with the server. Agents handle this automatically — the instructions are embedded in every invite response and in the agent skill files. This page is a reference for understanding what happens under the hood.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.
Bearer token
Every request an agent makes to Agent Vault requires a bearer token. How the agent gets one depends on how it connects:| Method | How the agent gets a token |
|---|---|
agent-vault vault run | Agent Vault sets AGENT_VAULT_SESSION_TOKEN on the child process automatically |
| Agent invite | Agent calls POST {invite_url} and receives an agent token |
| Variable | Description |
|---|---|
AGENT_VAULT_ADDR | Base URL of the Agent Vault server (e.g. http://127.0.0.1:14321) |
AGENT_VAULT_SESSION_TOKEN | Bearer token for all Agent Vault requests |
Session types
There are two session types:- Vault-scoped sessions — created by
agent-vault vault run. The vault is embedded in the session. No extra headers needed. - Instance-level agent tokens — created via agent invites. The agent must include an
X-Vaultheader on every vault-scoped request to select which vault to use.
The X-Vault header
Instance-level agent tokens must includeX-Vault: {vault_name} on all vault-scoped requests (discover, proposals, credentials):
agent-vault vault run do not need this header — the vault is embedded in the session token.
Discover services
Before making any proxied request, the agent calls/discover to learn which hosts have credentials configured in the vault.
The
X-Vault header is required for instance-level agent tokens. Vault-scoped sessions (from vault run) can omit it.Response
serviceslists the hosts the agent can reach through Agent Vault (defined by the vault’s services). Requests to any other host go direct.available_credentialslists credential key names in the vault (values are never exposed). Agents use these to avoid creating duplicate slots in proposals.proxy_urlis the fallback endpoint for clients that can’t honorHTTPS_PROXY. See Explicit proxy endpoint.
Route requests through HTTPS_PROXY
The canonical way for an agent to reach an upstream host is to call the real URL directly.agent-vault vault run pre-configures HTTPS_PROXY and the CA trust chain on the child process, so every standard HTTP client — curl, fetch, requests, axios, the Go stdlib, SDKs like stripe-node, CLIs like gh and stripe — transparently routes through the broker. Agent Vault intercepts the CONNECT, matches the target host against the vault’s services, and injects the stored credential into the auth header for that service. Other client headers (vendor headers like anthropic-version, tracing IDs, etc.) flow through unchanged — see Header forwarding for the precise rules.
Authorization header. No credential in the code.
Environment set by vault run
| Variable | Purpose |
|---|---|
HTTPS_PROXY | Points at the MITM listener (http://{token}:{vault}@host:14322) |
NO_PROXY | localhost,127.0.0.1 — so agent-to-vault traffic skips the proxy |
NODE_USE_ENV_PROXY | 1 — enables Node.js v22.21+ built-in HTTPS_PROXY support for fetch() and https.get() |
SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO, DENO_CERT | Point standard HTTP libraries at the Agent Vault root CA so the proxied TLS handshake validates |
Explicit proxy endpoint (fallback)
For clients that can’t honorHTTPS_PROXY — HTTP/2-terminating edges, constrained runtimes, sandboxes without CA-mounting — Agent Vault exposes an explicit endpoint:
Authorization header, attaches credentials from the vault’s services, forwards over HTTPS.
Propose changes
When an agent needs access to a service that is not in the vault’s services, it creates a proposal. Each proposal bundles services (host access) and credential slots (credentials the human provides at approval time).approval_url that the agent presents to the user:
Response (201)
GET /v1/proposals/{id} until the status changes from pending (every 3s for the first 30s, then every 10s). Once applied, the agent retries its original request.
See Proposals for the full proposal lifecycle, including storing credentials back and removing access.
Error handling
| Status | Meaning | What the agent does |
|---|---|---|
| 401 | Invalid or expired token | Re-check AGENT_VAULT_SESSION_TOKEN. Contact operator for a new token or rotation. |
403 forbidden | Host not allowed | Create a proposal to request access. The response includes a proposal_hint. |
403 service_disabled | Host is configured but disabled | Surface to the user — don’t create a duplicate proposal. |
| 429 | Rate limited | Respect the Retry-After header. The MITM and /proxy paths share one budget. |
| 502 | Missing credential or upstream unreachable | Tell the user a credential may need to be added. |
Security constraints
- Never extract, log, or display credential values
- Never hardcode tokens. Always read from
AGENT_VAULT_SESSION_TOKEN. - Only reach hosts returned by
/discover. For unlisted hosts, create a proposal. - If a
credential_not_founderror occurs, inform the user which key is missing.