Topic: Least agency
How to govern AI agent credentials
Give each AI agent its own short-lived, scoped credential via a broker, never a person's keys. Approaches compared, controls mapped to OWASP, NIST, IETF.
In this post 9 sections
- Key terms
- Why shared credentials fail for agents
- The approaches teams use today
- How the approaches compare
- The control checklist, mapped to the standards
- Minting a scoped, short-lived token (vendor-neutral)
- Getting started with AgentValet
- Where Microsoft Entra Agent ID fits
- Rolling it out without breaking things
Give each agent its own short-lived, scoped credential, issued through a broker that holds the real secrets and checks every call against a policy. Never let an agent run on a human’s API keys, logins or tokens, however convenient that is on the day.
Credentials are where AI agent governance starts. This guide covers the terms, the approaches teams use today and how they compare, with each control mapped to the OWASP AI Agent Security Cheat Sheet, the NIST NCCoE agent identity concept paper and the IETF Credential Broker for Agents draft.
Key terms
Agent credential. Whatever an agent presents to prove it may call a system: an API key, an OAuth access or refresh token, a signed assertion, a certificate. The governance question is who holds it, how long it lives, and what it lets the agent do.
Credential inheritance. An agent picking up access nobody granted it, because it runs as a person or reads that person’s keys. A coding agent in a developer’s terminal inherits their cloud logins, Git tokens and SSH keys. I wrote about that in Your coding agent didn’t get access. It got you. The analogy I keep coming back to is a house key versus a valet key: the agent only needs to start the car, and inheritance hands it the whole keyring.
Credential broker. A service that sits between agents and the systems they call. It holds the real credentials, authenticates the agent, evaluates policy, and either forwards the call or hands the agent a narrow, short-lived credential in place of the real one.
Least agency. Least privilege limits what an agent can reach. Least agency limits how far it can act on its own before a person is involved: which actions run unattended, which wait for approval, and how long any authority lasts. There is a longer treatment in Least agency in practice.
Why shared credentials fail for agents
A key in a .env file was always a risk. With agents it gets worse in three ways. The agent improvises, so you can’t predict which of the key’s permissions it will use. It runs often and fast, so a mistake repeats before anyone notices. And when several agents share one key, the logs can’t tell them apart.
The leak numbers are already moving with agent adoption. GitGuardian’s State of Secrets Sprawl 2026 reports 28,649,024 new secrets detected in public GitHub commits in 2025, and 24,008 unique secrets exposed in MCP configuration files. The same report found that 64% of valid secrets detected in 2022 were still active four years later. A long-lived key that leaks stays useful to whoever finds it.
The approaches teams use today
- Shared keys in
.env. The agent reads a static key and gets its full power for as long as the key exists. - A secrets manager. Keys move into a vault and get rotated, but the agent still fetches and holds the secret, and vault policy usually stops at reading the secret rather than calling a given endpoint.
- A credential broker. The agent authenticates as itself and never sees the long-lived secret; the broker proxies the call or mints a short-lived token for the task. This is the pattern the IETF CB4A draft describes.
- Microsoft Entra Agent ID. Agent identities inside Microsoft Entra that obtain OAuth tokens from Entra, best suited to systems that already accept Entra tokens.
- AgentValet. A managed credential broker for agents, and the product I build. It is one option in the broker category, alongside the others on the comparison pages.
How the approaches compare
The rows are the same eleven criteria used on every AgentValet comparison page. The Entra Agent ID column comes from Microsoft Learn; where Microsoft’s documentation doesn’t say, the cell says “Not documented”. The generic columns describe the pattern, so individual products will vary.
| Criterion | Shared keys in .env |
Secrets manager | Credential broker (generic) | Microsoft Entra Agent ID | AgentValet |
|---|---|---|---|---|---|
| Per-agent identity | None. Every agent using the key looks the same. | Possible if each agent gets its own machine identity and vault policy. | Yes, the agent authenticates to the broker as itself. | Each agent gets an agent identity, a special service principal created from a blueprint. | Each agent gets its own RS256 signing keypair and signs every request. |
| Credential exposure to the agent | The agent holds the real, long-lived key. | The agent fetches and holds the secret at runtime. | The agent never holds the long-lived credential. | Agent identities have no credentials of their own; the blueprint holds them, and blueprint credentials are shared by every agent identity created from it. | The agent never holds or sees the credential. |
| Token lifetime | Until someone rotates the key. | Static unless the manager issues dynamic secrets. | Short-lived by design; the IETF draft describes seconds to minutes. | Entra access tokens default to 60 to 90 minutes, configurable from 10 minutes to one day. | Each request carries a short-lived token signed by the agent; upstream credentials stay in the broker. |
| Scoping granularity | Whatever the key allows. | Per secret. | Per task or per call, set by broker policy. | OAuth scopes, app roles and Conditional Access; baseline permissions on the blueprint are inherited by its agent identities. | Per agent, per platform and per action, deny by default. |
| Human approval | None. | None at call time. | Often tiered, from auto-approve to approval with MFA. | Approval applies to access package requests, which grant time-bound access. Per-action approval: Not documented. | Risky actions pause at the broker until a person approves them. |
| Audit evidence | Whatever the upstream API logs, under one shared identity. | Secret-access logs. | Per-call decision logs. | Sign-in and audit logs that distinguish blueprint, agent identity and agent user account. | Every decision is logged with the policy, version, result and reason, and exports as CSV or JSON. |
| MCP support | The key sits in the MCP config file. | Varies by product. | Varies by product. | Entra can act as the authorisation server for an MCP server, with agents requesting tokens for it. | A native MCP server, and it brokers calls to upstream MCP servers as an OAuth client. |
| Self-host option | Yes, it’s your file. | Varies by product. | Varies by product. | Not documented. | No. It is a managed service hosted in Australia. |
| Open source | Not applicable. | Varies by product. | Varies by product. | Not documented. | The parts that run on your machines (MCP server, CLI, SDKs and adapters) are MIT licensed. The broker is not. |
| Setup time | Minutes. | Varies by product. | Varies by product. | Not documented. | One command, npx @agentvalet/register, registers an agent. |
| Starting price | Free. | Varies by product. | Varies by product. | Agent ID is available to all Microsoft Entra customers; extending Entra security features to agents requires a Microsoft Agent 365 licence. | Free plan, with paid plans from US$99 a month. |
Product-by-product detail is on the comparison pages for Aembit, Infisical Agent Vault, AWS AgentCore Identity, HashiCorp Vault and 1Password.
The control checklist, mapped to the standards
Each control below is mapped to what the three sources actually say. They are different kinds of document, and that matters when you cite them. The OWASP AI Agent Security Cheat Sheet gives practical recommendations. The NIST NCCoE concept paper on software and AI agent identity and authorisation (February 2026 draft, PDF) mostly poses questions and names candidate standards; it does not prescribe answers. The IETF Credential Broker for Agents (CB4A) is an individual Internet-Draft, version 00, which the datatracker lists as expired, with no standing in the IETF standards process. It is still the most detailed public design for this pattern.
| Control | OWASP AI Agent Security Cheat Sheet | NIST NCCoE concept paper | IETF CB4A draft |
|---|---|---|---|
| 1. One identity per agent, never a shared or human identity | No direct item. | Areas of Interest: “Identification of AI and Software Systems”, so access systems “can distinguish between agent and human identities”. Reviewer questions, section 2, Identification. | §4.1 SPIRE-Based Identity Layer: a SPIFFE ID per agent session. |
| 2. The agent never holds the long-lived credential | Closest is the Don’ts list in Do’s and Don’ts: don’t “log sensitive data (PII, credentials) in plain text”. | Reviewer questions, section 3, Authentication: “How do we handle key management for agents? Issuance, update, and revocation?” | Abstract: “Agents never hold real long-lived credentials.” §4.10.1: agents must not have direct credential access. |
| 3. Short-lived, sender-constrained tokens | High-Impact Action Integrity Controls: “Use short-lived authorization artifacts and replay protection for irreversible operations.” | Section 2 lists NISTIR 8587, Protecting Tokens and Assertions from Forgery, Theft, and Misuse, among the guidelines it will apply. | §3.2 Model B: Short-Lived Token Minting, the draft’s recommended model, and §4.5 Sender-Constrained Tokens using DPoP. |
| 4. Scope per action, deny by default | 1. Tool Security & Least Privilege: “Implement per-tool permission scoping (read-only vs. write, specific resources).” | Section 4, Authorization: “How do we establish ‘least privilege’ for an agent, especially when its required actions might not be fully predictable when deployed?” | §4.3 Policy Decision Point, which may narrow the requested scope. §2.1: the PDP “MUST never touch credential material.” |
| 5. Human approval bound to the exact action | 4. Human-in-the-Loop Controls: “Require explicit approval for high-impact or irreversible actions” and “Bind approval to the exact action.” | Section 4: “How do we bind agent identity with human identity to support ‘human-in-the-loop’ authorizations?” | §4.6 Tiered Approval Service and §4.6.2 Approval Fatigue Countermeasures. |
| 6. Delegation only ever narrows | 7. Multi-Agent Security: “Prevent privilege escalation through agent chains.” | Areas of Interest: “Access Delegation”, linking user identities to agents. Section 4: “How do we handle delegation of authority for ‘on behalf of’ scenarios?” | Appendix A.7, TM-6: Multi-Agent Scope Composition. |
| 7. Log every decision against the agent’s identity | 6. Monitoring & Observability: “Log all agent decisions, tool calls, and outcomes.” | Areas of Interest: “Logging and Transparency”. Section 5 asks how to ensure non-repudiation and “binding back to human authorization”. | §4.7: “Every interaction produces a structured, append-only log entry”. |
| 8. Fail closed | Section 4: “Fail closed when risk classification, approval validation, policy lookup, or audit logging fails.” | No direct item. | §4.7: no credentials issued if the audit trail is unavailable. §4.9 Secure Degradation. |
| 9. Revoke one agent fast, without collateral | No direct item. | Section 3 asks about revocation. Section 2 names SCIM as a potential way to “create, update and revoke agent identities across systems”. | §4.4 Credential Delivery Point: active leases can be revoked immediately. Appendix A.3, TM-2: Revocation Propagation Failure. |
Some of these have their own posts: approval design in Your agent’s approval prompt is a 2021 MFA push, revocation in Your agents have no off switch, and audit in What did the agent do last Tuesday?. If identity and permission still blur together for your team, Authentication or authorization: which problem are you solving for AI agents separates them.
Minting a scoped, short-lived token (vendor-neutral)
You can apply controls 1, 3 and 6 with plain OAuth before buying anything. OAuth 2.0 Token Exchange (RFC 8693) lets a service swap one token for another that is narrower, aimed at a single resource, and can record the agent as the actor alongside the user it works for. This example is generic. The host names, scope and token values are placeholders, and your authorisation server’s documentation decides what it supports.
POST /oauth2/token HTTP/1.1
Host: auth.example.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <the agent's own client credentials>
grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&subject_token=<the user's access token>
&subject_token_type=urn:ietf:params:oauth:token-type:access_token
&actor_token=<an assertion signed by the agent>
&actor_token_type=urn:ietf:params:oauth:token-type:jwt
&resource=https://api.example.com/invoices
&scope=invoices.read
A successful response looks like this:
{
"access_token": "<new token>",
"issued_token_type": "urn:ietf:params:oauth:token-type:access_token",
"token_type": "Bearer",
"expires_in": 300,
"scope": "invoices.read"
}
The client asks for the scope and resource, but the authorisation server decides the lifetime, so set a short default for agent clients there. The issued token should carry an act claim naming the agent, so downstream logs show who acted for whom, and its scope should never be wider than the subject token’s. For an agent working only for itself, the client credentials grant does the same job with one narrow scope and one resource (RFC 8707).
Plain OAuth leaves per-call policy, approvals and the decision log to each resource server, which is the gap a broker fills.
Getting started with AgentValet
If you want to try the broker pattern with AgentValet, registration is one command in your project directory:
npx @agentvalet/register
Per the getting started guide, the CLI opens your browser to sign in, generates a keypair on your machine (CLI 1.7.0 and later), registers the agent under your account, writes the private key to .agentvalet/agent.key in the project, and wires up the MCP config for the tools it detects. The agent starts with no platform access. To confirm the wiring, ask the agent to call list_platforms: an empty list is the expected answer, and a successful call shows the key signs correctly, the broker is reachable and the agent is active.
From there you connect a platform in the dashboard, grant the agent specific scopes, and turn on approval for writes and anything destructive.
Where Microsoft Entra Agent ID fits
If your agents mostly call Microsoft Graph and APIs already secured by Entra, Agent ID is the natural first stop. Agents get their own directory identity, Conditional Access and sign-in logs apply to them, and every agent identity requires a sponsor, a business owner accountable for it.
Two points from Microsoft’s documentation matter for design. Every agent identity created from a blueprint shares the blueprint’s credentials, and Microsoft says to “treat each blueprint as a credential boundary”. And Conditional Access for agents needs a Microsoft Agent 365 licence on top of Entra. Third-party SaaS that doesn’t accept Entra tokens still needs somewhere to keep its credentials and decide which calls an agent may make, so a broker and Agent ID can sit side by side.
Rolling it out without breaking things
The order that tends to cause the least disruption:
- Inventory. List every credential each agent can reach, including inherited ones on developer machines and keys in MCP config files.
- Separate identities. Give each agent its own identity before changing any permissions, so you can see what each one actually does.
- Move secrets out of reach. Put long-lived credentials behind a broker or a token exchange, so the agent holds only short-lived tokens.
- Narrow scopes. Use a week of per-agent logs to cut each grant down to the actions it really uses, and deny the rest.
- Gate the irreversible. Require approval for sending, deleting, paying and publishing. Leave reads and reversible writes unattended so approvals stay meaningful.
- Practise revocation. Revoke one test agent and confirm nothing else stops working.
Whichever tool you pick, the test is the same: for any action an agent took, you can name the agent, the person it acted for, the policy that allowed it, and the human who approved it if one was needed.