当 RAM 用户在 AgentLoop Playground 中访问 Prompt 管理功能时提示权限不足,可参考本文为 RAM 用户配置所需的 AI Registry 访问权限。本文提供只读和读写两种最小权限策略及配置步骤。
只读权限策略
仅需在 Playground 中查看和选择 Prompt 时,配置以下最小权限策略:
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"airegistry:Read",
"airegistry:CreateNamespaceWithSource",
"airegistry:ListNamespaceBySource",
"airegistry:ListPrompts",
"airegistry:ListPromptVersions",
"airegistry:GetPrompt",
"airegistry:GetPromptVersion",
"airegistry:GetPromptVersionDetail",
"airegistry:GetPromptGovernance",
"airegistry:GetSupportedModels"
],
"Resource": "acs:airegistry:*:*:instance/saas/*"
}
],
"Version": "1"
}包含以下权限:
客户端读权限:
airegistry:Read,用于客户端通过 SDK / API 拉取 Prompt 资源。工作空间:通过数据源创建和查询工作空间(AgentLoop 集成所需)。
模型列表:获取支持的模型列表。
Prompt 只读:查询 Prompt 列表、版本列表、版本详情和治理信息。
说明只读策略中包含
CreateNamespaceWithSource是因为 AgentLoop 首次访问 Prompt 管理时会自动关联 AI Registry 工作空间。此操作仅在首次访问时触发且不会创建用户数据,因此包含在只读策略中。
读写权限策略
需要在 Playground 中创建、编辑、发布、删除或 AI 优化 Prompt 时,配置以下权限策略:
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"airegistry:Read",
"airegistry:CreateNamespaceWithSource",
"airegistry:ListNamespaceBySource",
"airegistry:ListPrompts",
"airegistry:ListPromptVersions",
"airegistry:GetPrompt",
"airegistry:GetPromptVersion",
"airegistry:GetPromptVersionDetail",
"airegistry:GetPromptGovernance",
"airegistry:GetSupportedModels",
"airegistry:CreatePrompt",
"airegistry:UpdatePrompt",
"airegistry:DeletePrompt",
"airegistry:CreatePromptVersion",
"airegistry:UpdatePromptVersion",
"airegistry:SubmitPromptVersion",
"airegistry:DeletePromptVersion",
"airegistry:InvokePromptOptimizeStream"
],
"Resource": "acs:airegistry:*:*:instance/saas/*"
}
],
"Version": "1"
}相比只读策略,增加了以下权限:
Prompt 管理:创建、更新、删除 Prompt 及其版本,发布版本。
Prompt 优化:使用 AI 辅助优化 Prompt(
InvokePromptOptimizeStream)。
限制资源范围(可选)
上述策略中 Resource 使用了 acs:airegistry:*:*:instance/saas/*,表示授权访问所有 AI Registry 工作空间。如需将权限限制到特定工作空间,将最后一个 * 替换为工作空间 ID:
"Resource": "acs:airegistry:*:*:instance/saas/<工作空间ID>"AI Registry 工作空间 ID 可在 AgentLoop 的 Prompt 管理页面获取。每个 AgentLoop 工作空间唯一映射一个 AI Registry 工作空间。
如需进一步限制到 Prompt 资源类型,需要注意 Prompt 相关接口存在两种资源类型:
具体资源操作(如创建、更新、删除、发布、调试、优化等):使用
prompt/*"Resource": "acs:airegistry:*:*:instance/saas/{工作空间ID}/DEFAULT/prompt/*"集合级操作(列表查询):使用
prompt(不带/*)"Resource": "acs:airegistry:*:*:instance/saas/{工作空间ID}/DEFAULT/prompt"
具体对应关系:
Resource 类型 | 适用 Action |
| CreatePrompt、UpdatePrompt、DeletePrompt、CreatePromptVersion、UpdatePromptVersion、SubmitPromptVersion、DeletePromptVersion、GetPrompt、GetPromptVersion、GetPromptVersionDetail、ListPromptVersions、GetPromptGovernance、InvokePromptDebugStream、InvokePromptOptimizeStream |
| ListPrompts |
配置步骤
当前操作账号需具有 RAM 权限策略的管理权限。如果使用 RAM 用户操作,需确保该用户已被授予 AliyunRAMFullAccess 或自定义的 RAM 管理权限。
登录 RAM 控制台。
在左侧导航栏,选择权限管理 > 权限策略。
在权限策略页面,单击创建权限策略。
在创建权限策略页面,选择脚本编辑模式,将上方对应的策略 JSON 粘贴到编辑器中。
输入策略名称,单击确定。
说明建议的策略命名:
只读策略:
AgentLoopAIRegistryReadOnly读写策略:
AgentLoopAIRegistryFullAccess
在左侧导航栏,选择身份管理 > 用户。
找到目标 RAM 用户,单击新增授权。
在添加权限面板中,选择刚创建的自定义权限策略,单击确定。
Action 说明
下表列出了两种权限策略中涉及的所有 Action 及其用途。
Action | 说明 | 所属策略 |
| 通过数据源创建工作空间 | 只读 / 读写 |
| 按数据源查询工作空间列表 | 只读 / 读写 |
| 获取工作空间详情 | 只读 / 读写 |
| 查询 Prompt 列表 | 只读 / 读写 |
| 查询 Prompt 版本列表 | 只读 / 读写 |
| 获取 Prompt 详情 | 只读 / 读写 |
| 获取 Prompt 版本信息 | 只读 / 读写 |
| 获取 Prompt 版本详细信息 | 只读 / 读写 |
| 获取 Prompt 治理信息 | 只读 / 读写 |
| 获取支持的模型列表 | 读写 |
| 创建 Prompt | 读写 |
| 更新 Prompt | 读写 |
| 删除 Prompt | 读写 |
| 创建 Prompt 版本 | 读写 |
| 更新 Prompt 版本 | 读写 |
| 发布 Prompt 版本 | 读写 |
| 删除 Prompt 版本 | 读写 |
| AI 辅助优化 Prompt(流式调用) | 读写 |