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).
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 actor and principal must have permissions in the same scope (or inherit from parent scopes):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