What is Delegation?
Delegation allows one subject (the actor) to perform actions on behalf of another subject (the principal). This is essential for AI agents, service accounts, and automated workflows that need to act within a user’s permission context.Why Delegation Matters
As AI agents become integral to workflows, you need to answer:- What can this agent access? — Agents need scoped permissions
- Whose permissions apply? — The agent’s, the user’s, or both?
- How do I audit agent actions? — Track both actor and principal
- How do I limit agent scope? — Agents shouldn’t exceed user permissions
The Delegation Model
Basic Example
Key Concepts
Actor
The entity actually performing the action. This is typically:- An AI agent
- A service account
- An automated workflow
- An API integration
Principal (onBehalfOf)
The entity whose permissions should also be checked. This is typically:- The human user who initiated the request
- The user who owns the session
- The user who authorized the agent
Dual Authorization
WhenonBehalfOf is provided, both the actor and principal must have the permission:
| Actor Has Permission | Principal Has Permission | Result |
|---|---|---|
| ✅ Yes | ✅ Yes | ✅ Allowed |
| ✅ Yes | ❌ No | ❌ Denied |
| ❌ No | ✅ Yes | ❌ Denied |
| ❌ No | ❌ No | ❌ Denied |
Use Cases
AI Coding Assistant
Automated Workflow
API Integration
Audit Trail
The decision includes both actor and principal for auditing:Without Delegation
IfonBehalfOf is not provided, only the actor’s permissions are checked: