AI Agent Identity:委托授权
一句话:
AI Agent Identity / Delegated Authorization 解读
面向对象: AI Product Architect / Platform PM / Security Architect / Senior BA / Solutions Architect。 核心问题: Agent 不能靠共享 admin key 在系统里行动。生产级 Agent 必须有可追责 identity、可限制 delegated authorization、可撤销 session、可审计 claims。 学习目标: 把 OAuth/OIDC、token exchange、scope、consent、service account、tool invocation、step-up approval 和 audit claims 转成 AI agent identity architecture。
Source Anchors
| Source | Link | 用途 |
|---|---|---|
| OAuth 2.0 RFC 6749 | https://www.rfc-editor.org/rfc/rfc6749 | 参考 authorization grant、access token、scope 等基础授权模型 |
| OAuth 2.0 Token Exchange RFC 8693 | https://www.rfc-editor.org/rfc/rfc8693 | 参考 on-behalf-of / token exchange 的委托授权思维 |
| OAuth 2.0 Security BCP RFC 9700 | https://www.rfc-editor.org/rfc/rfc9700 | 参考 OAuth 安全最佳实践 |
| OpenID Connect Core | https://openid.net/specs/openid-connect-core-1_0.html | 参考身份认证、ID token、claims |
| SCIM RFC 7644 | https://www.rfc-editor.org/rfc/rfc7644 | 参考身份生命周期和跨系统用户管理 |
| NIST AI RMF | https://www.nist.gov/itl/ai-risk-management-framework | 把 identity / authorization 作为 AI 风险控制能力 |
一句话:
Agent identity architecture answers: who is acting, on whose behalf, with what authority, for what purpose, for how long, and with what evidence.
1. 为什么 Agent 需要身份架构
传统应用里, 用户点击按钮, 系统记录 user_id。Agentic AI 里, 事情变复杂:
human user
-> agent instance
-> workflow run
-> tool gateway
-> downstream system
如果所有调用都用一个 service account, 事故复盘会问不清:
- 是哪个用户触发的。
- 是哪个 agent 版本执行的。
- 是哪个 workflow run 做的。
- 它代表用户还是代表组织。
- 它是否有权调用这个工具。
- 它是否越过了 consent、tenant、purpose、risk tier。
所以 identity 不是安全团队的边角问题, 而是 AI 产品边界。
2. Identity Taxonomy
| Identity | 说明 | 需要记录 |
|---|---|---|
| Human user | 触发、审批或使用 AI 的人 | user_id, role, tenant, entitlement |
| Agent instance | 执行任务的 agent 角色/实例 | agent_id, version, policy profile |
| Workflow run | 一次业务执行 | run_id, case_id, purpose, risk tier |
| Tool client | 调用工具的技术主体 | client_id, tool scope, environment |
| Vendor agent | 外部模型/agent 服务 | vendor_id, model_id, data boundary |
| Supervisor | 审批或限制 agent 的控制层 | policy decision id, approval id |
| Human reviewer | 人类复核者 | reviewer_id, decision, rationale |
关键点:
human identity != agent identity != tool identity
三者必须能在 trace 中关联, 但不能混成一个共享账号。
3. Delegated Authorization Flow
典型 agent 授权链:
User authenticates
-> user grants task consent / has enterprise entitlement
-> workflow creates agent run
-> agent receives purpose-bound delegated token
-> tool gateway validates scope, policy, tenant, risk tier
-> downstream service records user + agent + run claims
-> evidence log stores decision and action
设计重点:
- token 不应长期有效。
- scope 应该任务化, 不是系统级。
- 写入型工具和只读工具分离。
- 高风险动作触发 step-up approval。
- 撤销应能停止 agent run 和 tool token。
- downstream system 要能记录 on-behalf-of claims。
4. Scope 设计
低质量 scope:
crm.full_access
payments.admin
loan.write
高质量 scope:
crm.case.read
crm.case.note.create
crm.task.create
payments.dispute.read
payments.dispute.draft_response
loan.policy.read
loan.exception.submit_for_review
Scope 要回答:
| 问题 | 设计原则 |
|---|---|
| 是否能读 | data minimization |
| 是否能写 | write separation |
| 写入是否可逆 | rollback / compensation |
| 是否客户可见 | human approval |
| 是否影响金融结果 | higher risk tier |
| 是否跨 tenant | deny by default |
| 是否需要 purpose | purpose-bound token |
5. Consent / Purpose / Step-up
Agent 授权不是一次性同意所有。
| 场景 | 授权方式 |
|---|---|
| 普通知识问答 | enterprise entitlement + logging |
| 读取客户 case | user role + purpose + tenant check |
| 创建内部 task | delegated scope + trace |
| 发送客户通知 | human approval + step-up |
| 修改账户/贷款状态 | high-risk approval workflow |
| 访问敏感数据 | need-to-know + short session + audit |
| 事故处理 | break-glass + post-review |
Consent UX 要避免让用户看不懂:
This agent can read customer complaint history and draft a response.
It cannot send the response, waive fees, or close the complaint without your approval.
6. 金融零售案例
6.1 CRM update agent
允许:
- 读客户联系历史。
- 生成 case summary。
- 创建内部 task。
- 写入 draft note。
禁止:
- 修改客户个人核心信息。
- 关闭投诉。
- 覆盖人工审核结论。
6.2 Payment dispute assistant
允许:
- 读取交易和 dispute case。
- 草拟证据请求。
- 推荐下一步。
高风险:
- 自动拒绝 dispute。
- 自动退款。
- 通知客户最终决定。
6.3 Loan servicing agent
允许:
- 解释政策。
- 检查缺失材料。
- 生成内部 checklist。
禁止:
- 自动改变 repayment plan。
- 自动批准 hardship relief。
- 自动触发 adverse action。
7. Failure Modes
| Failure | 具体表现 | 控制 |
|---|---|---|
| Confused deputy | agent 被恶意输入诱导调用高权限工具 | purpose-bound token + policy gate |
| Privilege creep | agent scope 越加越大 | scope review + expiry |
| Shared secret | 多个 agent 共用 admin key | per-agent client + token exchange |
| Stale consent | 用户授权过期仍可行动 | token TTL + revocation |
| Cross-tenant leakage | agent 读取其他客户/机构数据 | tenant claim enforcement |
| Missing audit | 下游只看到 service account | actor chain claims |
| Vendor overreach | vendor agent 获得过宽数据/工具访问 | vendor boundary + proxy gateway |
8. Agent Identity Card
# Agent Identity Card
Agent name:
Agent id:
Owner:
Business purpose:
Risk tier:
Allowed users/roles:
Allowed tenants:
Allowed tools:
Read scopes:
Write scopes:
Prohibited scopes:
Token TTL:
Step-up triggers:
Revocation mechanism:
Audit claims:
Downstream systems:
Review cadence:
9. Audit Claims
每一次 tool call 至少应能回答:
| Claim | 示例 |
|---|---|
| human_actor | user_123 |
| agent_actor | complaint_triage_agent:v2.1 |
| workflow_run | run_abc |
| purpose | complaint_triage |
| tenant | retail_bank_us |
| tool | crm.case.note.create |
| scope | case.note.create |
| policy_decision | allow / deny / step_up |
| approval_id | approval_789 |
| model_config | model + prompt version |
| evidence_id | trace / span / event id |
10. 面试表达
30 秒版本:
我不会让 AI agent 用共享 admin key 调系统。Agent 必须有自己的身份, 并且通过 delegated authorization 代表用户或组织在明确 purpose、scope、tenant、TTL 和风险等级内行动。每次 tool call 都要记录 human actor、agent actor、workflow run、scope、policy decision 和 evidence id。
2 分钟版本:
我会把 identity 设计成三层: human user、agent instance、tool/service client。用户或组织授权一个具体任务, workflow 创建 agent run, agent 通过 token exchange 获得 purpose-bound delegated token, tool gateway 检查 scope、tenant、risk tier 和 policy。 Scope 设计会细到业务动作, 例如
crm.case.note.create, 而不是crm.full_access。读写分离, 客户可见和金融影响动作触发 step-up approval。Token 要短期有效, 可撤销, 并且 downstream system 必须记录 on-behalf-of claims。 这样做的价值是: 出现事故时能回答谁触发、哪个 agent、代表谁、用什么权限、为什么被允许、谁审批、产生了什么影响。
11. Portfolio Exercise
为一个 payment dispute assistant 设计:
- agent identity card。
- delegated authorization matrix。
- scope catalog。
- step-up triggers。
- audit claims spec。
- revocation runbook。
最终输出一张图:
human -> agent run -> token exchange -> tool gateway -> downstream service -> evidence log