Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs(agent-vault): add programmatic guides (#8524)

Adrian Kahalid0a805665106
diff --git a/docs/docs.json b/docs/docs.json
index 19de4b7acd..96fd303815 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -810,7 +810,8 @@
"pages": [
"documentation/platform/agent-vault/guides/openclaw-gateway"
]
- }
+ },
+ "documentation/platform/agent-vault/guides/custom-agent"
]
},
{
@@ -823,6 +824,8 @@
"group": "Sessions",
"root": "documentation/platform/agent-vault/sessions",
"pages": [
+ "documentation/platform/agent-vault/sessions-cli",
+ "documentation/platform/agent-vault/sessions-api",
"documentation/platform/agent-vault/session-logs"
]
},
diff --git a/docs/documentation/platform/agent-vault/guides/custom-agent.mdx b/docs/documentation/platform/agent-vault/guides/custom-agent.mdx
new file mode 100644
index 0000000000..c41730807b
--- /dev/null
+++ b/docs/documentation/platform/agent-vault/guides/custom-agent.mdx
@@ -0,0 +1,275 @@
+---
+title: "Connect your own agent to Agent Vault"
+sidebarTitle: "Your own agent"
+description: "Launch your custom agent with Agent Vault so it can make authenticated API calls without needing an actual token."
+---
+
+import SeparateMachinesNote from "/snippets/agent-vault/SeparateMachinesNote.mdx";
+
+If you have a custom agent harness that you start from code rather than a CLI, you can connect it to Agent Vault via the Infisical API. The agent's HTTP client sends each request through an Agent Vault [proxy](/documentation/platform/agent-vault/proxies) with a [session](/documentation/platform/agent-vault/sessions) token, and the proxy attaches the real credential before forwarding the request to the API.
+
+## Prerequisites
+
+- An Infisical organization where you're an [Agent Vault admin](/documentation/platform/agent-vault/access-control#product-membership)
+- The [Infisical CLI](/cli/install) installed on the machine that will run the proxy
+- The API keys your agent uses, such as its model provider's key
+
+<SeparateMachinesNote />
+
+## Step 1: Set up Agent Vault
+
+### Create an access bundle
+
+First, create an [access bundle](/documentation/platform/agent-vault/access-bundles) that holds a [service](/documentation/platform/agent-vault/services) for each API your agent calls.
+
+<Steps>
+ <Step>
+ In Infisical, open **Agent Vault** from the product switcher and go to **Access Bundles**.
+ </Step>
+ <Step>
+ Select **Create Access Bundle**. Give the access bundle a **Name**, such as `my-agent`, then select **Create Access Bundle**.
+ </Step>
+ <Step>
+ Select the access bundle you just created, then select **Add Service**.
+ </Step>
+ <Step>
+ On the **Choose a template** panel, pick the template for the API, or select **Custom** and enter the API's host.
+ </Step>
+ <Step>
+ On the **Credential** step, paste the real API key.
+
+ <Note>
+ If the API expects the key somewhere other than a header, such as in the URL, [add a substitution](/documentation/platform/agent-vault/services#add-a-substitution) instead. Note the placeholder you enter in **Replace**, because your agent sends it in [Step 3](#step-3-replace-the-api-keys-with-placeholders).
+ </Note>
+ </Step>
+ <Step>
+ Select **Add Service**. Repeat from the third step for each remaining API.
+ </Step>
+</Steps>
+
+### Enroll a proxy
+
+Next, enroll a proxy. Every request your agent makes goes through the proxy, which attaches the real credential from the access bundle before forwarding the request to the API.
+
+<Steps>
+ <Step>
+ Go to **Proxies** and select **Create Proxy**.
+ </Step>
+ <Step>
+ Give the proxy a **Name**, then select **Create**.
+ </Step>
+ <Step>
+ In the **Enrollment Token** dialog, copy the command from the **CLI** tab, or from the **Docker** or **systemd** tab to keep the proxy running after you close the terminal. The enrollment token expires in an hour.
+ </Step>
+ <Step>
+ Run the command on the machine that will run the proxy.
+ </Step>
+</Steps>
+
+The proxy listens on port `17323`. Make sure the agent's machine can reach that port, and note the proxy machine's address.
+
+### Create a session
+
+Finally, create a session. The session token is the only credential your agent has.
+
+<Steps>
+ <Step>
+ Go to **Sessions** and select **Create Session**.
+ </Step>
+ <Step>
+ Pick the access bundle you created, set a duration under **Expires**, then select **Create Session**.
+ </Step>
+ <Step>
+ Copy the session token from the command in the dialog. It's the value after `--session-token`. The token appears once and can't be retrieved again.
+ </Step>
+</Steps>
+
+<Tip>
+ You can also [create sessions from your own code](/documentation/platform/agent-vault/sessions-api) instead of in the Infisical UI.
+</Tip>
+
+## Step 2: Download the proxy's certificate
+
+The proxy decrypts each HTTPS request to attach the credential, so the agent has to trust the proxy's certificate authority. On the agent's machine, download the certificate from the proxy:
+
+```bash
+curl -fsS http://<proxy-host>:17323/_agent-vault/ca | jq -er .certificate > ca.pem
+```
+
+The certificate travels over plain HTTP, so check that it came from your proxy before you trust it. Print its fingerprint:
+
+```bash
+openssl x509 -in ca.pem -noout -fingerprint -sha256
+```
+
+Compare the colon-separated value with the proxy's fingerprint on the **Proxies** page in Agent Vault. The **Certificate Authority** column shows the start of the fingerprint, and hovering over it shows the full value. If the values don't match, don't use the file.
+
+Store `ca.pem` where the agent can read it. The certificate isn't secret, so you can add it to the agent's container image. If you [re-enroll the proxy](/documentation/platform/agent-vault/proxies#re-enroll-a-proxy), download the certificate again.
+
+## Step 3: Replace the API keys with placeholders
+
+Delete the real API keys from the agent's code and configuration. Most SDKs refuse to start without a key, so pass a placeholder value instead, such as `agent-vault`. The proxy replaces the placeholder with the real credential:
+
+- **If the service uses Bearer or Basic credentials:** the proxy replaces the header that carries the key, so any placeholder works
+- **If the service uses a [substitution](/documentation/platform/agent-vault/services#substitutions):** use the exact placeholder you entered in [Step 1](#create-an-access-bundle)
+
+## Step 4: Send requests through the proxy
+
+Set the proxy and the certificate in the agent's HTTP client. The proxy URL has the session token as its password:
+
+```text
+http://x-agent-vault:<session-token>@<proxy-host>:17323
+```
+
+<Tabs>
+ <Tab title="Environment variables">
+ Most HTTP clients read the proxy and the certificate from environment variables, so if you set these variables for the agent's process, you don't need to change its code:
+
+ ```bash
+ export HTTPS_PROXY=http://x-agent-vault:<session-token>@<proxy-host>:17323
+ export HTTP_PROXY=http://x-agent-vault:<session-token>@<proxy-host>:17323
+ export NO_PROXY=localhost,127.0.0.1
+ # Trust the proxy's certificate
+ export SSL_CERT_FILE=/path/to/ca.pem
+ export REQUESTS_CA_BUNDLE=/path/to/ca.pem
+ export NODE_EXTRA_CA_CERTS=/path/to/ca.pem
+ # Node.js 24 or later: make the built-in fetch read HTTPS_PROXY
+ export NODE_USE_ENV_PROXY=1
+ ```
+
+ Clients that read `SSL_CERT_FILE` or `REQUESTS_CA_BUNDLE` trust only the certificates in that file. If the agent calls an HTTPS host in `NO_PROXY`, add your system's certificates to `ca.pem`, such as with `cat /etc/ssl/certs/ca-certificates.crt >> ca.pem` on Debian or Ubuntu.
+ </Tab>
+ <Tab title="Python">
+ With the Anthropic SDK, pass a `DefaultHttpxClient` with the proxy and the certificate. The OpenAI SDK takes the same client, as `openai.DefaultHttpxClient`:
+
+ ```python
+ import ssl
+
+ import anthropic
+
+ PROXY_URL = "http://x-agent-vault:<session-token>@<proxy-host>:17323"
+
+ tls = ssl.create_default_context()
+ tls.load_verify_locations("/path/to/ca.pem")
+
+ client = anthropic.Anthropic(
+ api_key="agent-vault",
+ http_client=anthropic.DefaultHttpxClient(proxy=PROXY_URL, verify=tls),
+ )
+ ```
+
+ With [`requests`](https://requests.readthedocs.io/), set the proxy and the certificate on a session:
+
+ ```python
+ import requests
+
+ PROXY_URL = "http://x-agent-vault:<session-token>@<proxy-host>:17323"
+
+ session = requests.Session()
+ session.proxies = {"http": PROXY_URL, "https": PROXY_URL}
+ session.verify = "/path/to/ca.pem"
+ ```
+
+ Setting `session.verify` replaces the certificates that `requests` trusts, which works because every request from the session goes through the proxy.
+ </Tab>
+ <Tab title="Node.js">
+ With [`undici`](https://undici.nodejs.org/), pass a `ProxyAgent` as the dispatcher:
+
+ ```javascript
+ import { readFileSync } from "node:fs";
+ import { rootCertificates } from "node:tls";
+ import { ProxyAgent, fetch } from "undici";
+
+ const dispatcher = new ProxyAgent({
+ uri: "http://x-agent-vault:<session-token>@<proxy-host>:17323",
+ requestTls: {
+ ca: [...rootCertificates, readFileSync("/path/to/ca.pem", "utf8")],
+ },
+ });
+
+ const response = await fetch("https://api.github.com/user", { dispatcher });
+ ```
+
+ To use the dispatcher for every `fetch` call in the process, including calls inside SDKs, pass it to `setGlobalDispatcher` from `undici`.
+ </Tab>
+ <Tab title="Go">
+ Set the proxy and the certificate on the `http.Transport`:
+
+ ```go
+ caPEM, err := os.ReadFile("/path/to/ca.pem")
+ if err != nil {
+ log.Fatal(err)
+ }
+ roots, err := x509.SystemCertPool()
+ if err != nil {
+ log.Fatal(err)
+ }
+ roots.AppendCertsFromPEM(caPEM)
+
+ proxyURL, _ := url.Parse("http://x-agent-vault:<session-token>@<proxy-host>:17323")
+
+ client := &http.Client{
+ Transport: &http.Transport{
+ Proxy: http.ProxyURL(proxyURL),
+ TLSClientConfig: &tls.Config{RootCAs: roots},
+ },
+ }
+ ```
+ </Tab>
+</Tabs>
+
+Keep the session token out of logs. Anyone who can reach the proxy with the token can call every API in the session's access bundle until the session expires or you [revoke it](/documentation/platform/agent-vault/sessions#revoke-a-session).
+
+<Note>
+ The proxy only supports HTTP/1.1, so WebSocket connections and clients that only speak HTTP/2, such as gRPC clients, fail through the proxy. If an API offers both, configure the agent to use its plain HTTPS requests. Many SDKs fall back to HTTPS when a WebSocket connection fails.
+</Note>
+
+## Step 5: Verify it works
+
+Make a request from the agent to an API in the session's access bundle. For example, if the bundle has a GitHub service, request `https://api.github.com/user`. GitHub returns the account that the service's token belongs to, even though the agent doesn't have a GitHub token.
+
+If you've [set up session logs](/documentation/platform/agent-vault/session-logs#setting-up-session-logs), [view the session's logs](/documentation/platform/agent-vault/sessions#view-session-logs) to check which requests the agent made. Requests that got a credential have the outcome **Brokered**.
+
+<Check>
+ Your agent now calls APIs through the proxy. The only credential the agent has is the session token, and if you revoke the session, the proxy stops attaching credentials to the agent's requests.
+</Check>
+
+## Replace the session token
+
+The session token is part of the proxy URL, so when you give the agent a new session, create a new HTTP client with the new token. If the agent reads the environment variables, restart it with the new values.
+
+To replace sessions automatically, such as for a process that runs for days, [create sessions with the API](/documentation/platform/agent-vault/sessions-api#choose-how-long-a-session-lasts).
+
+## Troubleshooting
+
+<AccordionGroup>
+ <Accordion title="Requests fail with a 407 from the proxy">
+ For HTTPS requests, the client reports a failed tunnel, such as `CONNECT tunnel failed, response 407`. The request reached the proxy without the session token. Check that the proxy URL includes `x-agent-vault:<session-token>@`.
+ </Accordion>
+ <Accordion title="Requests fail with a 403 from the proxy">
+ If the client reports a failed tunnel, such as `CONNECT tunnel failed, response 403` or `Tunnel connection failed: 403 Forbidden`, the session expired or was revoked. Create a new session and [replace the session token](#replace-the-session-token).
+ </Accordion>
+ <Accordion title="The API returns an authentication error">
+ The request reached the API without the real credential. Check that a service in the session's access bundle covers the host, and that the service's credential is correct. If the service uses a substitution, check that the agent sends the exact placeholder in **Replace**.
+ </Accordion>
+ <Accordion title="Requests fail with a certificate error">
+ The agent doesn't trust the proxy's certificate. Check that the client loads `ca.pem`, and download the certificate again if you re-enrolled the proxy.
+ </Accordion>
+ <Accordion title="Requests reach the API without the proxy">
+ If the API rejects the placeholder key and the request doesn't appear in the session logs, the agent's requests skip the proxy. Check that the host isn't in `NO_PROXY`, and that the HTTP client reads the proxy setting:
+
+ - The built-in `fetch` in Node.js ignores `HTTPS_PROXY` unless you set `NODE_USE_ENV_PROXY=1` (Node.js 24 or later)
+ - For a client that ignores `HTTPS_PROXY`, set the proxy in code, as the [examples in Step 4](#step-4-send-requests-through-the-proxy) show
+ </Accordion>
+</AccordionGroup>
+
+## Next steps
+
+<CardGroup cols={2}>
+ <Card title="Create sessions with the API" icon="key-round" href="/documentation/platform/agent-vault/sessions-api">
+ Create a session for each agent run from your own code.
+ </Card>
+ <Card title="Services" icon="plug" href="/documentation/platform/agent-vault/services">
+ Limit the methods and paths an agent can use, and replace placeholders with real values.
+ </Card>
+</CardGroup>
diff --git a/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx b/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx
index dca43c81d2..6ad997ac36 100644
--- a/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx
+++ b/docs/documentation/platform/agent-vault/guides/hermes-gateway.mdx
@@ -6,7 +6,7 @@ description: "Learn how to run the Hermes Agent gateway through Agent Vault so H
import SeparateMachinesNote from "/snippets/agent-vault/SeparateMachinesNote.mdx";
-This guide walks you through running the [Hermes Agent](https://hermes-agent.nousresearch.com/docs/) [gateway](https://hermes-agent.nousresearch.com/docs/user-guide/messaging) through Agent Vault, so Hermes can make authenticated API calls without holding any real credentials. The gateway connects Hermes to a messaging platform such as Slack or Telegram.
+This guide walks you through running the [Hermes Agent](https://hermes-agent.nousresearch.com/docs/) [gateway](https://hermes-agent.nousresearch.com/docs/user-guide/messaging) through Agent Vault, so Hermes can make authenticated API calls without holding any real credentials. The gateway connects Hermes to a messaging platform such as Telegram.
<Tip>
If you use Hermes in your terminal, follow [Agent Vault with Hermes](/documentation/platform/agent-vault/guides/hermes) instead.
@@ -82,7 +82,7 @@ Most Hermes setups have three kinds of API keys:
| Kind | Example keys | Service to add in Step 2 |
| --- | --- | --- |
| Model provider (the LLM API Hermes sends its prompts to) | `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` | The provider's template, such as **OpenRouter**, **Anthropic**, or **OpenAI** |
-| Messaging platform (where you chat with Hermes) | `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN`, `TELEGRAM_BOT_TOKEN` | The **Slack** template, or a **Custom** service for `api.telegram.org` |
+| Messaging platform (where you chat with Hermes) | `TELEGRAM_BOT_TOKEN` | A **Custom** service for `api.telegram.org` |
| External APIs | `GITHUB_TOKEN` | The API's template, such as **GitHub** (or a **Custom** service if Infisical has no template for the API) |
<Note>
@@ -116,7 +116,7 @@ First, create an [access bundle](/documentation/platform/agent-vault/access-bund
[Add a substitution](/documentation/platform/agent-vault/services#add-a-substitution) for each key instead if either of these is true:
- The API expects the key outside a header, such as in the URL path. For example, Telegram's bot token goes in the URL of every request: `https://api.telegram.org/bot<token>/getUpdates`
- - The API uses more than one key, such as Slack's bot token and app token (one service can hold a substitution for each key, and an access bundle can't have two services for the same host)
+ - The API uses more than one key (one service can hold a substitution for each key, and an access bundle can't have two services for the same host)
Note the placeholder you enter in **Replace**, because you'll put it in `~/.hermes/.env` in [Step 3](#replace-the-api-keys-with-placeholders).
</Note>
@@ -317,6 +317,10 @@ To stop Hermes from using the real credentials, open **Agent Vault** in Infisica
To give the gateway a new session, [create a session](#create-a-session) in Infisical. Then, on the Hermes machine, replace the token in both `HTTPS_PROXY` and `HTTP_PROXY` in `~/.hermes/.env` and run `hermes gateway restart`.
+<Tip>
+To replace the session on a schedule instead of by hand, script these steps and [create the session with the API](/documentation/platform/agent-vault/sessions-api).
+</Tip>
+
## Troubleshooting
Hermes writes the gateway's logs to `~/.hermes/logs/gateway.log`. On Linux, you can also read them with `journalctl --user -u hermes-gateway`, or `journalctl -u hermes-gateway` for a gateway installed with `--system`.
@@ -407,6 +411,9 @@ Hermes writes the gateway's logs to `~/.hermes/logs/gateway.log`. On Linux, you
Fix the cause, then run `hermes gateway start`.
</Accordion>
+ <Accordion title="The gateway logs WebSocket connection errors">
+ The proxy doesn't carry [WebSocket connections](/documentation/platform/agent-vault/proxies#supported-connections). If Hermes connects to a messaging platform over a WebSocket, that platform doesn't work through Agent Vault.
+ </Accordion>
</AccordionGroup>
## Next steps
diff --git a/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx b/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx
index b401226dbb..f7f7c42062 100644
--- a/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx
+++ b/docs/documentation/platform/agent-vault/guides/openclaw-gateway.mdx
@@ -6,7 +6,7 @@ description: "Learn how to run the OpenClaw gateway through Agent Vault so OpenC
import SeparateMachinesNote from "/snippets/agent-vault/SeparateMachinesNote.mdx";
-This guide walks you through running the [OpenClaw](https://docs.openclaw.ai/) [gateway](https://docs.openclaw.ai/gateway) through Agent Vault, so OpenClaw can make authenticated API calls without holding any real credentials. The gateway connects OpenClaw to a messaging platform such as Slack or Telegram.
+This guide walks you through running the [OpenClaw](https://docs.openclaw.ai/) [gateway](https://docs.openclaw.ai/gateway) through Agent Vault, so OpenClaw can make authenticated API calls without holding any real credentials. The gateway connects OpenClaw to a messaging platform such as Telegram.
<Tip>
If you use OpenClaw in your terminal, follow [Agent Vault with OpenClaw](/documentation/platform/agent-vault/guides/openclaw) instead.
@@ -76,7 +76,7 @@ Most OpenClaw setups have three kinds of API keys:
| Kind | Example keys | Service to add in Step 2 |
| --- | --- | --- |
| Model provider (the LLM API OpenClaw sends its prompts to) | `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` | The provider's template, such as **OpenRouter**, **Anthropic**, or **OpenAI** |
-| Messaging platform (where you chat with OpenClaw) | `channels.telegram.botToken` or `TELEGRAM_BOT_TOKEN` | A **Custom** service for `api.telegram.org`, or the platform's template, such as **Slack** |
+| Messaging platform (where you chat with OpenClaw) | `channels.telegram.botToken` or `TELEGRAM_BOT_TOKEN` | A **Custom** service for `api.telegram.org` |
| External APIs | `GITHUB_TOKEN` | The API's template, such as **GitHub** (or a **Custom** service if Infisical has no template for the API) |
<Note>
@@ -110,7 +110,7 @@ First, create an [access bundle](/documentation/platform/agent-vault/access-bund
[Add a substitution](/documentation/platform/agent-vault/services#add-a-substitution) for each key instead if either of these is true:
- The API expects the key outside a header, such as in the URL path. For example, Telegram's bot token goes in the URL of every request: `https://api.telegram.org/bot<token>/getUpdates`
- - The API uses more than one key, such as Slack's bot token and app token (one service can hold a substitution for each key, and an access bundle can't have two services for the same host)
+ - The API uses more than one key (one service can hold a substitution for each key, and an access bundle can't have two services for the same host)
Note the placeholder you enter in **Replace**, because you'll give it to OpenClaw in [Step 3](#replace-the-api-keys-with-placeholders).
</Note>
@@ -282,7 +282,13 @@ Set OpenClaw's proxy URL, replacing `<session-token>` with the token from [Step
openclaw config set proxy.proxyUrl http://x-agent-vault:<session-token>@<proxy-host>:17323
```
-OpenClaw routes all of the gateway's outbound HTTP and WebSocket traffic through this proxy, including traffic from its messaging platform clients. Then reinstall the gateway service so it picks up the new settings. This also restarts the gateway.
+OpenClaw routes all of the gateway's outbound traffic through this proxy, including traffic from its messaging platform clients.
+
+<Note>
+The proxy doesn't carry [WebSocket connections](/documentation/platform/agent-vault/proxies#supported-connections), so a messaging platform that OpenClaw connects to over a WebSocket, such as Discord, fails through the proxy.
+</Note>
+
+Then reinstall the gateway service so it picks up the new settings. This also restarts the gateway.
```bash
openclaw gateway install --force
@@ -327,6 +333,10 @@ To stop OpenClaw from using the real credentials, open **Agent Vault** in Infisi
To give the gateway a new session, [create a session](#create-a-session) in Infisical. Then, on the OpenClaw machine, run `openclaw config set proxy.proxyUrl` again with the new token, and run `openclaw gateway restart`.
+<Tip>
+To replace the session on a schedule instead of by hand, script these steps and [create the session with the API](/documentation/platform/agent-vault/sessions-api).
+</Tip>
+
## Troubleshooting
To follow the gateway's logs, run `openclaw logs --follow`. To check the gateway's configuration and service, run `openclaw doctor`.
@@ -413,6 +423,9 @@ To follow the gateway's logs, run `openclaw logs --follow`. To check the gateway
<Accordion title="The gateway is stuck waiting for state ownership">
Another OpenClaw process may be using OpenClaw's state, usually an `openclaw tui --local` session from the [terminal guide](/documentation/platform/agent-vault/guides/openclaw). The gateway waits for that process to exit. Quit the terminal session, then run `openclaw gateway restart`.
</Accordion>
+ <Accordion title="The gateway logs WebSocket connection errors">
+ The proxy doesn't carry [WebSocket connections](/documentation/platform/agent-vault/proxies#supported-connections). If OpenClaw connects to a messaging platform over a WebSocket, that platform doesn't work through Agent Vault.
+ </Accordion>
</AccordionGroup>
## Next steps
diff --git a/docs/documentation/platform/agent-vault/overview.mdx b/docs/documentation/platform/agent-vault/overview.mdx
index 95cb4363a9..09fb156bc2 100644
--- a/docs/documentation/platform/agent-vault/overview.mdx
+++ b/docs/documentation/platform/agent-vault/overview.mdx
@@ -22,6 +22,19 @@ Infisical Agent Vault is an access layer for AI agents. It securely equips agent
</Card>
</CardGroup>
+## Agent guides
+
+Set up Agent Vault for the agent you use, or for an agent you wrote yourself.
+
+<CardGroup cols={3}>
+ <Card title="Claude Code" icon="terminal" href="/documentation/platform/agent-vault/guides/claude-code" />
+ <Card title="Codex" icon="terminal" href="/documentation/platform/agent-vault/guides/codex" />
+ <Card title="OpenCode" icon="terminal" href="/documentation/platform/agent-vault/guides/opencode" />
+ <Card title="Hermes Agent" icon="bot" href="/documentation/platform/agent-vault/guides/hermes" />
+ <Card title="OpenClaw" icon="bot" href="/documentation/platform/agent-vault/guides/openclaw" />
+ <Card title="Your own agent" icon="code" href="/documentation/platform/agent-vault/guides/custom-agent" />
+</CardGroup>
+
## Concepts
<CardGroup cols={2}>
@@ -37,6 +50,12 @@ Infisical Agent Vault is an access layer for AI agents. It securely equips agent
<Card title="Sessions" icon="monitor" href="/documentation/platform/agent-vault/sessions">
Time-bound grants that let AI agents access services without holding real credentials.
</Card>
+ <Card title="Create sessions with the CLI" icon="calendar-clock" href="/documentation/platform/agent-vault/sessions-cli">
+ Start an agent from cron, a container, or CI, with a new session for each run.
+ </Card>
+ <Card title="Create sessions with the API" icon="key-round" href="/documentation/platform/agent-vault/sessions-api">
+ Create a session for each agent run from your own code.
+ </Card>
<Card title="Session logs" icon="list" href="/documentation/platform/agent-vault/session-logs">
A record of every request an AI agent makes, stored encrypted in your own Amazon S3 bucket.
</Card>
diff --git a/docs/documentation/platform/agent-vault/proxies.mdx b/docs/documentation/platform/agent-vault/proxies.mdx
index 57c09e49d4..f57616b99a 100644
--- a/docs/documentation/platform/agent-vault/proxies.mdx
+++ b/docs/documentation/platform/agent-vault/proxies.mdx
@@ -15,6 +15,15 @@ While you can technically run the agent and the proxy on a single machine, we re
We also recommend keeping both machines on the same private network. This is because every request the agent makes goes through the proxy, and a round trip between networks adds latency to every request.
</Tip>
+## Supported connections
+
+The proxy attaches credentials to HTTP/1.1 requests, over both HTTPS and plain HTTP. These connections fail through the proxy:
+
+- WebSocket connections, such as to a `wss://` URL
+- Clients that only speak HTTP/2, such as gRPC clients
+
+If an API offers both, configure the agent to use its plain HTTPS requests. Many SDKs fall back to HTTPS when a WebSocket connection fails.
+
## Create and enroll a proxy
<Steps>
@@ -197,6 +206,8 @@ The proxy decrypts HTTPS traffic to attach the credential, so each agent has to
```
</Step>
</Steps>
+
+ To set the proxy and the certificate in your own agent's code instead, see [Connect your own agent](/documentation/platform/agent-vault/guides/custom-agent).
</Tab>
</Tabs>
diff --git a/docs/documentation/platform/agent-vault/sessions-api.mdx b/docs/documentation/platform/agent-vault/sessions-api.mdx
new file mode 100644
index 0000000000..99f858aac6
--- /dev/null
+++ b/docs/documentation/platform/agent-vault/sessions-api.mdx
@@ -0,0 +1,156 @@
+---
+title: "Create Agent Vault sessions with the API"
+sidebarTitle: "Create sessions with the API"
+description: "Create a session for each agent run from your own code, using a machine identity instead of the Infisical dashboard."
+---
+
+import MachineIdentitySetup from "/snippets/agent-vault/MachineIdentitySetup.mdx";
+
+You can use the Infisical API to create a new [session](/documentation/platform/agent-vault/sessions) every time your agent starts. Your code authenticates as a [machine identity](/documentation/platform/identities/machine-identities), creates a session with an [access bundle](/documentation/platform/agent-vault/access-bundles), passes the session token to the agent, and revokes the session when the agent finishes.
+
+This is useful if your code starts your agents or creates sessions for agents on other machines, such as a job runner, an orchestrator, or a backend that runs an agent for each task.
+
+<Tip>
+ If a shell command starts the agent on the machine where it runs, such as a cron job or a container entrypoint, the [Infisical CLI can create and revoke each session](/documentation/platform/agent-vault/sessions-cli) for you without any code.
+</Tip>
+
+## Prerequisites
+
+- An [access bundle](/documentation/platform/agent-vault/access-bundles) with a service for each API the agent calls
+- A running [proxy](/documentation/platform/agent-vault/proxies) that the agent's machine can reach
+- The **Admin** role in [Agent Vault](/documentation/platform/agent-vault/access-control#product-membership), or an Agent Vault admin who can complete [Step 1](#step-1-set-up-a-machine-identity) for you
+
+## Step 1: Set up a machine identity
+
+Your code creates sessions as a machine identity, so that sessions don't depend on a person's account.
+
+<MachineIdentitySetup />
+
+## Step 2: Log in as the machine identity
+
+Call [the login endpoint for Universal Auth](/api-reference/endpoints/universal-auth/login) with the client ID and client secret:
+
+```bash
+curl -X POST https://app.infisical.com/api/v1/auth/universal-auth/login \
+ -H "Content-Type: application/json" \
+ -d '{"clientId": "<client-id>", "clientSecret": "<client-secret>"}'
+```
+
+If you self-host Infisical, replace `https://app.infisical.com` with the address of your instance, here and in every later request.
+
+The response includes an `accessToken`, which you send with each request in the next steps, and `expiresIn`, the number of seconds until the access token expires. Log in again when the access token expires.
+
+<Tip>
+ If your code runs on a cloud provider or in Kubernetes, you can use another [authentication method](/documentation/platform/identities/overview), such as AWS Auth or Kubernetes Auth, so that your code doesn't need a client secret. Each method returns an access token that works the same way in the next steps.
+</Tip>
+
+## Step 3: Create a session
+
+Call [the endpoint that creates a session](/api-reference/endpoints/agent-vault-sessions/create) with the name of the access bundle and how long the session should last:
+
+```bash
+curl -X POST https://app.infisical.com/api/v1/agent-vault/sessions \
+ -H "Authorization: Bearer <access-token>" \
+ -H "Content-Type: application/json" \
+ -d '{"accessBundles": ["<access-bundle-name>"], "ttl": "1h"}'
+```
+
+- `accessBundles` takes a list, but a session can have only one access bundle, so the list must have exactly one name
+- `ttl` accepts a duration of at least one minute, such as `30m`, `8h`, or `7d`, or `never`, and defaults to `7d` (see [Choose how long a session lasts](#choose-how-long-a-session-lasts) to pick a value)
+
+The response includes the session's ID, the session token, and when the session expires:
+
+```json
+{
+ "session": {
+ "id": "6f1c2a9e-3b7d-4e8a-9c41-2d5f7b8e0a13",
+ "token": "<session-token>",
+ "expiresAt": "2026-10-07T19:00:00.000Z"
+ }
+}
+```
+
+Save the ID, which you need to revoke the session in [Step 5](#step-5-revoke-the-session). You can't retrieve the session token again after this response.
+
+### Choose how long a session lasts
+
+Pick the `ttl` based on how long your agents run:
+
+| How your agents run | What to do |
+|------|------------|
+| A job that finishes, such as a task from a queue or a scheduled run | Create a session for each job, with a `ttl` a little longer than the longest job, and revoke the session when the job ends |
+| A process that keeps running, such as a service or a chat bot | Create a session with a `ttl` such as `24h`. Before the session expires, create a new session, switch the agent to the new token, then revoke the old session |
+
+## Step 4: Start the agent with the session token
+
+The agent uses the session token to authenticate to the proxy. How you pass the token to the agent depends on how you start the agent:
+
+<Tabs>
+ <Tab title="With the CLI">
+ Start the agent with `infisical agent-vault run`, and pass the session token and the proxy's address:
+
+ ```bash
+ infisical agent-vault run \
+ --session-token <session-token> \
+ --proxy <proxy-host>:17323 \
+ -- <agent-command>
+ ```
+
+ The CLI trusts the proxy's certificate for the agent and sends the agent's requests through the proxy.
+ </Tab>
+ <Tab title="Without the CLI">
+ Set these environment variables for the agent's process, and point its certificate variables at the proxy's certificate, as [Connect your own agent](/documentation/platform/agent-vault/guides/custom-agent) describes:
+
+ ```bash
+ export HTTPS_PROXY=http://x-agent-vault:<session-token>@<proxy-host>:17323
+ export HTTP_PROXY=http://x-agent-vault:<session-token>@<proxy-host>:17323
+ ```
+
+ If you built the agent yourself, you can instead set the proxy in the agent's HTTP client. [Connect your own agent](/documentation/platform/agent-vault/guides/custom-agent) has examples for Python, Node.js, and Go.
+ </Tab>
+</Tabs>
+
+## Step 5: Revoke the session
+
+When the agent finishes, call [the endpoint that revokes a session](/api-reference/endpoints/agent-vault-sessions/revoke) with the session's ID:
+
+```bash
+curl -X POST https://app.infisical.com/api/v1/agent-vault/sessions/<session-id>/revoke \
+ -H "Authorization: Bearer <access-token>"
+```
+
+The proxy stops attaching credentials for the session within one [poll interval](/documentation/platform/agent-vault/proxies#poll-interval).
+
+Revoke the session even if the agent fails, for example in a `finally` block or an exit handler. If your code exits before it can revoke the session, the session stops working when its `ttl` runs out.
+
+## Step 6: Verify it works
+
+In Agent Vault, go to **Sessions** and select **All Sessions**. The **Identity** column shows the machine identity's name for the session you created. The session's **Status** is **Active** while the agent runs, and **Revoked** after [Step 5](#step-5-revoke-the-session).
+
+If you've [set up session logs](/documentation/platform/agent-vault/session-logs#setting-up-session-logs), [view the session's logs](/documentation/platform/agent-vault/sessions#view-session-logs) to check which requests the agent made during the session.
+
+<Check>
+ Your code now creates a session for each agent run, and the agent's credentials stop working when you revoke the session or its `ttl` runs out.
+</Check>
+
+## Troubleshooting
+
+<AccordionGroup>
+ <Accordion title="Creating the session fails with &quot;No access bundle named ... is granted to you&quot;">
+ The machine identity doesn't have a grant on the access bundle, or the name in `accessBundles` is wrong. Check the name on the **Access Bundles** page, and [grant the bundle](#step-1-set-up-a-machine-identity) to the machine identity.
+ </Accordion>
+ <Accordion title="Creating or revoking a session fails with 401 after your code has run for a while">
+ The machine identity's access token expired. [Log in again](#step-2-log-in-as-the-machine-identity) to get a new access token. Sessions you already created keep working, because a session doesn't depend on the access token that created it.
+ </Accordion>
+</AccordionGroup>
+
+## Next steps
+
+<CardGroup cols={2}>
+ <Card title="Your own agent" icon="code" href="/documentation/platform/agent-vault/guides/custom-agent">
+ Send your agent's requests through the proxy from your own code.
+ </Card>
+ <Card title="Session logs" icon="list" href="/documentation/platform/agent-vault/session-logs">
+ Record every request an agent makes during a session.
+ </Card>
+</CardGroup>
diff --git a/docs/documentation/platform/agent-vault/sessions-cli.mdx b/docs/documentation/platform/agent-vault/sessions-cli.mdx
new file mode 100644
index 0000000000..a2051b3ab0
--- /dev/null
+++ b/docs/documentation/platform/agent-vault/sessions-cli.mdx
@@ -0,0 +1,196 @@
+---
+title: "Create Agent Vault sessions with the CLI"
+sidebarTitle: "Create sessions with the CLI"
+description: "Create a new session for each agent run with the Infisical CLI and a machine identity."
+---
+
+import MachineIdentitySetup from "/snippets/agent-vault/MachineIdentitySetup.mdx";
+
+The Infisical CLI can create a new [session](/documentation/platform/agent-vault/sessions) each time an agent starts. The CLI authenticates as a [machine identity](/documentation/platform/identities/machine-identities), creates a session with an [access bundle](/documentation/platform/agent-vault/access-bundles), starts the agent, and revokes the session when the agent exits.
+
+This is useful if your agent runs from cron, in a container, in CI, or as a long-running service.
+
+<Tip>
+ If your own code starts the agents, or creates sessions for agents that run on other machines, such as an orchestrator that gives each container its own session, you can [create sessions with the API](/documentation/platform/agent-vault/sessions-api) instead.
+</Tip>
+
+## Prerequisites
+
+- An [access bundle](/documentation/platform/agent-vault/access-bundles) with a service for each API the agent calls
+- A running [proxy](/documentation/platform/agent-vault/proxies) that the agent's machine can reach
+- The [Infisical CLI](/cli/install) installed on the agent's machine
+- An agent command that runs without anyone at the terminal, such as `claude -p "<prompt>"` for Claude Code
+- The **Admin** role in [Agent Vault](/documentation/platform/agent-vault/access-control#product-membership), or an Agent Vault admin who can complete [Step 1](#step-1-set-up-a-machine-identity) for you
+
+## Step 1: Set up a machine identity
+
+The CLI creates sessions as a machine identity, so that the agent's access doesn't depend on a person's account.
+
+<MachineIdentitySetup />
+
+<Note>
+ We recommend creating a machine identity for each agent and granting it only the access bundle that agent uses.
+
+ If you plan on using one machine identity to create sessions with different access bundles for different agents, you should [create sessions with the API](/documentation/platform/agent-vault/sessions-api) instead.
+</Note>
+
+## Step 2: Start the agent
+
+If the agent won't start without an API key, such as `ANTHROPIC_API_KEY` for Claude Code, set the key to a placeholder, such as `agent-vault`. The proxy replaces the placeholder with the real key from the service. If the service uses a [substitution](/documentation/platform/agent-vault/services#substitutions), set the key to the service's placeholder instead.
+
+On the agent's machine, set the machine identity's credentials and the proxy's address as environment variables, then start the agent with `infisical agent-vault run`:
+
+```bash
+export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<client-id>
+export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<client-secret>
+export INFISICAL_AGENT_VAULT_PROXY_ADDRESS=<proxy-host>:17323
+# If you self-host Infisical, also set the address of your instance
+export INFISICAL_DOMAIN=<your-instance-url>
+
+infisical agent-vault run --access-bundle <access-bundle-name> --ttl 2h -- <agent-command>
+```
+
+### Choose how long each session lasts
+
+Set `--ttl` a little longer than the longest run you expect:
+
+- If a run takes longer than the `--ttl`, the agent loses access to the APIs partway through the run
+- If the CLI can't revoke the session, such as when the machine shuts down mid-run, the session keeps working until the `--ttl` runs out (seven days if you leave out `--ttl`)
+
+### Pin the proxy's certificate
+
+The CLI downloads the proxy's certificate at the start of each run. If the agent's machine reaches the proxy over a network you don't fully control, add `--ca-fingerprint` with the proxy's fingerprint to the command, so the CLI only starts the agent if the certificate matches:
+
+```bash
+infisical agent-vault run --access-bundle <access-bundle-name> --ttl 2h --ca-fingerprint <fingerprint> -- <agent-command>
+```
+
+Copy the fingerprint from the **Certificate Authority** column on the **Proxies** page. If you [re-enroll the proxy](/documentation/platform/agent-vault/proxies#re-enroll-a-proxy), update the fingerprint.
+
+## Step 3: Run the agent automatically
+
+Put the command from [Step 2](#step-2-start-the-agent) wherever your agents start:
+
+<Tabs>
+ <Tab title="Schedule (cron)">
+ Store the environment variables in a file that only the job's user can read, such as `/etc/agent-vault/agent.env` with mode `0600`:
+
+ ```bash
+ export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<client-id>
+ export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<client-secret>
+ export INFISICAL_AGENT_VAULT_PROXY_ADDRESS=<proxy-host>:17323
+ ```
+
+ Then load the file in the crontab entry. This entry runs the agent every 30 minutes:
+
+ ```bash
+ */30 * * * * . /etc/agent-vault/agent.env && infisical agent-vault run --access-bundle <access-bundle-name> --ttl 1h -- <agent-command>
+ ```
+ </Tab>
+ <Tab title="Service (systemd)">
+ For an agent that keeps running, such as a bot, a session has to last as long as the process. Instead of a session that never expires, restart the service on a schedule, so each restart gets a new session and revokes the old one.
+
+ Store the variables in `/etc/agent-vault/agent.env` with mode `0600`, without the `export` keyword, then create `/etc/systemd/system/agent.service`:
+
+ ```ini
+ [Unit]
+ Description=Agent through Infisical Agent Vault
+ After=network-online.target
+
+ [Service]
+ EnvironmentFile=/etc/agent-vault/agent.env
+ ExecStart=/usr/bin/infisical agent-vault run --access-bundle <access-bundle-name> --ttl 25h -- <agent-command>
+ Restart=always
+ RuntimeMaxSec=1d
+
+ [Install]
+ WantedBy=multi-user.target
+ ```
+
+ `RuntimeMaxSec=1d` restarts the service every day, and `--ttl 25h` gives each session an hour more than that. Start the service with `sudo systemctl enable --now agent`.
+ </Tab>
+ <Tab title="Container">
+ Install the CLI in the agent's image and start the agent through `infisical agent-vault run`. For an image based on Debian or Ubuntu:
+
+ ```dockerfile
+ RUN apt-get update && apt-get install -y curl \
+ && curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
+ && apt-get install -y infisical
+
+ ENTRYPOINT ["infisical", "agent-vault", "run", "--access-bundle", "<access-bundle-name>", "--ttl", "2h", "--"]
+ CMD ["<agent-command>"]
+ ```
+
+ Pass the environment variables when you start the container, such as from a file:
+
+ ```bash
+ docker run --env-file agent.env <agent-image>
+ ```
+
+ In Docker, an `--env-file` lists each variable as `NAME=value`, without the `export` keyword. When Docker stops the container, the CLI passes the stop signal to the agent and revokes the session after the agent exits.
+ </Tab>
+ <Tab title="CI (GitHub Actions)">
+ Store the client ID and client secret as [repository secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions), then start the agent in a job step:
+
+ ```yaml
+ - name: Install the Infisical CLI
+ run: |
+ curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | sudo -E bash
+ sudo apt-get install -y infisical
+
+ - name: Run the agent
+ env:
+ INFISICAL_UNIVERSAL_AUTH_CLIENT_ID: ${{ secrets.AGENT_VAULT_CLIENT_ID }}
+ INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET: ${{ secrets.AGENT_VAULT_CLIENT_SECRET }}
+ INFISICAL_AGENT_VAULT_PROXY_ADDRESS: <proxy-host>:17323
+ run: infisical agent-vault run --access-bundle <access-bundle-name> --ttl 1h -- <agent-command>
+ ```
+
+ The CLI exits with the agent's exit code, so the step fails if the agent fails.
+
+ The runner has to reach the proxy. If the proxy is on a private network, run the job on a [self-hosted runner](https://docs.github.com/en/actions/hosting-your-own-runners) in that network.
+ </Tab>
+</Tabs>
+
+To run agents on many machines, give every machine the same command and point them all at the same proxy. Each run gets its own session, so you can see and revoke each run separately on the **Sessions** page. You don't need a proxy for each machine.
+
+## Step 4: Verify it works
+
+After the agent runs, go to **Sessions** in Agent Vault and select **All Sessions**. Each run has its own session, with the machine identity's name in the **Identity** column. A session's **Status** is **Active** while the agent runs, and **Revoked** after the agent exits.
+
+If you've [set up session logs](/documentation/platform/agent-vault/session-logs#setting-up-session-logs), [view a session's logs](/documentation/platform/agent-vault/sessions#view-session-logs) to check which requests the agent made during that run.
+
+<Check>
+ Your agent now runs on its own with a new session each time, and each session ends when the agent exits.
+</Check>
+
+## Troubleshooting
+
+<AccordionGroup>
+ <Accordion title="The job hangs or fails before the agent starts">
+ If the output mentions logging in, the CLI didn't find the machine identity's credentials and started an interactive login. Check that `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` and `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` are set in the job's environment. Cron starts jobs with an almost empty environment, so load the variables in the cron job, as the [cron example](#step-3-run-the-agent-automatically) shows.
+ </Accordion>
+ <Accordion title="The CLI fails with &quot;the proxy address is required&quot;">
+ Set `INFISICAL_AGENT_VAULT_PROXY_ADDRESS`, or pass `--proxy <proxy-host>:17323`.
+ </Accordion>
+ <Accordion title="The CLI fails with &quot;No access bundle named ... is granted to you&quot;">
+ The machine identity doesn't have a grant on the access bundle, or the name in `--access-bundle` is wrong. Check the name on the **Access Bundles** page, and [grant the bundle](#step-1-set-up-a-machine-identity) to the machine identity.
+ </Accordion>
+ <Accordion title="The agent loses access to APIs partway through a run">
+ If the agent's requests start failing with a 403 from the proxy, such as `CONNECT tunnel failed, response 403`, the session expired before the agent finished. Set a longer `--ttl`.
+ </Accordion>
+ <Accordion title="A session stays Active after the agent stopped">
+ The CLI couldn't revoke the session, for example because the machine shut down or the process was killed with `SIGKILL`. [Revoke the session](/documentation/platform/agent-vault/sessions#revoke-a-session) on the **Sessions** page, or let it expire at the end of its `--ttl`.
+ </Accordion>
+</AccordionGroup>
+
+## Next steps
+
+<CardGroup cols={2}>
+ <Card title="Create sessions with the API" icon="key-round" href="/documentation/platform/agent-vault/sessions-api">
+ Create a session for each agent run from your own code.
+ </Card>
+ <Card title="CLI reference" icon="terminal" href="/cli/reference#agent-vault-run">
+ Every flag of `infisical agent-vault run`.
+ </Card>
+</CardGroup>
diff --git a/docs/documentation/platform/agent-vault/sessions.mdx b/docs/documentation/platform/agent-vault/sessions.mdx
index a6aa5c54df..2b6824e396 100644
--- a/docs/documentation/platform/agent-vault/sessions.mdx
+++ b/docs/documentation/platform/agent-vault/sessions.mdx
@@ -11,6 +11,10 @@ Every session is scoped to one access bundle and expires on a schedule you set.
Anyone granted at least one access bundle can create a session. Admins can create one with any access bundle.
+<Tip>
+ If you want to create sessions programmatically, you can have a [machine identity](/documentation/platform/identities/machine-identities) create a new session for each run using [the CLI](/documentation/platform/agent-vault/sessions-cli) or [the API](/documentation/platform/agent-vault/sessions-api).
+</Tip>
+
<Tabs>
<Tab title="Dashboard">
<Steps>
@@ -45,8 +49,18 @@ Anyone granted at least one access bundle can create a session. Admins can creat
Set the duration with [`--ttl`](/cli/reference#agent-vault-run--flag-ttl), which takes a value like `30m`, `8h`, `7d`, or `never`.
The CLI creates the session as your user by default, or as a machine identity when you pass `--client-id` and `--client-secret` (or their environment variables). It revokes the session when the agent exits unless you pass `--keep-session`.
+ </Tab>
+ <Tab title="API">
+ Call [the endpoint that creates a session](/api-reference/endpoints/agent-vault-sessions/create) with the access bundle's name and a `ttl`:
+
+ ```bash
+ curl -X POST https://app.infisical.com/api/v1/agent-vault/sessions \
+ -H "Authorization: Bearer <access-token>" \
+ -H "Content-Type: application/json" \
+ -d '{"accessBundles": ["<access-bundle-name>"], "ttl": "1h"}'
+ ```
- For an agent that runs unattended, set up the [machine identity](/documentation/platform/identities/machine-identities) first: create it with Universal Auth, add it under **Access Control**, and grant it the access bundle.
+ The response includes the session token.
</Tab>
</Tabs>
diff --git a/docs/snippets/agent-vault/MachineIdentitySetup.mdx b/docs/snippets/agent-vault/MachineIdentitySetup.mdx
new file mode 100644
index 0000000000..be5210dd5d
--- /dev/null
+++ b/docs/snippets/agent-vault/MachineIdentitySetup.mdx
@@ -0,0 +1,18 @@
+<Steps>
+ <Step>
+ In Agent Vault, go to **Access Control** > **Machine Identities** and select **Add Machine Identity**.
+ </Step>
+ <Step>
+ On the **Create New** tab, enter a **Name**, choose **Member** in **Role**, then select **Create**. Infisical creates the machine identity with [Universal Auth](/documentation/platform/identities/universal-auth) and opens its page.
+
+ <Tip>
+ To use a machine identity that already exists in your organization, select the **Assign Existing** tab instead.
+ </Tip>
+ </Step>
+ <Step>
+ On the machine identity's page, select **Universal Auth** under **Authentication**. Copy the **Client ID**, then select **Add Client Secret** and copy the client secret.
+ </Step>
+ <Step>
+ Go to **Access Bundles** and open the access bundle the agent uses. Select **Options** > **Manage Access**, then select **Grant Access**. Select the machine identity, then select **Grant Access**.
+ </Step>
+</Steps>
diff --git a/docs/snippets/agent-vault/QuickstartBody.mdx b/docs/snippets/agent-vault/QuickstartBody.mdx
index f0d258e26b..e533a6575d 100644
--- a/docs/snippets/agent-vault/QuickstartBody.mdx
+++ b/docs/snippets/agent-vault/QuickstartBody.mdx
@@ -176,16 +176,10 @@ The CLI adds the proxy's certificate authority to the agent process' trusted CAs
## Next steps
<CardGroup cols={2}>
- <Card title="Access bundles" icon="box" href="/documentation/platform/agent-vault/access-bundles">
- Lists of services that AI agents can access during a session.
+ <Card title="Create sessions with the CLI" icon="calendar-clock" href="/documentation/platform/agent-vault/sessions-cli">
+ Run your agent from cron, a container, or CI, with a new session for each run.
</Card>
- <Card title="Sessions" icon="monitor" href="/documentation/platform/agent-vault/sessions">
- Time-bound grants that let AI agents access services without holding real credentials.
- </Card>
- <Card title="Proxies" icon="route" href="/documentation/platform/agent-vault/proxies">
- Forward proxies that intercept an AI agent's requests and attach real credentials on the way out.
- </Card>
- <Card title="CLI reference" icon="terminal" href="/cli/reference#agent-vault">
- Every flag of `infisical agent-vault proxy` and `infisical agent-vault run`.
+ <Card title="Create sessions with the API" icon="calendar-clock" href="/documentation/platform/agent-vault/sessions-api">
+ Create sessions from code every time you start your agent.
</Card>
</CardGroup>
diff --git a/docs/snippets/agent-vault/slots/AgentLaunchCommand.mdx b/docs/snippets/agent-vault/slots/AgentLaunchCommand.mdx
index 4606f7659d..ef2dfdac4a 100644
--- a/docs/snippets/agent-vault/slots/AgentLaunchCommand.mdx
+++ b/docs/snippets/agent-vault/slots/AgentLaunchCommand.mdx
@@ -22,6 +22,11 @@ import { AgentVaultBranch } from "/snippets/AgentVaultQuickstartConfigurator.jsx
```bash
infisical agent-vault run --session-token <session-token> --proxy <proxy-host>:17323 -- codex
```
+
+ <Note>
+ Codex first tries to reach the OpenAI API over a WebSocket, which [fails through the proxy](/documentation/platform/agent-vault/proxies#supported-connections). You may see a few connection errors before Codex switches to HTTPS and responds.
+ </Note>
+
</AgentVaultBranch>
<AgentVaultBranch agent="hermes">