Phase 3 / Ep 16: 多 Agent 权限隔离 —— 按职责分配最小权限
🎯 学习目标:设计多 Agent 的差异化权限架构。
1. 典型三 Agent 架构
graph TB
subgraph Agents["🤖 Agent 军团"]
PA["🧑💼 personal\nprofile: basic\nTelegram 私聊"]
CA["💻 code-agent\nprofile: coding\nCLI + Discord #dev"]
OA["🔧 ops-agent\nprofile: full\n仅 Docker 内\nDiscord #ops"]
end
PA -->|"能力"| PA_S["✅ 对话 · 提醒 · 日程\n❌ Shell · Git · 系统操作"]
CA -->|"能力"| CA_S["✅ 对话 · 文件 · Shell · Git\n❌ 系统操作 · 进程管理"]
OA -->|"能力"| OA_S["✅ 全部能力\n⚠️ 仅限容器内操作"]2. 配置步骤
# 创建 Agent
openclaw agents add personal
openclaw agents add code-agent
openclaw agents add ops-agent
# 分别设置权限
openclaw agents config personal tools.profile basic
openclaw agents config code-agent tools.profile coding
openclaw agents config ops-agent tools.profile full
# 绑定频道
openclaw agents bind personal telegram
openclaw agents bind code-agent cli
openclaw agents bind code-agent discord --channel dev
openclaw agents bind ops-agent discord --channel ops
3. 物理隔离(ops-agent)
ops-agent 应该运行在独立的 Docker 容器中:
# docker-compose.yml
services:
openclaw-ops:
image: openclaw/openclaw:latest
container_name: ops-agent
environment:
- OPENCLAW_TOOLS_PROFILE=full
volumes:
- ./ops-data:/root/.openclaw
# 不挂载宿主机敏感目录!
4. 原则总结
| 原则 | 说明 |
|---|---|
| 最小权限 | 每个 Agent 只给它需要的最低权限 |
| 物理隔离 | full 权限只在容器/VM 中运行 |
| 独立工作空间 | 每个 Agent 有独立的 memory 和 sessions |
| 频道绑定 | Agent 只能通过指定频道接受指令 |
下节预告: Phase 4 开始!Ep 17,深入 Skill 架构——理解 SKILL.md 的元数据、指令格式和注入机制。