rc.center Learnrc.center Learnrc.center

When your AI agent creates an API key, have it propose the key to your vault

Published on 5 min readAI hub

Agents create passwords and API keys during setup tasks. Instead of printing them, the agent can seal each value and propose it to your vault for you to accept.

New key shape dropping into an open drawer with a check badge, in violet light on a dark background

Agents do more than consume credentials. During a setup task they create them: a database user with a generated password, a new API key in a provider console, a webhook signing secret, a service account token. Then they have to put the value somewhere.

Usually that somewhere is the chat (“here is your new password”), a .env file in the repository, or a note at the end of the task. All three leave the value where it should not be.

The proposal flow in one paragraph

AI hub gives each account an inbox public key. The agent fetches it with secret_inbox_key, seals each new value to it with age, and calls secret_propose with the ciphertexts, a target vault and a reason. The private half of the inbox key lives inside your vault, so the service stores proposals it cannot read. You review the proposal on your phone or in the web panel and accept all, some or none of the items. Nothing is stored until you accept.

Step 1: get the inbox key

One-time setup on your side: open the Proposals screen in the web panel or the app, unlock the vault and set up the inbox key. Until that key exists, there is nothing for an agent to seal to.

Connect the MCP server first if needed. In Claude Code:

claude mcp add --transport http ai-hub https://ai-hub.rc.center/mcp

Then the agent calls:

{ "tool": "secret_inbox_key", "arguments": {} }
{
  "public_key": "age1exampleinboxrecipientxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "instruction": "Seal each value with `age -r age1exampleinboxrecipientxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -a` and call secret_propose with the armored outputs."
}

Step 2: seal each value where it lives

The agent seals the value straight from where it was created, without printing it. If the setup command wrote the password to a file:

age -r age1exampleinboxrecipientxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -a < ~/.rc-center/new-db-password.txt

If it is in an environment variable:

printf %s "$NEW_API_KEY" | age -r age1exampleinboxrecipientxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -a

The output is an armored age file. That ciphertext is what goes into the tool call. The service refuses anything that is not an armored age file, so a plaintext value cannot be proposed by mistake.

Delete the temporary plaintext file afterwards:

shred -u ~/.rc-center/new-db-password.txt

Step 3: call secret_propose

{
  "tool": "secret_propose",
  "arguments": {
    "vault": "ai-agent",
    "reason": "Created a read-only database user and a reporting API key for the weekly report job",
    "items": [
      {
        "name": "REPORTING_DB_PASSWORD",
        "sealed": "-----BEGIN AGE ENCRYPTED FILE-----\n<ciphertext>\n-----END AGE ENCRYPTED FILE-----",
        "kind": "text",
        "note": "user reporting_ro on the staging database"
      },
      {
        "name": "REPORTING_API_KEY",
        "sealed": "-----BEGIN AGE ENCRYPTED FILE-----\n<ciphertext>\n-----END AGE ENCRYPTED FILE-----",
        "note": "scope: read reports"
      }
    ],
    "public_key": "age1examplepublicrecipientxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}

The fields:

  • vault: a new or existing vault, a single name such as ai-agent.
  • reason: why these secrets were created and why they should be kept. You see it on the review screen.
  • items: each with a name, the sealed value, an optional kind (text by default, totp for an otpauth:// URI, or file) and an optional note. The note is shown to you; it must never contain the value.
  • public_key: optional. The agent’s own session key, made the same way as for secret_request (age-keygen or rc-agent keygen). Pass it if the agent will need the values back.

The answer:

{
  "proposal_id": "<proposal_id>",
  "status": "pending",
  "request_id": "<request_id>",
  "expires_at": "2026-10-27T14:00:00Z",
  "instruction": "Ask the user to review this proposal on their phone. Check the decision with secret_proposal_status; if they grant the items back to you, read them with secret_ls / secret_get on request_id."
}

Step 4: you review on your phone

The proposal shows up in the AI hub app and in the Proposals screen of the web panel, with the reason, the item names, kinds and notes. You can accept everything, accept some items, or reject the proposal with an optional reason that the session gets to see. You can keep the proposed vault name or store the items in another vault. If an item with the same name already exists, the panel asks before replacing it. If the agent passed its public_key, you can also grant the accepted items back to that session.

The agent can also propose a TOTP seed it set up, with kind: "totp". Once stored, that secret is released as five minutes of one-time codes, never as the seed.

Step 5: check the decision, and get the items back if needed

{ "tool": "secret_proposal_status", "arguments": { "proposal_id": "<proposal_id>" } }
{
  "status": "accepted",
  "vault": "ai-agent",
  "accepted_vault": "ai-agent",
  "accepted_names": ["REPORTING_API_KEY", "REPORTING_DB_PASSWORD"],
  "request_id": "<request_id>",
  "note": "stored in the vault. If the owner granted the items back to you, secret_ls / secret_get on request_id deliver them; otherwise ask with secret_request when needed"
}

The status is one of pending, accepted, rejected or expired, with names only, never values. If you granted the items back, the agent reads them with secret_ls and secret_get on the returned request_id, exactly like a normal request. If not, it asks with secret_request when it needs them later.

Limits

  • Up to 50 items per proposal and 64 KiB per value.
  • Up to 20 pending proposals per account.
  • A proposal nobody decides on expires after 7 days, and the values are not stored.
  • Item names, kinds and notes are metadata the service can read. Values are not.

Use cases

  • An agent bootstrapping a new service creates the database user, the admin password and the webhook secret, and proposes all three to a new-service vault.
  • An agent rotating a key: it creates the new key in the provider console and proposes it, and you accept it before revoking the old one.
  • An agent enrolling 2FA on a service account proposes the otpauth:// URI as a totp item, so later logins go through one-time codes you approve.

Free for up to 25 vault items: create your account