An agent's IAM role is not the user
There is a security bug hiding in a lot of otherwise impressive agent demos.
A support agent receives a request to look up an account. It calls a database tool; the database sees a powerful shared service account; the answer comes back. So far, so ordinary.
Then ask the question that matters: which person was actually allowed to see that account? “The agent did it” is not an answer. Neither is “the service role had access.”
An agent needs an identity of its own. It must authenticate to its runtime, retrieve configuration, emit telemetry, and establish a workload boundary. But that runtime identity must not silently become the authority for every user request it handles.
- Agent identity answers: what code is running?
- Delegated user authority answers: on whose behalf may this action happen?
Collapse those two things into one broad IAM role and you have built a very polite superuser.
The missing subject in the audit trail
Traditional applications kept this distinction clearer. A service could connect to infrastructure with its own identity while still enforcing the signed-in user’s entitlements before returning a document or executing a transfer.
Agents make it easy to lose that discipline because a tool call feels like an implementation detail. The model decides to call a customer lookup or refund function, a wrapper makes the HTTP request, and a service account does the rest. But that wrapper is not a neutral pipe. It is an authorization boundary.
When it substitutes a broad shared identity for the user’s authority, four things fail together:
- Auditability becomes storytelling. You can see that an agent queried a record, but not whether Alice requested it, could access it, or exceeded her scope.
- Tenancy can disappear. A cross-tenant tool may return data the requester could never legitimately see. Prompt-level filtering is not enforcement at the data boundary.
- Approvals lose their subject. “The agent can refund” is very different from “this operator may request a refund up to this amount.”
- Revocation becomes unreliable. Removing a user’s access should stop their agent-mediated access too. It cannot if the downstream system only sees a permanent service role.
This is especially hard to hand-wave away in fintech. If an agent looks up a balance, changes a beneficiary, or initiates a refund, an audit event naming only payments-agent-prod is not a defensible explanation. You need the person, the delegation, the decision, and the action.
Give the runtime an identity—then constrain the delegation
The solution is not removing agent identities. Production agents should use short-lived, narrowly permissioned workload identities. They should be able to call their orchestration plane, write logs, and ask a controlled broker for delegated credentials.
What they should not have is standing access to every customer’s data merely because a user might ask a relevant question.
For a user-facing tool call, issue a separate, short-lived credential carrying the requester’s authority and intended for that specific downstream service. OAuth token exchange provides a standards-based model for this: exchange a valid subject token for one constrained to a particular audience and scope.
The resulting flow is pleasantly boring:
- The user authenticates to the product.
- The agent runtime authenticates as its workload.
- A delegation service issues a short-lived token for the specific tool and permitted scope.
- The tool enforces the user’s entitlements alongside agent and application policy.
- The system records the user, agent, tool, delegation, scope, decision, and result.
Microsoft Foundry frames the choice neatly: shared authentication fits cases where every user should have identical access; individual authentication is for actions that must respect a user’s own permissions. AWS’s trusted identity propagation work tackles the same data-governance problem: the identity executing an agent should not erase the original caller when policy is evaluated.
Scope is where good intentions survive contact with tools
Passing user context downstream is necessary, but not sufficient. A long-lived bearer token with a generic API audience merely moves the blast radius around.
Make delegation narrower than the session:
- Audience-bound: a document-service token must not work against payments.
- Scope-bound: “read case 123” is not “export every case.”
- Time-bound: minutes, not days.
- Action-bound: preparing a refund is not submitting one.
- Context-bound: tenant, case, transaction, or repository constraints must be enforced by the resource server.
Put explicit approval beside consequences: money movement, entitlement changes, regulated-data exports, and outbound messages. The approval should name the user and proposed action, then produce a durable audit event—not a cheerful line in a chat transcript.
Service authority still has a place
Not every agent acts for a live person. A nightly reconciliation job or fraud-monitoring workflow can legitimately use service authority. The rule is simply that it must be honest about it: a named owner, bounded purpose, dedicated identity, constrained permissions, and a separate audit lane.
The test is straightforward: can an investigator tell whether a person requested the action, or whether the organisation’s automation performed it under an approved mandate? If not, the identity model is muddled.
A Monday-morning checklist
- Inventory shared agent roles and find every user-facing tool path.
- Identify where user identity is lost between conversation and resource server.
- Choose delegation rules for propagation, brokered impersonation, and legitimate service authority.
- Reduce downstream tokens by audience, scope, context, and lifetime.
- Place approvals at consequential boundaries, not agent setup time.
- Test revocation mid-session and make sure the next tool call fails correctly.
- Read one audit event like evidence: who requested it, which agent acted, which tool ran, what scope applied, why was it allowed, and what happened?
An agent runtime needs an IAM role. That is not controversial. The real question is whether that role is a carefully managed messenger—or an unaccountable replacement for the person who asked for help.
For user-facing agents, make it the messenger.
References
- AWS: Identity-aware AI data agents with Lake Formation and Trusted Identity Propagation
- Microsoft Foundry: Agent2Agent authentication
- Microsoft Foundry: MCP server authentication
- Google Cloud: Practical guidance for building with SAIF
- RFC 8693: OAuth 2.0 Token Exchange
To test my projects, I use Railway. If you want $20 USD to get started, use this link.