Load secrets from a service
Resolve declared API keys on the host with Vault, OpenBao, 1Password, Infisical or a cloud secret manager.
Choose the service you already use: Vault/OpenBao, 1Password, Infisical, AWS, Google Cloud or Azure. Follow one service section, then pass the selected variables to your agent.
Resolve before allocating a sandbox
Section titled “Resolve before allocating a sandbox”Call fromSecrets() at the start of your script, then pass its result as variables on a CLI harness or sandbox provider. It returns a frozen object containing only the requested names. Outpost does not write these values to an environment file or change process.env.
The resolver rejects a missing, empty, non-string, NUL-containing or oversized value before your script reaches sandbox allocation. Variable names must be valid environment identifiers and cannot repeat. A value can contain line breaks and is limited to 1 MiB. See environment variables for scope and precedence, and setup for the agent image.
Use Vault or OpenBao
Section titled “Use Vault or OpenBao”Both services use the KV v2 read API. Declare the server, token, mount and document path explicitly; this example reads the OPENAI_API_KEY field from the kv/outpost document. A version and namespace can be supplied when needed. The token remains on the host.
Run the following as node run.ts after configuring the host token and address. It resolves the key before dispatch() allocates a sandbox and leaves the agent’s changes on a named branch. authentication: "usage" uses API billing, independently of the secret manager’s authentication.
KV v2 returns the whole document to the host; Outpost keeps only the selected fields. Store unrelated credentials in separate documents when they must never be fetched together. OpenBao support covers this read protocol, rather than every Vault feature. See the official Vault API and OpenBao API.
Use 1Password
Section titled “Use 1Password”Install @1password/sdk in your script project and create a service-account client on the host. Map each environment variable to an explicit op://vault/item/field reference; a section can also appear before the field. Only requested mappings are resolved. Use this source with fromSecrets(source, ["OPENAI_API_KEY"]) instead of the Vault source above.
This setup uses a declared service account, without selecting desktop authentication. See the official 1Password SDK documentation for account permissions and SDK platform requirements.
Use Infisical
Section titled “Use Infisical”Install @infisical/sdk, then authenticate a machine identity on the host with Universal Auth. The client’s siteUrl selects the cloud region or your own instance. Outpost reads each requested name from the declared project, environment and path; it disables imports and reference expansion to keep the selection explicit.
Pass this source to fromSecrets() before composing the agent. Hidden secret values reject the resolution. Other machine-authentication methods can be configured through your client; Outpost owns neither login nor token renewal. See the official Infisical SDK documentation.
Use AWS Secrets Manager
Section titled “Use AWS Secrets Manager”Install @aws-sdk/client-secrets-manager. Configure its client with your host AWS identity and map variables to exact secret IDs or ARNs. A mapping without field uses the complete SecretString; this example selects one field from a JSON secret. Binary secrets are refused. Optional version selectors belong to AwsSecretReference.
Resolve with fromSecrets(source, ["OPENAI_API_KEY"]) and call client.destroy() when finished with the client. Like Vault, selecting a JSON field still fetches the enclosing secret. See AWS’s retrieval guide.
Use Google Cloud Secret Manager
Section titled “Use Google Cloud Secret Manager”Install @google-cloud/secret-manager and configure Application Default Credentials on the host or use your workload identity. Map variables to complete version resource names, including latest or a numeric version; regional resource names are also accepted. Outpost decodes the payload as UTF-8 and refuses invalid text.
Resolve before dispatch and await client.close() when no longer needed. The official version-access guide explains the required permissions.
Use Azure Key Vault
Section titled “Use Azure Key Vault”Install @azure/keyvault-secrets and @azure/identity. Create a host client using a managed identity or another explicitly configured Azure credential. Map environment identifiers to Key Vault names, which can contain hyphens; each mapping can pin a version.
Only the selected names are passed to getSecret(). See Azure’s JavaScript quickstart for the identity and role setup.
Bound startup and refresh explicitly
Section titled “Bound startup and refresh explicitly”fromSecrets() defaults to a 30-second deadline for the complete resolution. Set timeoutMs and pass an AbortSignal for another startup policy. A cancelled resolution rejects with code aborted, a deadline with timeout, a read failure or invalid value with provider, and invalid declarations with configuration. Vendor exceptions and their causes are discarded to avoid exposing credentials through diagnostics. Outpost preserves explicitly trusted internal diagnostics, including Vault HTTP status, missing declared references and invalid GCP base64. Arbitrary custom-source errors remain sanitized, even when they are OutpostError instances.
Vault HTTP, AWS and Azure receive the cancellation signal. For 1Password, GCP and Infisical, cancellation stops waiting and prevents subsequent reads, but an already-started SDK request may finish in the background. Authentication you perform before fromSecrets() has its own SDK timeout policy. You own all injected clients; Outpost never closes them.
Values are a startup snapshot: a retry or warm sandbox reuse keeps them. Call fromSecrets() again and compose a new agent or sandbox when you want to use rotated values. Outpost adds no persistent cache, automatic renewal or fallback between secret managers. Each SDK is an optional peer dependency and is loaded through the service’s entry point or your script, independently of the core import.
Implement another source
Section titled “Implement another source”Implement SecretSource with a named resolve() method that reads only its requested names. This offline example demonstrates selection without an account or network. Use fromSecrets() as the validation and startup boundary before handing the variables to a harness.
Validation limits
Section titled “Validation limits”Deterministic tests cover the KV v2 HTTP protocol, native SDK method boundaries, selection, cancellation, deadlines, malformed values and error sanitization. They do not establish successful authentication against live Vault, OpenBao, 1Password, Infisical, AWS, GCP or Azure accounts. Run the service you use with a dedicated identity before relying on its configuration in production.
API: fromSecrets · SecretSource · FromSecretsOptions.
Select secrets before allocation
Section titled “Select secrets before allocation”An environment value can use { env: VARIABLE_NAME }. Secret-manager components use their public options; clients supplied by installed SDKs are borrowed object extensions. For example, the Vault token below is read on the host only during execution. The secrets variable component selects explicit names through fromSecrets(). Declare a source under secrets and reference it with $ref when several sandboxes or variable selections share it.
Only the selected values reach the sandbox. Validation neither imports user modules nor reads secret values. Missing values fail before allocation; the runtime masks selected values in observations, returned reports and execution diagnostics. It does not modify the host environment. See secret sources for manager-specific restrictions and credential ownership.

