Skip to content
Workforce IdentityMarkdown

Agents acting for users

Decide which agents may act for which users, until when and with which scopes at most, with the realm's own delegation policies having the final say.

AvailableAPIRFC 8693

An assistant that reads a user’s mail, or an agent that pays their invoices, acts for that user. The realm lets it do so only when two things say yes: the agent’s link to the user, which sets a window and the most its tokens may hold, and the realm’s own delegation policies, which you write. The agent then gets a token that names the user as the subject and itself as the actor, so every API and every audit record sees both.

Neither yes is enough alone. A user can’t let an agent act for them against the realm’s rules, and a policy can’t let an agent act for a user it has no link to.

  • Who can do it: a realm administrator (a group holding RealmOwner) writes the links and the delegation policies; RealmViewer can read them. Users take a link back themselves, on their AI Agents page.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION). Users see and stop the agents acting for them on their own AI Agents page.
  • First: the agent and its client are registered (AI agents), and the realm and the client offer token exchange.

On the agent, an actsFor link to the user (or to another agent) it may act for, with:

PropertyWhat it does
validFrom, validToWhen the link is open. Outside that window it doesn’t exist
scopesThe most the agent’s token may hold. With none, the user’s own scopes bound it
impersonateWhether the agent may also act as the user, with no record of itself in the token
grantedByWho granted it

Whoever may write the agent may write its links.

The policy set named by authorizationSettings.delegationPolicySet (by default delegation) is asked about the resource delegation://<type>/<id> (the type of the one acted for, such as user or agent, and its id), for the action delegate (act for) or impersonate (act as). The agent is the subject, with the claims its own token carries: its risk class, autonomy tier and owner among them. The set is born empty, so no agent acts for anyone until you write a policy.

Only when both say yes does Token exchange issue the token: the user as sub, the agent in act, and scopes no wider than the user’s token, the link’s scopes and the client’s.

A token that names only the user, with no act, needs three yeses: the realm’s agentSettings.tokenExchangeImpersonation, the link’s impersonate, and a policy allowing impersonate. Without all three, the token names the agent.

Let invoice-agent act for maya until a date you choose, reading invoices only. Each call sends your session as $CVYUH_SESSION (Call the API).

Terminal window
curl -X POST https://foobar.cvyuh.com/api/v0/am/objects/v1/agent/invoice-agent/relationships/actsFor \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "targetId": "maya", "targetType": "user",
"properties": { "validTo": "<RFC 3339 time>", "scopes": ["invoices:read"] } }'

Then allow delegation by a policy in the delegation set, such as:

{ "active": true,
"resources": ["delegation://user/*"],
"actionValues": { "delegate": true },
"subject": { "type": "JwtClaim", "claimName": "principal_type",
"claimValue": "agent" } }

Let an agent act for a user walks through every step, including offering token exchange and linking the policy to its set.

The user sees each agent allowed to act for them on their AI Agents page, with what it may do and until when, and can Stop any of them: see Let users remove agents.

Setting or limitDefaultRange
Delegation policy set (delegationPolicySet)delegation, born empty: no agent acts for anyoneAny policy set in the realm
Agents acting in turn (maxActDepth)41 to 16
Acting as the user (tokenExchangeImpersonation)OffOn or off
SymptomCauseFix
Every exchange is refused, though the link existsNo policy in the delegation set allows delegate for this agentWrite and link an allowing policy (Let an agent act for a user)
Refused after working for a whileThe link’s validTo has passed, or the user took the agent backWrite a new link; ask the user
The token names the agent in act when you wanted the user aloneOne of the three yeses for acting as the user is missingTurn on tokenExchangeImpersonation, the link’s impersonate, and a policy allowing impersonate
The token holds fewer scopes than askedScopes are narrowed to the user’s token, the link’s scopes and the client’sWiden the narrowest of the three

Every exchange is a TOKEN_EXCHANGED record, allowed or refused, keyed by the user, with the agents in the chain and the token it came from. Every delegation decision is a POLICY_DECIDED record. A user taking an agent back is AGENT_TAKEN_BACK. Changes to an agent’s links are in its change history: Audit → Config.

  • Anything but an allow refuses. A deny, no matching policy, an undecided condition, or a realm without the set: no token.
  • An agent doesn’t act for itself, and an agent already in a token’s act chain doesn’t act in it again.
  • Chains are bounded. At most agentSettings.maxActDepth agents may act in turn (default 4, at most 16).
  • Taking it back stops the tokens. A user who takes back an agent’s delegation stops every token in which that agent acts for them, at the realm and at the gateway. Stopping the agent stops every token it’s in, at any depth. See What can be revoked.
  • On the audit trail. Every decision an agent is in goes on the realm’s audit trail, allow or deny.
WhereFieldWhat it sets
AgentactsFor link, with the properties aboveWhom it may act for, when, and how far
Realm, authorizationSettingsdelegationPolicySet (delegation)The policy set that decides
Realm, agentSettingsmaxActDepth (4, up to 16)How many agents may act in turn
Realm, agentSettingstokenExchangeImpersonation (false)Whether acting as a user is possible at all
Policy in the delegation setresources such as delegation://user/*, actionValues such as { "delegate": true }, a subjectWhich agents may act for whom