Agentic Pattern Libraryby Vikas Goyal
← All patterns
29

Delegated Agent Identity

Also known as: agent identity, on-behalf-of access, agent credentials

Agents get their own scoped, auditable credentials to act for a user.

TrackAgentic systems FamilyRuntime & interop Maturity Horizon ChangesTool/action
01

Problem

Agents often act with either a shared service account that can do far too much, or the user’s own full credentials. With a service account, logs can’t show which user an action was for, and one leaked key exposes everything. With user credentials, the agent can do anything the user can, and nobody can tell what the user did from what the agent did.

  • Agents need real access to act on users’ behalf.
  • Security wants least privilege and short-lived credentials.
  • Audit needs to show both the agent and the user behind each action.
  • Users must be able to see and revoke what agents can do for them.
02

Solution

Give each agent its own identity, registered like an application, and have it act through delegated, on-behalf-of tokens. A token names the agent, the user, the scopes granted (for example read calendar, draft but not send email) and a short expiry. Users grant scopes through a consent step and can revoke them. Every downstream system sees and logs both identities. High-risk scopes can require step-up approval each time instead of a standing grant.

03

Diagram

Usergrants consent Identity providerscopes · expiry Agent identityregistered app Tokenagent: Scheduling Agenton behalf of: employeescope: calendar.write · 1h Calendarlogs agent + user scopes issues requests call + token revoke anytime

Every action carries two names, the agent and the user it acts for, plus only the scopes that user granted, for a limited time.

04

When to use

Use it when

  • Agents act in systems on behalf of specific users
  • Audit must distinguish agent actions from human actions
  • Several agents need different, limited access
  • Users should control and revoke what agents can do

Avoid it when

  • The agent never touches user-specific data or systems
  • Target systems can't accept delegated tokens yet; use a gateway that maps them
  • A prototype with synthetic data only
05

Trade-offs

Latency Token checks are fast
Cost Identity setup per agent and per system
Complexity Registration, consent, scopes, token exchange, revocation
Reliability Least privilege and full attribution

Gains

  • Each action traceable to both the agent and the user
  • Least privilege, with short-lived, revocable access
  • Users stay in control of what agents can do for them

Costs

  • Identity plumbing across every target system
  • Older systems may not support delegated tokens
  • Consent prompts add friction if scopes are too granular
06

Worked example

Scenario
A scheduling agent books meetings for employees across calendars and email.
  1. RegistrationIT registers “Scheduling Agent” as its own identity. It may request calendar read/write and email draft scopes, but never email send.
  2. ConsentAn employee grants the agent calendar access and draft email for 90 days. The grant appears in their account settings with a revoke button.
  3. ActionThe agent books a meeting with a token that names the Scheduling Agent acting for this employee, with the calendar write scope, expiring in 1 hour.
  4. Calendar logShows “Created by Scheduling Agent on behalf of the employee”, not just the employee’s name.
  5. IncidentMonths later, a bug makes the agent double-book meetings. Security finds every affected event with one query on the agent identity and revokes its write scope for all users within minutes.
07

Failure modes

FailureSymptomMitigation
Shared super-accountOne agent key can access everything for everyonePer-agent identity; per-user delegated tokens with narrow scopes
Long-lived tokensLeaked token usable for monthsShort expiry; refresh only within the granted consent
Invisible delegationLogs show the user, not the agentBoth identities recorded in every downstream log
Scope creepAgents gradually granted broad scopes "to make it work"Periodic access reviews; step-up for sensitive scopes