Agent Identity and Access Control

Who is the agent acting as? Agent identities, acting on behalf of users with OAuth token exchange, least-privilege scopes, per-hop authorisation across tools and agents, credential vaults, consent, and audit — the access-control architecture enterprise agents need.

On this page

Simple definition#

Agent identity and access control answers three questions for every action an agent takes: who is acting (the agent, the user, or both), what are they allowed to do, and how can we prove later what happened. Agents are a new kind of non-human identity that often act on behalf of a human, so classic service-account thinking is not enough.

The problem#

Common anti-patterns:

  • One powerful service account shared by the agent for all users — every prompt injection gets admin rights.
  • The user’s full token passed through to every downstream API — far more scope than any single task needs.
  • Identity taken from model-generated arguments — the model can be tricked into acting as someone else.
  • No record of which agent performed an action for which user.

Identity models#

Model Who acts Use for
User-delegated (on behalf of) Agent acts for a specific user, with that user’s permissions narrowed to the task Assistants and copilots acting for employees or customers
Agent’s own identity Agent acts as itself, with its own least-privilege permissions Autonomous back-office agents, scheduled jobs
Hybrid Agent identity + user context; access = intersection of both Most enterprise agents: agent may only do what both the agent and the user are allowed
Effective permission = user ∩ agent ∩ task scope
flowchart LR
    U["User permissions<br/>what this person may do"] --> I(("∩"))
    A["Agent permissions<br/>what this agent may ever do"] --> I
    T["Task scope<br/>what this request needs"] --> I
    I --> E["Effective permission<br/>for this call"]

Delegation with OAuth token exchange#

On-behalf-of flow across agent, MCP server and API
sequenceDiagram
    actor U as User
    participant APP as Agent app
    participant IDP as Identity provider
    participant AG as Agent runtime
    participant MCP as MCP server (CRM)
    participant API as CRM API
    U->>APP: sign in (OIDC)
    APP->>IDP: user token for agent app
    APP->>AG: task + user token
    AG->>IDP: token exchange: user token + agent identity, audience=CRM MCP, scope=crm.read
    IDP-->>AG: short-lived delegated token
    AG->>MCP: tools/call + delegated token
    MCP->>MCP: validate audience, scope, user, agent
    MCP->>IDP: exchange for API token (scope=contacts.read)
    IDP-->>MCP: API token
    MCP->>API: GET /contacts (as user via agent)
    API-->>MCP: data the user may see
    MCP-->>AG: result

Principles:

  • Short-lived, audience-bound tokens for each hop (OAuth 2.0 Token Exchange, RFC 8693; resource indicators, RFC 8707).
  • No token passthrough — each service obtains its own token for the next hop (the MCP specification requires this).
  • Scopes per task, not per agent lifetime.
  • The token carries both identities (user and agent, for example an act claim) so every service can authorise and audit correctly.

Authorisation at every hop#

Per-hop authorisation
flowchart LR
    AG["Agent"] -->|"token A"| G["MCP gateway<br/>is this agent allowed this tool?"]
    G --> S["MCP server<br/>is this user allowed this record?"]
    S --> B["Business service<br/>limits, ownership, approvals"]
    B --> D[("Data")]
  • Gateway: agent-level allow-lists of servers and tools, rate limits.
  • MCP server / tool: user-level authorisation on the specific resource.
  • Business service: domain rules — amount limits, ownership, approval thresholds.
  • Multi-agent delegation: a sub-agent never gets more rights than the delegating agent; re-authorise at each A2A hop.

Credentials and secrets#

  • Store third-party credentials in a token vault; the harness injects them into tool calls — the model never sees them.
  • Prefer workload identity (cloud IAM roles, SPIFFE) over static API keys for agent runtimes.
  • Rotate and expire; revoke on agent decommissioning.
  • Users should see what an agent can do on their behalf and grant consent for sensitive scopes (OAuth consent screens, step-up approval).
  • Provide a way to revoke an agent’s delegated access.
  • Show who acted in audit logs and in the UI (“Created by Support Agent on behalf of J. Smith”).

Agent registry#

Treat agents as first-class identities:

Registry field Purpose
Agent ID and owner Accountability
Purpose and risk tier Governance
Allowed tools / MCP servers / A2A peers Least privilege
Identity model (delegated, own, hybrid) Access design
Credentials and rotation Hygiene
Status (active, suspended, retired) Lifecycle and kill switch

Managed platforms increasingly provide agent identity services; see managed platforms.

Common mistakes#

Review questions#

How should an agent authenticate when acting for a user? With a short-lived delegated token obtained by OAuth token exchange, bound to the target audience and narrowed to the task’s scopes, carrying both user and agent identity — never by passing the user’s original token through.

What is the effective permission of an agent’s action? The intersection of the user’s permissions, the agent’s permissions and the scope the task needs.

Where should authorisation happen in an agent architecture? At every hop: gateway (agent may use this tool), tool or MCP server (user may access this resource), business service (domain limits and approvals), and again at each agent-to-agent delegation.

Why keep an agent registry? To know which agents exist, who owns them, what they may access, how they authenticate, and to suspend them quickly.

Summary#

  • Agents are non-human identities that often act on behalf of users.
  • Use delegated, short-lived, audience-bound tokens via token exchange; never pass tokens through.
  • Authorise at every hop; effective permission = user ∩ agent ∩ task.
  • Vault credentials, register agents, record both identities in audit logs.

References#