Skip to main content
Identity providers are where you store credentials. Create a provider, add secrets (key/value pairs) under it, then attach those secrets to a runtime (sandbox). On each run_code / run_cmd, the attached secrets become environment variables — without putting keys in your source or prompts.
Manage Identity providers in Identity → Providers on the platform, or via client.identity.providers / /v1/identity/providers. Create secrets under a provider there. Secret values are write-only — list/get return masked placeholders only.

Why Identity providers?

Secrets are resolved at execution time. They are not stored in the runtime’s persisted env record.

Behavior

  • Secret keys become env var names (OPENAI_API_KEY).
  • Same key under an Identity provider overwrites the previous value.
  • Attach secrets when creating a sandbox (providers=[...]) or later with client.identity.providers.attach(...).
  • After detach, the next execution no longer receives those secrets.
  • Interactive terminal/SSH does not auto-inherit secrets — use run_code or run_cmd.

Create an Identity provider and secrets

Multiple secrets

One Identity provider can hold several keys:

Attach secrets when creating a sandbox

Pass the Identity provider ID so its secrets are attached to the sandbox:

Attach secrets to a running sandbox

Use credentials in code

Detach secrets

SDK reference

All Identity provider operations live under client.identity.providers (maps to /v1/identity/providers).

CLI

Security best practices

Identity providers keep secrets out of your source tree and make rotation easier — but attaching secrets still injects those values into the sandbox as environment variables on run_code / run_cmd. Isolation from the host does not stop a context-injected agent from reading os.environ, writing files, or sending data over the network.
Prefer keeping high-value credentials in tools that run outside the sandbox. Let the agent call those tools; do not put the raw key where guest code can print or exfiltrate it. Attach secrets when the workload truly must authenticate from inside the runtime — and design for least privilege.

Safer patterns

  1. Authenticate outside the sandbox — your app or a host-side tool holds the API key; the sandbox only receives non-sensitive results.
  2. Narrow Identity secrets — one provider per integration, keys scoped to the minimum API surface, rotate often, detach when unused.
  3. Limit what can leave the box — use Network Policies to allowlist or block outbound destinations; monitor for unexpected destinations.
  4. Human review for risky actions — require approval before tool calls that spend money, change production data, or leave the sandbox.
  5. Treat sandbox I/O as hostile — validate outputs, redact secrets from logs, and never trust agent-generated commands blindly.
Short-lived or scoped credentials inside a sandbox are still readable by any code that runs there. If an attacker can steer the agent, they can usually read those values too. Injection into the runtime is a convenience tradeoff, not a security boundary.
For broader sandbox hardening, see Runtime overview — Security best practices.

Next

Create Runtime

Create a sandbox and attach secrets

Network Policies

Limit where secrets can be used over the network