guardry/Guides/Let agents store credentials
How to let AI agents store new credentials safely
Give the agent a credential with the create permission and a name prefix, so it can add new entries from stdin and never change existing ones.
Give the agent a credential with the create permission. It can then add new entries to the vault, with each value passed through stdin, and it can never edit, rotate or delete an existing entry, including one it created. A name prefix on the credential limits which names it can use.
Why give an agent somewhere to put credentials
An agent that sets up a sandbox account or generates a key during a task ends up holding a new credential. Without a place to put it, the value lands in a file, a log or the chat. The create permission gives the agent one place to put it, where you can find it afterwards.
1. Choose where the agent may create
Decide the scope first. One environment is the narrow choice.
Then choose a name prefix. With the prefix STRIPE_, the agent can create STRIPE_SANDBOX_KEY and cannot create DATABASE_URL.
2. Create the credential with the create permission
Under Agent access, create an agent credential with that scope and prefix and the permission to create new entries. Permissions are chosen separately, so you can let an agent create entries without letting it read secret values. Pick a lifetime: 1 hour, 4 hours, 7 days or 30 days. The credential is shown once.
# Paste the credential at the hidden prompt
guardry login --profile coding-agent3. The agent creates the entry from stdin
# Store a new credential; the value comes from stdin your-credential-generator | guardry secrets create NEW_API_KEY --stdin # Store a setting that is safe to show, as a variable printf %s eu-west-1 | guardry secrets create AWS_REGION --stdin --kind variable
The value comes from stdin, never from a command-line argument.
Use --kind variable only for values that are safe to show. A variable is visible to every agent credential that covers its environment, without approval.
If the name already exists, the agent cannot replace it.
4. Review what agents created
The dashboard marks entries that an agent created, so you can pick them out from the ones people added. Go through them from time to time. Add a description that says what the credential is for, check that anything sensitive is a secret and not a variable, and remove what is no longer needed.
Descriptions matter because agents can search names and descriptions without reading any value. A clear description is how the next agent finds the right entry.
What this does not do
- An agent cannot correct its own mistake. It can never edit, rotate or delete an existing entry, including one it created. An owner or administrator does that in the dashboard.
- Creating an entry creates nothing at a provider. The agent makes the credential elsewhere and Guardry stores it. Guardry does not generate provider credentials on demand, other than TOTP codes.
- The create permission does not include reading. An agent reads secret values only if you also give it a read permission.
Questions
Can an AI agent overwrite a secret that already exists?
No. An agent can never edit, rotate or delete an existing entry. With the create permission it can add new entries only.
Can an agent delete an entry it created by mistake?
No. An agent cannot delete any entry, including one it created. An owner or administrator removes it in the dashboard.
Why does the value have to come from stdin?
guardry secrets create takes the value from stdin, as in your-credential-generator | guardry secrets create NEW_API_KEY --stdin. The value is piped from the program that made it and is not written into the command.
Can an agent that creates entries also read them?
Only if its credential also has a read permission. Permissions are chosen separately: read secret values, read only after a person approves each request, use assigned services, and create new entries.