Question-led guide · security
How should an agent use delegated, short-lived identity?
An identity chain that separates human, workload, task, resource, delegation, approval, and short-lived credentials for agent actions.
Direct answer
An agent should obtain a short-lived credential for one bounded task, actor, target resource, audience, operation set, and time window. Keep human identity, agent workload identity, task identity, delegated authority, and approval as separate linked records. Exchange credentials through a trusted broker, enforce scope and audience at the target, reauthorize at commit time, and never place reusable secrets in prompts, memory, or tool descriptions.
Scope
Use this pattern when an agent calls internal or external services on behalf of a person or workload. It applies to delegated reads and changes. It does not assume OAuth is the only identity system; the core requirement is explicit, short-lived, target-bound authority enforced outside the model.
Why it happens
Prototype agents receive an API key in an environment variable and use it for every user and tool. The key collapses the service owner, current user, agent process, task, and target into one ambient authority. If a prompt injection changes the plan, the same credential remains usable.
Passing the user’s full token is not much better. The model or tool runtime may see a credential with unrelated scopes, long lifetime, and several audiences. Audit logs show the user but lose the fact that an agent proposed and executed the action.
Diagnosis
Trace one sensitive tool call and identify:
- the human or service principal requesting the task;
- the agent workload instance executing it;
- the durable task and proposed action;
- the delegation rule and current policy decision;
- the protected resource, tenant, and audience;
- the credential issuer, lifetime, scope, and revocation path;
- the target-side decision and resulting effect.
If the answer is one API key or a token copied into the prompt, the system cannot enforce or explain least privilege reliably.
Solution
Give the agent runtime a workload identity used to authenticate to a trusted broker. The broker evaluates the requesting actor, task, policy, approval, resource, operation, and risk. It issues or exchanges for a narrow credential whose audience and expiry match the target and expected execution time.
Keep credentials out of model-visible context. The tool adapter attaches them after the model has produced a typed proposal. The gateway and target service validate issuer, audience, expiry, sender binding if available, scope, tenant, and current policy. Recheck action-specific authorization at commit.
Record delegation without putting raw tokens in telemetry. Use actor, subject, workload, task, policy-decision, token ID hash or safe reference, target, and effect identifiers.
Artifact
Complete this identity-chain worksheet for each tool class:
| Link | Required record |
|---|---|
| Requesting actor | Canonical identity, tenant, role, authentication strength |
| Agent workload | Service identity, instance, software version, environment |
| Task | Durable ID, purpose, owner, risk tier, deadline |
| Proposal | Operation, parameters digest, target, expected effect |
| Delegation | Actor/subject relationship, permitted operation, conditions |
| Approval | Approver authority, proposal digest, policy, expiry |
| Credential | Issuer, audience, scope, lifetime, sender binding, revocation |
| Target decision | Resource identity/version, current policy, allow/deny reason |
| Effect | Idempotency key, actual outcome, receipt, verification, audit link |
Common mistakes
- Reusing a platform-wide API key for every user and task.
- Exposing bearer tokens to the model, transcript, memory, or general logs.
- Minting a fresh token without rechecking the exact pending action.
- Validating scope at the gateway while the target trusts network location.
- Logging “acted as user” without preserving workload, task, delegation, and approval.
Evidence
Agent identity and authorization need explicit treatment across software and AI agents rather than reuse of undifferentiated long-lived credentials.
The NIST NCCoE concept paper describes challenges and desired capabilities for software and AI agent identity and authorization.
Primary source · official-doc · checked Aug 26, 2026
Limit: It is a concept paper and does not define a complete production protocol or certify an implementation.
OAuth token exchange provides a standardized way to request tokens based on another security token and to represent delegation or impersonation context.
RFC 8693 defines OAuth 2.0 Token Exchange, subject and actor token concepts, requested token types, and processing behavior.
Primary source · standard · checked Aug 26, 2026
Limit: Token exchange is a mechanism; policy, approval, least privilege, and secure target enforcement remain deployment responsibilities.
OAuth resource indicators can bind authorization requests and access tokens to intended protected-resource audiences.
RFC 8707 defines the `resource` parameter for protected-resource identification in OAuth authorization and token requests.
Primary source · standard · checked Aug 26, 2026
Limit: Audience restriction does not ensure the operation, target object, parameters, or current state are authorized.
Limitations
Identity infrastructure can be compromised, revocation can lag, and not every target supports token exchange, audience restriction, or fine-grained scopes. High-impact actions need current policy, exact target and proposal binding, and independent approval where required.
FAQ
- Can the agent act directly with the user's access token?
- Avoid handing a broad user token to the model or tool runtime. A broker should derive a narrower, audience-bound, short-lived credential and preserve the actor/delegation chain for enforcement and audit.
- Does short lifetime compensate for broad scope?
- No. Short lifetime reduces exposure duration; least privilege limits what compromise can do. Use both, plus target-side policy, revocation, monitoring, and action binding.
Related guides
Continue within AI agent security, or use one of these adjacent diagnostics:
Editorial QA: automated native-English, structure, source-presence, and link checks completed . This record is not an independent expert endorsement. Review boundary.
