AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.0.0-beta.15). 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.

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) 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.

Examples

  ak secrets set ${REF}                                  # interactive prompt
  echo -n "${VALUE}" | ak secrets set ${REF} --value=-  # pipe from stdin
  ak secrets get ${REF}                                  # prints [redacted]
  ak secrets list --json                                 # machine-readable metadata

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