AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.1.0-beta.10). Features may change before the next stable release.Switch to stable →

secrets

ak secrets

Manage named secret values (API keys, tokens)

Use ak secrets for the operation described below. The command help records its arguments, effects, and options.

Choose the backend with --backend, then the AGENTKIT_SECRETS_BACKEND environment variable, then the secrets section of the user-level config.yaml in your AgentKit home, in that order. With none set, the OS keychain is used. Project config is never read for this choice. The environment variable and config.yaml accept only keychain or file; the throwaway memory backend must be requested with --backend memory on the command line.

The file backend reads its vault passphrase only from an interactive terminal. No flag or environment variable supplies it, so an unattended run against the file backend cannot open the vault, and a secret resolve that an agent hook triggers exits with status 7. Use the keychain backend for scripted runs.

Secret names compare by their Unicode NFC form, the same rule the sync dashboard uses. A name typed with a combining accent, as macOS input often produces, finds the secret stored under its precomposed spelling, and the reverse. A new secret is stored under the NFC spelling, and an update keeps the spelling already stored. Grants, blocks, and synced policies follow the same rule, so a grant or block on a name covers an agent's request in either spelling. If two stored secrets differ only in Unicode form, an agent's resolve of that name is refused until one is deleted or renamed.

Use ak secrets sync to inspect or manage vault sync. When sync is enabled, ak secrets approvals list shows requests from other devices and approve or deny answers them. See the vault guide for the device and approval requirements.

Command contract

Manage named secret values (API keys, tokens)

Synopsis

Store, read, list, delete, and rotate small named secret values behind the OS keychain, an age-encrypted vault (--backend=file, for a host with no usable keychain; see ak secrets recovery), or an in-memory --backend=memory dev backend. Values are written only to the active backend; ~/.agentkit/secrets/index.json holds metadata (ref, creator, timestamps, a short value hint, and an optional searchable profile) and never a value. Use it for an API key, token, or certificate AgentKit or an adapter needs at runtime, instead of an unmanaged .env file or shell export. Opt-in end-to-end encrypted sync (preview) keeps refs, values and profiles in step on every machine you sign in on, through vault.agentkit.best; check whether it is on with ak secrets sync status --json, which makes no network request.

Examples

  ak secrets set ${REF}                                  # interactive prompt
  ak secrets list --json                                 # machine-readable metadata
  ak secrets search stripe --environment production --json  # find a ref by metadata
  ak secrets sync status --json                          # is cloud sync on for this device?

Options

  -h, --help             help for secrets
      --json             Emit machine-readable JSON (implies --no-interactive)
      --no-interactive   Disable interactive prompts (CI-safe)
  -q, --quiet            Suppress non-error output on stderr
  -V, --verbose          Extra diagnostic output on stderr (loses to --quiet)
  -y, --yes              Assume yes for all prompts

SEE ALSO