Overview
TheonBehalfOf field in evaluation requests enables delegated authorization. When provided, Bedrock evaluates permissions for both the actor (who’s performing the action) and the principal (who they’re acting for).
Prerequisite: a Delegation Grant
Delegation is gated. Before any permissions are checked, an active delegation grant authorizing the actor to act for the principal in the scope must exist—otherwise the request is denied withNO_DELEGATION_GRANT. The “both have permission → allowed” logic below applies only once a grant is in place.
validFrom/validUntil) is checked against a trusted server clock—a forged context.now cannot revive an expired grant.
Evaluation Input
How Evaluation Works
Without onBehalfOf
Only the actor’s permissions are checked:With onBehalfOf
Both actor AND principal must have the permission:Decision Output
The decision includes delegation details:Example Response
Permission Scenarios
Scenario 1: Both Have Permission ✅
Scenario 2: Only Actor Has Permission ❌
Scenario 3: Only Principal Has Permission ❌
Scenario 4: Neither Has Permission ❌
Scope Considerations
Both legs are evaluated at the samescopeId, each composed per that scope’s permissionMode. Under the default override mode, each subject needs a membership at that exact scope; under inherit/additive, ancestor grants are pulled in.
Overrides Apply to Both
Scope overrides affect both actor and principal:Conditional Permissions
Conditions are evaluated for both actor and principal:Best Practices
Always use onBehalfOf for user-initiated agent actions
Always use onBehalfOf for user-initiated agent actions
When a user triggers an agent action, include their identity as the principal.
Give agents minimal permissions
Give agents minimal permissions
Agents should have the minimum permissions needed. Delegation ensures they can’t exceed user permissions.
Log both actor and principal
Log both actor and principal
For audit trails, always log both the actor and principal from the decision.
Consider agent-specific roles
Consider agent-specific roles
Create roles specifically for agents with appropriate permission sets.
Next Steps
Agent Delegation
Patterns for AI agent delegation