Architecture
Every Agent Vault setup has an orchestrator that creates a session and starts the agent. Then, the agent sends every request through the proxy:Orchestrators
An orchestrator is the program (or person) that creates a session and starts an agent with the session token. Agent Vault works with any orchestrator, such as:- Your own service: a backend service uses the Infisical API to create a session and starts an agent for each task. It can call the API directly or through the Python SDK or Node.js SDK. For example: a Slack bot that starts an agent in a new sandbox for each message, an internal coding agent that picks up tickets, or a product feature that starts an agent when a customer asks for something
- A scheduled job: a cron job or CI pipeline uses the Infisical CLI to create a session and starts the agent. For example: an agent that labels new issues every hour
- You: a person who creates a session in the Infisical dashboard and starts an agent with the session token. For example: a coding agent on a dev box, or an assistant on a home server
Session duration
How long each session lasts is up to you. A session lasts until it expires or the orchestrator revokes it, so it can last:- Until the agent finishes a task, with the orchestrator revoking the session when the task ends
- For a fixed amount of time that you set when you create the session
- With no expiry, until someone revokes it
An agent keeps its access until its session expires or you revoke it. If a session token leaks, anyone with the token has the same access until then. Revoke the session when the agent no longer needs it, or if you think the token leaked.
Agent environment
The agent can run anywhere: a Kubernetes pod, a Docker container, a managed sandbox such as Modal or Daytona, or a VM, such as an Amazon EC2 instance. Wherever it runs, we recommend that:- The proxy runs separately from the agent, such as in its own container, so the agent can’t read the proxy token
- The agent’s network only reaches the proxy, so the agent can’t skip the proxy and connect to an API directly
Proxy placement
You can run one proxy for several agents, or give each agent its own proxy, depending on where your agents run.Common proxy
In this setup, one proxy runs on its own machine (or as a Kubernetes Deployment), and every agent sends its requests to that proxy. Agents send their session token to the proxy over plain HTTP, so use this setup only if your agents and the proxy share a private network, such as your own servers, a Kubernetes cluster, or self-hosted CI runners.One proxy per agent
When the orchestrator creates a sandbox or container for a task, it also starts a proxy in a separate container, on a private network that only the agent and its proxy share. When the task ends, the orchestrator deletes both. Only the agent can reach its proxy, so nothing outside the task can send requests through it.On a managed sandbox platform like Modal or Daytona, each sandboxed agent needs its own proxy.If each sandboxed agent shared the same proxy, that proxy would need to be exposed to the internet. Since session tokens are sent to the proxy over plain HTTP, this would create a security vulnerability: anyone who gained access to the session token could then use the proxy to make authenticated requests from anywhere.
- Modal: a sidecar in the agent’s sandbox (see the Modal guide)
- Daytona: a linked sandbox (see the Daytona guide)
- Docker: a second container in each run’s Docker Compose project (see the Docker guide)
Access model
Agent Vault uses four primitives to create secure sessions for AI agents:- Services: The APIs, MCP servers, and anything else the agent talks to, with any credentials to add
- Access bundles: Groups of services, granted as a unit
- Sessions: Time-bound access grants that an agent uses to authenticate to the proxy for the services in an access bundle
- Proxies: The forward proxy that intercepts an agent’s outbound traffic and attaches real credentials to authorized requests
1
The access bundle groups the services (external APIs or MCP servers) you want your agent to reach.
2
The orchestrator creates a session for the bundle. Infisical returns a session token scoped to that bundle until the session expires or is revoked.
3
The orchestrator starts the agent with the session token, and the agent uses the token to authenticate to the Agent Vault proxy on every outbound request.
4
Every outbound request goes through the proxy, with the session token attached as the proxy credential.
5
The proxy reads the matching service’s credential from the access bundle, attaches the credential, and forwards the request to the upstream host.
Concepts
Services
A service represents one external system that an agent can reach, such as GitHub’s REST API or Linear’s MCP server. Each service holds:- Target: Where the system is, such as the host
api.github.comor the server URLhttps://mcp.linear.app/mcp - Credential: The real token, username and password, or OAuth authorization that the proxy attaches to the agent’s requests, if the service uses one
- Rules (HTTP APIs): The HTTP methods and paths the service allows
- Custom headers: Extra headers the proxy adds to each request
- Substitutions (HTTP APIs): Placeholders the proxy replaces with real values
Services
Anything an AI agent talks to during a session, such as an API or an MCP server.
Access bundles
An access bundle groups a set of services under one name. A code-review bundle might hold services for GitHub, Slack, and Anthropic. An on-call bundle might hold services for PagerDuty, Datadog, and Slack. You grant a bundle to a user, group, or machine identity. Anyone with that grant can create sessions that reference it.Access bundles
Lists of services that AI agents can access during a session.
Sessions
A session is a time-bound access grant that’s scoped to one access bundle. Infisical returns a session token that identifies the session; the agent uses that token to authenticate to the Agent Vault proxy on every outbound request. When the orchestrator creates a session, it picks one access bundle and sets when the session expires. The agent never sees the real credentials inside the bundle. All it has is the session token, which the proxy only accepts while the session is live. Even if an attacker stole the session token, they could only reach the hosts, methods, and paths that the access bundle’s services allow, and only until the session expires or you revoke it.Sessions
Time-bound grants that let AI agents access services without holding real credentials.
Proxies
A proxy runs outside the agent’s environment. It intercepts every outbound request, authorizes the request against the session’s access bundle, attaches the matching service’s credential, and forwards the request to the upstream host. The proxy attaches the credential as a header, or replaces a placeholder that the agent sent in the headers, path, or query string. If the request breaks the matching service’s method or path rules, the proxy refuses it instead.Proxies
Forward proxies that intercept an AI agent’s requests and attach real credentials on the way out.
Example flows
GitHub API
Here’s what happens when an agent callsapi.github.com through an Agent Vault session:
- The agent’s HTTPS client routes the request through the proxy (because the
HTTPS_PROXYenvironment variable points at it), including the session token as the proxy credential. - The proxy answers the agent with a certificate for
api.github.comthat the proxy’s certificate authority signed. The agent accepts the certificate becauseinfisical agent-vault runadded that certificate authority to the agent’s trusted certificates, so the proxy can read the request. - The proxy looks up the session with Infisical, checking if it’s still live and which access bundle it carries.
- The proxy looks inside the session’s access bundle and finds a service whose host pattern covers
api.github.com. If the service limits methods or paths, the proxy refuses a request that doesn’t match them. The proxy reads the real GitHub token from that service. - The proxy opens a new HTTPS connection to
api.github.com, attaches the real token in the authorization header, and forwards the request. - GitHub responds. The proxy pipes the response back to the agent.
If the agent asks for a host that isn’t covered by any service in the access bundle (like
api.internal.example.com), the proxy either forwards the request without credentials or refuses it outright, depending on its traffic policy.Linear MCP server
Here’s what happens when an agent calls a tool on Linear’s MCP server through an Agent Vault session. You add the server to the agent by its real URL,https://mcp.linear.app/mcp, the same way you would without Agent Vault, but without a token and without signing in from the agent:
- The agent’s MCP client sends the tool call to
mcp.linear.appthrough the proxy, with the session token as the proxy credential. - The proxy finds the MCP service in the session’s access bundle that covers
mcp.linear.app, and reads the credential that Infisical stores for it, such as an OAuth access token or a Bearer token. - The proxy records the tool’s name for the session log, attaches the credential, and forwards the request.
- Linear responds, and the proxy pipes the response back to the agent.
Why no code changes are needed
Agent Vault uses theHTTPS_PROXY environment variable, which curl, git, gh, Python’s requests, and most SDKs already read. Any HTTP client that reads it sends its requests through the proxy without code changes.
infisical agent-vault run sets HTTPS_PROXY for the agent, trusts the proxy’s certificate authority, and passes the session token as the proxy credential.
The same applies to MCP servers. Your agent’s MCP configuration keeps each server’s real URL and has no token, and the proxy authenticates the agent’s requests to the server.
Some sandbox providers, such as E2B, can send a sandbox’s HTTP and HTTPS traffic to the proxy over SOCKS5 instead, so the agent doesn’t need HTTPS_PROXY.
Node.js’s built-in
fetch (undici-backed) doesn’t read HTTPS_PROXY by default. If your agent uses it directly, run Node with --use-env-proxy or set NODE_USE_ENV_PROXY=1 (Node 24 or later). Third-party clients like axios, node-fetch, and got read the environment variable without extra flags.