Vaults
Built. A vault holds credentials for a session. The agent's sandbox never sees the real value.
Create a vault and a credential
const vault = await client.beta.vaults.create({ display_name: "Acme APIs" });
const credential = await client.beta.vaults.credentials.create(vault.id, {
auth: { type: "environment_variable", name: "API_TOKEN", value: "…" },
});
The response never contains the secret. Attach vaults when you create the session: vault_ids: [vault.id]. They cannot be added later.
Credential types
| Type | For | How it reaches the service |
|---|---|---|
environment_variable |
Any API or command-line tool that needs a secret | The sandbox sees a placeholder in $NAME. The egress proxy swaps in the real value on the way out, only for the credential's allowed_hosts, and masks it if the service echoes it back. |
static_bearer |
An MCP server with a fixed token | MAA adds the token when it calls the MCP server |
mcp_oauth |
An MCP server using OAuth | MAA stores the access and refresh tokens, refreshes when the token expires and keeps a rotated refresh token sealed |
Check an OAuth credential without running a session:
POST /v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate
What substitution covers
web_fetch, MCP calls, and sandbox traffic through the egress proxy.- Not the inside of an HTTPS tunnel. For an HTTPS call that needs a secret, use
$MAA_EGRESS_URL/fetch. See Environments.
Why it works this way
The sandbox runs code the model wrote. Keeping secrets out of it means a prompt injection cannot read them from the environment or a file. Anthropic's Managed Agents design makes the same split: credentials sit in a vault behind a proxy and the loop never handles them.
Endpoints
POST /v1/vaults · GET /v1/vaults · GET /v1/vaults/{id} · POST /v1/vaults/{id}/credentials · GET /v1/vaults/{id}/credentials · GET/POST/DELETE /v1/vaults/{id}/credentials/{cid} · POST …/credentials/{cid}/archive · POST …/credentials/{cid}/mcp_oauth_validate