Skip to content
DocsCustom secret providers

Concepts

Custom secret providers

Official Kody doc

A custom secret provider lets your agent use a password-manager item the same way it uses any Key: a vault-backed Key that package code reaches through credential(key), resolved at the network boundary. Package code holds a client, never the value (credential client tests).

Provider packages declare an id such as 1password. Provider logic lives in a saved package you bind; Kody core does not talk to the vault itself.

Watch: Kody secret providers: use password manager items without exposing them

Bind a provider

  1. Save the vault door key as a Kody user secret. Paste it on /connect/secret-set, never into chat. URL shape: Ask the user to save a secret.
  2. Have a saved package that declares kody.secretProvider.id (for example 1password) and exports ./secretProvider.
  3. Bind that package on /@<slug>/-/secret-providers (secretProviderBind): provider id, package, saved door-key credential, and optional non-secret config.

Declaring metadata on a package does not bind it. Only the account owner can bind or unbind. Unbind, and rebind to a different package, drop every grant for that provider.

Use a vault-backed Key

On the same page, choose Create a vault-backed Key. Choose a binding, enter the item ID and field, and set a Key label and approved hosts. Item ids are a UUID (Service Account / web) or a 1Password Connect item id (^[a-z0-9]{26}$); name-based vault paths are not interpreted in Kody core.

Declare an ordinary Key need in the package, map it to the new credential ID (or pick it with a call map in ad hoc execute), and grant the package access to the item field:

{
	"name": "@you/deploy",
	"exports": { ".": "./src/index.ts" },
	"kody": {
		"description": "Deploy with a token kept in 1Password.",
		"credentials": {
			"deploy": {
				"kind": "secret",
				"description": "Deploy API token from the team vault."
			}
		}
	}
}
import { credential } from 'kody:runtime'

export default async function deploy() {
	const deploy = await credential('deploy')
	return deploy.fetch('https://api.example.com/deploy', { method: 'POST' })
}

Resolution checks the current binding, the actor's use of the binding, the package's item grant, the provider's item hosts, and the Key's own hosts and placement. resourceLock({ kind: 'secret_provider', provider, ref, package_id }) returns the Allow URL for the item grant; grant and revoke on /@<slug>/-/secret-providers. A package runs in the org that owns it, so a collaborator holding a grant uses that org's binding and grants, not their own. Details: vault-backed Keys (raw).

Legacy provider placeholders

Provider placeholders (a vault item reference written into a secret-aware fetch, with a kind: "secret-provider" slot in kody.credentials) are legacy compatibility syntax. They still work during migration and publish and runtime warn on them. Prefer a vault-backed Key; see Migrating from placeholders. Existing uses keep these rules:

  • The item's websites are the host allowlist, the request must be https:, and each ref needs its own package grant. Ad hoc execute needs no package grant.
  • A saved package declares the provider package in a slot with kind: "secret-provider" and package (the provider package's name). Publish seals the provider, not refs, into the credential stamp, and fails with unstampable_pattern when that package is missing or declares no kody.secretProvider.id, or when a request site uses an undeclared or computed provider id. At run time the org's binding for that id must be the declared package, or the fetch fails with credential_need_undeclared.
  • A secret-provider slot is never filled by a saved credential, and credential("vault") does not read it.
  • Angle-bracket markers and the grammar token in help text stay inert. Grammar and canonicalization: External secret providers.

Search does not crawl vaults. secretProviderList returns binding metadata only.

MCP

Search secretProviderList / secretProviderBind / resourceLock first; open capability detail for the exact call shape.

Where to go next

  • Credentials — credential(key), needs, and mappings
  • Secrets — the no-secret_get rule and host approval

Working with an agent? This page is also plain markdown at /docs/secret-providers.md, or load it over MCP with search({ entity: 'guide:secret_providers' }).