Why it matters
When an agent calls a database, a payment API or a mailbox, the downstream system sees only a credential. If that credential is a human's, the audit log says a person did it, the blast radius is that person's full access, and revoking it breaks their work. Identity design makes each run a first-class principal with narrow, expiring rights and a chain back to the authorising human.
Mental model
An agent identity is a visitor badge printed for one meeting, not the master key to the building. The metaphor breaks because a badge is checked by a guard who can see the face, while a token is checked by a service that cannot tell whether the agent is still doing the job it was issued for.
How it works
The run is its own principal: one delegation chain, one short-lived scope, and enforcement at the resource.
Step 1 of 6
Read the shape
One chain from a human to a tool, with the scoped credential beside it. Every arrow is a place where identity should be recorded; the conflict arrow is a hypothetical attempt on a resource the task does not need.
Narrow layout: nodes in reading order, each followed by its outgoing edges. The wide drawing shows the same graph as geometry.
agent
3 connections
Orchestrator
run principal 7f2
A first-class principal in the identity provider, not a shared service account. Its token names the run and the authorising user, so a downstream call is attributable to both.
No outgoing edge.
No outgoing edge.
user · agent · store · tool · 7 nodes · 9 edges · fixed authored layout, no simulation · list
Figure. An agent acts as the run's own principal, not as the user who triggered it. The delegation chain runs from requester to orchestrator to a short-lived credential scoped to one mailbox, and the mail API enforces that scope at the resource. The conflict edge is the confused deputy as a hypothetical attempt: reaching the drive would need a drive.write grant the run never issued.
What to notice. Identity is a chain, permission is a per-task scope, and enforcement sits at the resource rather than in the prompt. The figure omits the identity provider's token format, the OAuth exchange itself and refresh handling; token lifetimes, run ids and scope strings are illustrative. It shows the failure edge, not a complete permissions matrix.
Text version
Seven nodes. A requester authorises an orchestrator, which delegates to a mail agent. The mail agent requests a credential, receives a fifteen-minute token scoped to mail.send, and calls the mail API with it; the API writes principal and run id to an audit log, and issuance and expiry are also logged. The orchestrator records the delegation chain in the same log. A conflict edge from the mail agent to a drive API is labelled needs drive.write and is hypothetical: no drawn credential authorises it. Steps light the whole graph, the per-run principal, the requested scope, resource enforcement, the confused deputy and revocation.
- Give each agent or run a distinct principal in your identity provider instead of reusing one service account for everything.
- Request credentials per task, scoped to one mailbox, one repository or one amount limit, with a short expiry.
- Record the authorising human and the delegation chain in the token or beside it, and log both.
- Enforce authorisation at the resource, so a persuaded model cannot exceed its grant.
- Revoke per run when the task ends; a finished task should leave no usable credential behind.
- Alert on privilege use that is unusual for the agent's task class.
Trade-offs
| Choice | Good for | Cost | Fails when |
|---|---|---|---|
| Act as the user | Inherits exactly the user's rights | Audit cannot separate agent from human, blast radius is the user | Actions are consequential or regulated |
| Shared service account | Simple to operate | No attribution, one leak exposes everything | More than one agent or team uses it |
| Per-run scoped token | Least privilege, clean audit | Token issuance latency and plumbing | Downstream systems cannot issue fine-grained tokens |
| Long-lived agent credential | No issuance overhead | Standing privilege and rotation burden | The agent runs unattended for long periods |
Good for
Inherits exactly the user's rights
Cost
Audit cannot separate agent from human, blast radius is the user
Fails when
Actions are consequential or regulated
- Actions are consequential or regulated
- More than one agent or team uses it
- Downstream systems cannot issue fine-grained tokens
- The agent runs unattended for long periods
Figure. Each choice with what it buys, what it costs, and the case where it loses.
What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.
Text version
Four trade-offs: Act as the user is good for Inherits exactly the user's rights, costs Audit cannot separate agent from human, blast radius is the user, and fails when Actions are consequential or regulated. Shared service account is good for Simple to operate, costs No attribution, one leak exposes everything, and fails when More than one agent or team uses it. Per-run scoped token is good for Least privilege, clean audit, costs Token issuance latency and plumbing, and fails when Downstream systems cannot issue fine-grained tokens. Long-lived agent credential is good for No issuance overhead, costs Standing privilege and rotation burden, and fails when The agent runs unattended for long periods
Failure modes
- Confused deputy. The agent uses its own broad rights to do something the requester could not. Debug: compare the run's effective permission set with the requester's and flag the difference.
- Unattributable action. Logs show a service account and no run id, so an incident cannot be traced. Debug: assert every outbound call carries a run id and principal, then sample the logs.
- Orphaned credential. A crashed run leaves a valid token that outlives the task. Debug: list credentials by issue time and find those with no live run.
In production
Monitor credential lifetime, scope and failed authorisation attempts per agent. Rehearse revocation by killing a run mid-task and confirming its token stops working before the next scheduled run.
Common misconceptions
People think: The agent only needs the user's permissions.
Actually: It needs fewer: a task rarely requires everything the user can do, and attribution requires a separate principal.
People think: A prompt instruction not to exceed scope is access control.
Actually: Only the resource server enforces scope; the prompt is a request to the model.
Interview angle
Strong answers separate authentication from authorisation, describe the delegation chain and put enforcement at the resource. They mention revocation and the confused deputy by name. Weak answers say the agent uses a service account and stop there, leaving attribution and blast radius unaddressed.
Sources
- RFC 8693, OAuth 2.0 Token Exchange — representing a delegation chain between principals.
- RFC 6749, The OAuth 2.0 Authorization Framework — scopes, grants and token lifetimes.
- OWASP, Top 10 for Large Language Model Applications — excessive agency as a failure of permission design.