Skip to content

Hermes Agent多角色团队搭建指南:Profile机制实现完全隔离

2026年5月12日

Hermes Agent 多角色团队搭建指南。Profile 机制让你在同一台机器上跑多个完全独立的 Agent,各自拥有独立的配置、密钥、记忆、会话和技能库。

背景:为什么需要多 Agent

之前大部分人把所有任务都塞给一个 Agent,API 密钥、记忆、会话全混在一起,上下文里夹着许多聊天记录,Agent 的记忆库被日常琐事污染。

Hermes 的 Profile 机制可以让你在同一台机器上跑多个完全独立的 Agent:

隔离项说明
配置独立的 config.yaml
密钥独立的 .env
记忆独立的记忆库
会话独立的历史会话
技能库独立的技能配置
状态数据库独立的状态

三步搭建多 Agent 体系

Step 1:创建专用 Profile

bash
# 创建 Profile
hermes profile create "coder" --clone

--clone 的作用

  • 继承当前的 config.yaml
  • 继承 .env
  • 继承 SOUL.md
  • 记忆和会话完全隔离

个性化配置

配置项路径说明
API 密钥~/.hermes/profiles/coder/.env独立的 API 密钥
人设对应的 SOUL.md独立的人设配置
记忆独立的记忆库不与其他 Profile 污染

Step 2:为每个 Profile 定制身份

编辑各自的 SOUL.md,明确这个 Agent 的专长边界:

Profile职责SOUL.md 配置重点
编码助手专注代码审查和重构编程语言、技术栈
研究 Agent只处理文献检索和知识整理研究方法、信息源
个人助理负责日程和提醒日程管理、提醒逻辑

配置示例(SOUL.md)

markdown
# 编码助手 Profile

## 专长
- 代码审查
- 重构优化
- Bug 定位

## 工作方式
- 严谨、精确
- 注重代码质量
- 优先推荐最佳实践

## 禁止
- 不处理非代码相关任务
- 不参与闲聊

Step 3:直接调用,各司其职

Profile 创建后自动生成同名命令:

bash
# 使用 coder Profile
coder chat
coder setup
coder gateway start

# 或使用 -p 标志切换
hermes -p research chat

# 设置默认 Profile
hermes profile use coder
# 之后所有 hermes 命令自动指向 coder Profile

核心命令速查

命令功能
hermes profile create <name> --clone创建新 Profile(继承配置)
hermes profile list列出所有 Profile
hermes profile use <name>设置默认 Profile
hermes profile delete <name>删除 Profile
hermes -p <profile> <command>指定 Profile 执行命令
coder chat使用 coder Profile 聊天
coder setupcoder Profile 初始化
coder gateway startcoder Profile Gateway 启动

Profile 隔离机制

目录结构

~/.hermes/
├── profiles/
│   ├── default/           # 默认 Profile
│   │   ├── config.yaml
│   │   ├── .env
│   │   ├── SOUL.md
│   │   ├── memory/
│   │   ├── sessions/
│   │   └── skills/
│   │
│   ├── coder/             # 编码助手 Profile
│   │   ├── config.yaml    # 独立的配置
│   │   ├── .env           # 独立的密钥
│   │   ├── SOUL.md        # 独立的身份
│   │   ├── memory/        # 独立的记忆
│   │   ├── sessions/      # 独立的会话
│   │   └── skills/        # 独立的技能
│   │
│   ├── research/          # 研究 Agent Profile
│   │   ├── config.yaml
│   │   ├── .env
│   │   ├── SOUL.md
│   │   ├── memory/
│   │   ├── sessions/
│   │   └── skills/
│   │
│   └── assistant/         # 个人助理 Profile
│       ├── config.yaml
│       ├── .env
│       ├── SOUL.md
│       ├── memory/
│       ├── sessions/
│       └── skills/

隔离效果

场景单 Agent多 Profile
上下文污染严重完全隔离
记忆污染严重完全隔离
配置冲突经常不存在
密钥管理混乱清晰分离

进阶玩法

独立的 Gateway 进程

每个 Profile 可以跑独立的 Gateway 进程:

bash
# 为不同 Profile 启动不同的 Gateway
coder gateway start --port 3001
research gateway start --port 3002
assistant gateway start --port 3003

配置不同的 Telegram/Discord 频道

ProfileGateway频道
codercoder-gateway#coding-help
researchresearch-gateway#research-updates
assistantassistant-gateway#personal-tasks

Profile 间协作

虽然 Profile 完全隔离,但可以通过共享数据目录实现协作:

bash
# 在配置中设置共享目录
# ~/.hermes/profiles/coder/config.yaml
shared_dirs:
  - /shared/project-docs
  - /shared/meeting-notes

适用场景

场景推荐 Profile 配置
个人开发者coder + research + assistant
小团队developer + reviewer + tester
科研人员researcher + writer + manager
内容创作者writer + editor + publisher

不适合场景

场景原因
简单任务Profile 切换反而麻烦
单人单 Agent 足够不需要多角色分工

最佳实践

1. Profile 命名规范

bash
# 推荐命名
hermes profile create "coder"
hermes profile create "researcher"
hermes profile create "assistant"

# 不推荐(太通用)
hermes profile create "profile1"
hermes profile create "agent2"

2. SOUL.md 职责边界

原则说明
职责单一每个 Profile 只负责一类任务
边界清晰在 SOUL.md 中明确禁止事项
上下文纯净不让无关内容进入 Profile

3. 定期清理

bash
# 清理过期会话
hermes profile cleanup <name> --older-than 30d

# 清理记忆
hermes profile cleanup <name> --memory --older-than 7d

一句话总结

Hermes Profile = 多个完全独立的 Agent,各司其职,上下文不串。

三步搭建

  1. hermes profile create <name> --clone
  2. 编辑 SOUL.md 定制身份
  3. 直接调用,各司其职

核心价值:API 密钥隔离、记忆隔离、会话隔离、技能库隔离。

不要孤军奋战啦!

加入微信群一起学习交流 AI

与大神一起使用 OpenClaw、Hermes、Claude Code、Seedance 2.0、GPT-Image-2 等

微信公众号

扫码关注微信公众号
私信 "加群",将自动获取微信群二维码

探索 AI 世界,掌握智能未来