# How to require human approval before an AI agent reads a secret

> Give the agent a credential that reads secret values only after a person approves each request, tied to exact entries and versions.

Give the agent a credential with the permission to read secret values only after a person approves each request. The agent then has to ask for an approval, called a grant, before it can read. A grant is tied to the exact entries and versions, expires and has a use limit, and a person approves or denies it in the dashboard.

## When to use it

Reading with approval is its own permission, distinct from plain reading. Use it for secrets where each read should be a person's decision, such as production keys.

## 1. Create a credential that has to ask

Under Agent access, create an agent credential. Choose the permission that reads secret values only after a person approves each request, not the plain read permission. Set the scope, an optional name prefix such as `STRIPE_`, and a lifetime. The credential is shown once.

```sh
# Paste the credential at the hidden prompt
guardry login --profile coding-agent
guardry --profile coding-agent whoami
```

## 2. The agent asks for a grant

When the agent needs a value, it asks with `guardry grants request`, naming the exact secret with `--read` and giving its reason with `--purpose`. The agent then waits for a decision.

```sh
# Ask to read one named secret, and say why
guardry grants request --read API_KEY --purpose "Run the billing migration"

# Check whether a person has approved or denied the request
guardry grants status GRANT_ID
```

## 3. You approve or deny it

The request appears in the dashboard. It shows the agent that is asking, the purpose it gave, and the exact entries and versions the grant would cover, along with its expiry and use limit.

The purpose is the agent's own words, so decide on the entries being asked for, not on how the request is described. Then approve or deny. An agent cannot approve anything, including its own request.

## 4. The agent reads with the grant

```sh
# Run a program with the approved secret in its environment
guardry secrets run --secret API_KEY --grant GRANT_ID -- python agent.py

# Or read the value itself, only when the consumer needs it
guardry secrets read API_KEY --grant GRANT_ID
```

The grant works for those entries at those versions, until it expires or reaches its use limit. After that the agent asks again.

The release is written to the audit log before the value leaves the vault. If the audit record cannot be written, the read is refused.

## What this does not do

- After an approved read, the agent has the value and can copy it. Approval decides whether the agent gets a value, not what a program does with it afterwards.
- Variables are not covered. A variable is visible to every agent credential that covers its environment, without approval. Anything sensitive should be a secret.
- If the agent should never hold the value at all, a service fits better. Two exist today: [GitHub repository and issue reads](https://guardry.ai/guides/let-agent-use-github-token-without-seeing-it.md) and [TOTP codes](https://guardry.ai/guides/totp-codes-for-ai-agents.md).

## Questions

### Can an AI agent approve its own request?

No. An agent cannot approve anything. A person approves or denies each request in the dashboard.

### What does the approver see before deciding?

The agent that is asking, the purpose it stated, the exact entries and versions the grant would cover, and the grant's expiry and use limit. The purpose is written by the agent, so the entries and versions are the part to check.

### How long does an approval last?

A grant expires and has a use limit, both shown on the request before you approve it. When the grant has expired or its uses are spent, the agent has to ask again.

### Does approval also apply to variables?

No. Variables are visible to every agent credential that covers their environment, without approval. If a value should need approval, store it as a secret.

---

Source: https://guardry.ai/guides/require-approval-before-agent-reads-secret/ · Updated 2026-11-27 · Guardry for language models: https://guardry.ai/llms.txt
