1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →
How do you design authorization for an agent that acts on behalf of users across systems (email, CRM, drive)?
30-second answerSay your answer out loud first, then reveal.

Principles
- Identity comes from the session, not the prompt. The tool gateway attaches
user_idand tenant; the model can't impersonate another user by writing a different ID. - Delegated, least-privilege credentials: per-user OAuth tokens with minimal scopes (
gmail.readonlyunless sending is needed), stored in a vault, never placed in the model context. - Policy engine (e.g. OPA/Cedar-style rules) evaluates who may do what to which resource, plus agent-specific rules: "the agent may draft but not send to external domains."
- Separate agent identity: record actions as "Agent X on behalf of User Y" for auditing and revocation.
- Step-up / HITL for high-impact actions: sending externally, deleting, sharing files publicly, payments.
- Short-lived, revocable tokens, and an emergency kill switch per agent.
- Data-level controls: the agent sees only documents the user can see (permission-aware retrieval). This is critical for enterprise RAG.
- Audit: every tool call logged with the trace ID, inputs, outputs and approval.
Common mistakes
- Giving the agent a single service account with admin access "for simplicity." That creates a confused-deputy problem: any user, or any injected text, can make the agent act with admin rights.
Related
This is what real progress feels like.