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

bundle

ak secrets bundle create

Read an explicit allowlist of secrets from this device's vault and seal them into an encrypted CI bundle for one trust boundary.

Use ak secrets bundle create on a trusted device to seal the secrets a protected CI job needs into one encrypted file. The job decrypts it with ak secrets run --bundle. The vault may ask for its passphrase here; nothing in CI does.

Usage

ak secrets bundle create --profile NAME --encrypt-for AGE_RECIPIENT --secret VAR=REF [--secret VAR=REF ...] --output FILE [flags]
ak secrets bundle create --profile ci-production --encrypt-for age1... --secret DEPLOY_TOKEN=${REF} --output ci-production.akv
ak secrets bundle create --profile ci-staging --encrypt-for age1... --secret A=${REF_A} --secret B=${REF_B} --output ci-staging.akv

Options

FlagDefaultDescription
--profile NAMERequiredTrust-boundary label stored in the bundle, such as ci-production. 1 to 64 characters of a-z, 0-9, -, or _.
--encrypt-for AGE_RECIPIENTRequiredPublic age recipient (age1...) that ak secrets bundle keygen printed.
--secret VAR=REFRequiredInclude the stored secret REF, delivered as the environment variable VAR. Repeatable, at most 64 times.
--output FILERequiredBundle file to write, with mode 0600.
--backend <name>From AGENTKIT_SECRETS_BACKEND or config.yaml, else keychainStorage backend to read: keychain, file, or memory.
--unlock-with-recoveryfalseOpen the file backend's vault with a recovery private key and set a new passphrase.

Shared flags are described in CLI conventions.

What it does

Selection is an explicit allowlist: only the secrets named by --secret are sealed, and there is no export-all. Each VAR must be a variable name that ak secrets run accepts, and no VAR may appear twice, ignoring case. Each value must be non-empty and at most 16 KiB.

The command reads each REF from this device's vault and seals the values to the --encrypt-for recipient. The bundle carries only the VAR names and their values, plus the profile and the creation time. It never carries grants, membership, device keys, recovery material, the ref names, or any other metadata.

--profile names the trust boundary. ak secrets run --bundle refuses a bundle whose profile is not the one it was told to expect, so use one bundle and one key per boundary.

The command writes --output with mode 0600, replacing an existing file there and creating missing parent directories. It refuses a symlink, a directory, standard output, or a terminal as the destination, so the bundle is never printed.

Whoever holds the bundle and its key can read every value in it.

Output

The text output names the bundle file, the number of secrets, and the profile. JSON uses kind=secrets.bundle.create with these fields under data:

out, count, profile

The output never contains a secret value.

Exit behavior

ExitMeaning
0The bundle was written.
2Invalid flags, profile, recipient, or selection, or a refused --output destination.
3A selected secret does not exist.
5The vault could not be read, or the file could not be written.