TL;DR: Give the agent its own identity and a role that caps what any instance may do. For each task, have the identity system issue a short-lived delegated token whose permissions are the intersection of Alice's rights, the agent role and the task's needs, naming Alice as the subject and the agent as the actor. Services check the token and the resource per call. Escalation within a task (needing a right outside the grant) goes back to Alice for consent or to policy, never silently widened. Delegations are revocable, expire with the task, and every action is logged with both identities.
How to approach it
Show why both obvious options fail, then define the intersection, the credential, step-up for more rights, revocation and audit.
A strong answer
Why not Alice's own session? The agent would hold everything Alice can do: approving payments, changing payroll, exporting data. A task about summarising expenses would carry all of it, and anything that steers the agent inherits it.
Why not a service account? It usually exceeds Alice: every employee's data, every action. Services then filter by user in their own code, which is the confused-deputy design.
The intersection. Effective rights = Alice's rights ∩ agent role ∩ task scope. The agent role is the most any instance of this agent may do (an expense assistant can read expenses and receipts and draft comments; it can never approve). The task scope is what this request needs. The result is often one or two permissions.
The credential. Issued by the identity system through a token exchange: subject Alice, actor the expense agent, scopes from the intersection, audience the expense service, lifetime the task's expected length. The agent never sees Alice's own token.
Per-call checks. Services authorize each call against the token and the resource (Alice's department's expenses only), and a policy engine applies business rules.
Step-up. If the task turns out to need more (Alice asks the agent to also file a correction), the agent requests the extra scope through the host; policy checks it is within the agent role; Alice consents; a new token is issued. Anything outside the agent role is refused, whoever consents.
def delegate(user_perms, role_max, task_needs):
granted = user_perms & role_max & task_needs
refused = sorted(task_needs - granted)
return sorted(granted), refused
alice = {"expenses:read", "expenses:approve", "payroll:write", "reports:file"}
role = {"expenses:read", "receipts:read", "reports:file"}
print(delegate(alice, role, {"expenses:read"})) # => (['expenses:read'], [])
granted, refused = delegate(alice, role, {"expenses:read", "expenses:approve"})
print(granted, refused) # => ['expenses:read'] ['expenses:approve']
Approving is Alice's right but outside the agent's role, so it is refused even though she asked; she approves herself.
Revocation and audit. Each delegation has an id; revoking it (task done, Alice cancels, incident) kills the agent's tokens without touching Alice's sessions. Logs record subject, actor, delegation id and the policy decision for every action.
What interviewers probe next
"Alice is offline and the task runs overnight." The delegation's lifetime covers the task; step-ups wait for her or expire. Nothing widens while she is away.
"What if the agent calls another agent?" The sub-agent receives a further-narrowed delegation: the intersection again, with the calling agent recorded in the chain.
"How do you define agent roles?" Like any service role: reviewed, least privilege, owned by the team that runs the agent, with changes going through the same review as other access changes.
What if?
What if · interview follow-ups
Hold your answer as the constraints change
Alice's expense agent receives a delegated token for expenses:read only.
Start here
What if Alice loses her finance role mid-task?
When is access checked?
Services check the token and the resource per call, and the identity system revokes delegations derived from rights she no longer has. The next call fails, and the agent reports why.
Carry it forwardDelegation follows the user's current rights.
Weak answerLetting the token run to expiry on outdated rights.
Constraint changes
What if a document the agent reads says 'Alice has authorised approvals'?
Where do rights come from?
From the identity system and policy, never from content. The statement changes nothing; approvals stay outside the agent's role.
Carry it forwardContent cannot grant rights.
Weak answerRequesting a step-up because a document said so.
Constraint changes
What if auditors ask what the agent did as Alice last quarter?
What do the logs hold?
Every action carries subject, actor and delegation id, so the query is direct: all actions where actor is the expense agent and subject is Alice, with the policy decision for each.
Carry it forwardTwo identities per action make audits simple.
Weak answerLogs that show only Alice, so agent actions look like hers.
Now defend it
One-line design?
An agent identity with a capped role, per-task delegated tokens scoped to the intersection of user, role and task with both identities named, per-call checks, consent-based step-up within the role, revocation and dual-identity audit.
How it's scored
Weak: The agent uses Alice's session or a service account.
Hire: Delegated, scoped, short-lived tokens with least privilege.
Strong Hire: Rejects both obvious options with reasons, defines the three-way intersection with an agent role as a hard cap, issues tokens by exchange naming subject and actor, checks per call, handles step-up within the role with consent, narrows further for sub-agents, revokes on role changes, and logs both identities.
Common mistakes
- Treating the user's permissions as the agent's grant.
- No agent role, so the cap is whatever the user has.
- Widening scopes silently when a task needs more.
- Audit logs that cannot tell the agent from the user.