Skip to main content
Closed beta: the Secrets API is currently in closed beta. Contact us to get onboarded.
When an AI agent needs a password, a card number, or an API key, teams face an unpleasant choice: hand the agent unfettered access to credentials, or put a human in the loop for every single request. Turnkey gives you a third option: a programmable access layer that evaluates every credential request against policies you control, inside a secure enclave that never releases plaintext unless the policy allows it. Policies and tags are fully dynamic: update them at runtime to widen or narrow access on the fly, without re-importing anything. This solution builds on Secret Storage.

Access patterns

One policy engine supports the full spectrum of trust models:

Key implementation decisions

Example: multi-agent consensus for payments

Model a browser agent and a payment agent as durable Turnkey users, with session keys that authenticate their ephemeral instances. Policy requires both agent roles to approve before the enclave exports card details, and only the payment agent instance holds the decryption key. Neither instance can act alone, and the browser agent never sees the card.

Policy: require two agent roles for credit card access

Implementation steps

1

Import the credential

Import the card once, with static properties that the policy above targets. Any client with import permission can do this. Here, a backend service imports it:
2

Payment agent instance creates the export proposal

The payment agent instance, the intended recipient, generates an ephemeral keypair and builds the proposal. createExportSecretsProposal is a local call: it produces the canonical request body and its fingerprint, with no network round trip.
The proposal is plain JSON and contains no key material. Share it with co-signing agent instances over any channel.
3

Both agent instances sign and submit in parallel

Each agent instance stamps the identical proposal body with the session key for its durable agent-role user and submits. Order doesn’t matter: the first submission creates the activity, and every subsequent identical submission counts as an approval.
Until the consensus expression is satisfied, the activity reports ACTIVITY_STATUS_CONSENSUS_NEEDED and no secret leaves the enclave.
4

Payment agent instance decrypts

Once policy is satisfied, the enclave re-encrypts the card to the payment agent instance’s ephemeral key. Only that instance can decrypt:
For direct human approval instead of a second agent role, skip the co-signing step: the activity stays in CONSENSUS_NEEDED until the human approves it from the dashboard or via approve_activity.

Next steps