Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
docs(agent-vault): the session token and access bundle can come from the environment (#8104)
Saif Ur Rahman6a18d13c6ac3
diff --git a/docs/cli/reference.mdx b/docs/cli/reference.mdxindex cb9832e9e6..32ddbee391 100644--- a/docs/cli/reference.mdx+++ b/docs/cli/reference.mdx@@ -100,7 +100,7 @@ You set the proxy's traffic policy, exceptions, and poll interval in Infisical,{ name: "command", usage: "<command>", required: true, description: "The agent's command, after `--`. Everything after `--` is passed to it unchanged." },]}flags={[- { name: "--access-bundle", value: "<stringArray>", type: "stringArray", description: "The access bundle to create a session with, by name, such as `coding-agent`. A session holds one access bundle, so pass the flag only once. Can't be combined with `--session-token`." },+ { name: "--access-bundle", value: "<stringArray>", type: "stringArray", description: "The access bundle to create a session with, by name, such as `coding-agent`. A session holds one access bundle, so pass the flag only once. Can't be combined with `--session-token`. Can also be set with `INFISICAL_AGENT_VAULT_ACCESS_BUNDLE`." },{ name: "--ca-file", value: "<string>", type: "string", description: "Where to write the certificate authority fetched from the proxy. This is an output path, not a certificate to trust. Defaults to `ca-<proxy-id>.pem` in `~/.infisical/agent-vault`, or `/etc/infisical/agent-vault` when run as root, one file per proxy." },{ name: "--ca-fingerprint", value: "<string>", type: "string", description: "The SHA256 fingerprint of the proxy's certificate authority, from the **Proxies** page. The command stops before writing anything or starting the agent if the proxy serves a different one. Accepted with or without the `SHA256:` prefix and colons." },{ name: "--client-id", value: "<string>", type: "string", description: "The client ID of the machine identity that creates the session, for `--access-bundle`. Can also be set with `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID`." },@@ -109,8 +109,8 @@ You set the proxy's traffic policy, exceptions, and poll interval in Infisical,{ name: "--no-ca-trust", type: "bool", description: "Skip writing the certificate authority, setting the trust variables, and adding it to the macOS keychain, for a machine that already trusts this proxy. `--ca-fingerprint` is still checked." },{ name: "--no-proxy", value: "<string>", type: "string", description: "More hosts for the agent to reach directly instead of through the proxy, separated by commas. Always merged with `localhost,127.0.0.1` and any `NO_PROXY` in your environment." },{ name: "--proxy", value: "<string>", type: "string", required: true, description: "The Agent Vault proxy's address as `host:port`, such as `10.0.1.5:17323`. A leading `http://` or `https://` is dropped. Can also be set with `INFISICAL_AGENT_VAULT_PROXY_ADDRESS`." },- { name: "--session-token", value: "<string>", type: "string", description: "A session token created in Infisical. The command never revokes this session. Can't be combined with `--access-bundle`." },- { name: "--ttl", value: "<string>", type: "string", default: "7d", description: "How long a session created with `--access-bundle` lasts: one number and one unit, such as `30m`, `8h`, or `7d` (not `2h30m`), or `never`. Can't be combined with `--session-token`." },+ { name: "--session-token", value: "<string>", type: "string", description: "A session token created in Infisical. The command never revokes this session. Can't be combined with `--access-bundle`. Can also be set with `INFISICAL_AGENT_VAULT_SESSION_TOKEN`, which keeps it off the command line." },+ { name: "--ttl", value: "<string>", type: "string", default: "never", description: "How long a session created with `--access-bundle` lasts: one number and one unit, such as `30m`, `8h`, or `7d` (not `2h30m`), or `never`. Defaults to `never` because the session is revoked when the agent exits, so an expiry only governs one that outlives the command. Can't be combined with `--session-token`." },]}examples={[{ title: "Run an agent with a session token", code: "infisical agent-vault run --session-token=<session-token> --proxy=10.0.1.5:17323 -- claude" },@@ -124,9 +124,11 @@ Launch an agent with its HTTP traffic routed through an Agent Vault proxy. The aWith `--session-token`, the agent uses a session created in Infisical, and no login is needed. With `--access-bundle`, the command creates a session with that [access bundle](/documentation/platform/agent-vault/access-bundles). The command authenticates with `--client-id` and `--client-secret`, then `INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN` or `INFISICAL_TOKEN`, then your login.+Either way can come from an environment variable instead of its flag. A flag takes precedence over a variable, including over the other kind's variable. If both variables are set and neither flag is passed, the run stops and asks which you meant.+The command starts the agent with `HTTP_PROXY` and `HTTPS_PROXY` set to the proxy's address, and sets the variables that make the agent's HTTP clients trust the proxy's certificate. [Certificate trust](/documentation/platform/agent-vault/proxies#certificate-trust) lists those variables and explains the macOS keychain prompt.-The agent inherits the rest of your environment unchanged, and the command exits with the agent's exit code. Unlike [infisical sm agent-proxy run](/cli/reference#sm-agent-proxy-run), this command doesn't sandbox the agent.+The agent inherits the rest of your environment, apart from `INFISICAL_AGENT_VAULT_SESSION_TOKEN` when it holds a session other than this run's, and the command exits with the agent's exit code. Unlike [infisical sm agent-proxy run](/cli/reference#sm-agent-proxy-run), this command doesn't sandbox the agent.</CLICommand>diff --git a/docs/documentation/platform/agent-vault/sessions.mdx b/docs/documentation/platform/agent-vault/sessions.mdxindex 2b6824e396..2aa7c65233 100644--- a/docs/documentation/platform/agent-vault/sessions.mdx+++ b/docs/documentation/platform/agent-vault/sessions.mdx@@ -38,6 +38,13 @@ Anyone granted at least one access bundle can create a session. Admins can creat</Steps>Hand the copied command to whoever will start the agent. No Infisical login is needed on that machine.++ You can also pass the token in the environment instead:++ ```bash+ export INFISICAL_AGENT_VAULT_SESSION_TOKEN=<session-token>+ infisical agent-vault run --proxy <proxy-address> -- claude+ ```</Tab><Tab title="CLI">`infisical agent-vault run` creates a session for you when you name the access bundle: