Glossary
Least-privilege credentials
Least-privilege credentials are short-lived, narrowly scoped tokens that give an AI agent only the access a single task requires. The secret itself stays outside the model's context, so the agent cannot read, repeat or leak it.
Updated
What least-privilege credentials are
The principle of least privilege says that a user or program should hold only the permissions needed for its current job. Applied to AI agents, it means that the keys, tokens and passwords an agent uses to call tools are narrow in scope, limited in time and tied to one task.
Agents make this harder than ordinary software. An agent decides at run time which tools to call, and it reads untrusted text while it works. A broad credential in that setting is a standing risk, because anything that can steer the agent can use everything the credential allows.
Why secrets must stay out of the agent context
Whatever sits in a model's context window can be echoed back in an answer, written to a log or sent to an attacker through a crafted instruction. A key pasted into a prompt, an environment variable the agent can print or a file it can read is effectively exposed.
The safer pattern is indirection. The agent asks for an action, and a separate component attaches the credential when the call is made. The model sees the result of the call, never the secret.
Examples and scenarios
A support agent needs to read one customer's ticket history. A least-privilege setup issues a token that can read tickets for that customer only, and it expires within minutes. A broad setup hands the agent an API key that can read every ticket and also close accounts.
Consider a hidden instruction in a web page that tells the agent to send all customer records to an outside address. With a narrow token, the call fails because the credential cannot read those records. With a broad key, it succeeds.
Common practices
Teams usually combine several measures rather than relying on one.
Lifetime matters as much as scope. A token that expires in minutes limits the window in which a leaked value is useful, and a token tied to one run cannot be reused for a later task. Fewer standing secrets also make access reviews simpler.
- Issue a separate credential per agent and per task, never a shared one.
- Use short lifetimes, so a stolen token stops working quickly.
- Scope tokens to specific resources and operations, such as read-only access to one table.
- Hold long-lived secrets in a dedicated secret store, not in prompts, code or environment variables visible to the agent.
- Rotate and revoke credentials automatically when a run ends.
- Log every credential issue and use, so unusual access can be reviewed.
How Cager handles least-privilege credentials
In Cager, credentials stay outside the agent. Connected tools receive short-lived credentials, so the model does not hold the long-term keys behind the systems it uses.
Cager also lets builders set boundaries for data, web, actions and credentials before an agent goes to production. Sensitive actions are checked against policy before they execute. Cager is designed to limit what a misdirected agent can reach, and it supports a compliance programme with technical controls and evidence.