Skip to main content

Overview

The onBehalfOf 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 with NO_DELEGATION_GRANT. The “both have permission → allowed” logic below applies only once a grant is in place.
The temporal window (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 same scopeId, 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

When a user triggers an agent action, include their identity as the principal.
Agents should have the minimum permissions needed. Delegation ensures they can’t exceed user permissions.
For audit trails, always log both the actor and principal from the decision.
Create roles specifically for agents with appropriate permission sets.

Next Steps

Agent Delegation

Patterns for AI agent delegation