OpenClaw多agent实践

0x00 目标

在一个openclaw实例下配置3个agent:

  • Trump: X agent

  • Musk: RSS Agent

  • Gates: 技术Agent

本文前提:在VPS上已配置完成openclaw + 飞书
需求来源:组建 ai 团队(单 agent 容易上下文爆炸)

0x01 配置Agent

1、手动编辑agent信息

{
  "agents": {
    "list": [{
      "id": "x",
      "name": "x",
      "workspace": "/root/.openclaw/workspace-x",
      "identity": {
        "name": "Trump",
        "theme": "X(Twitter)消息 AI 助手",
        "emoji": "📺"
      }
    }, {
      "id": "rss",
      "name": "rss",
      "workspace": "/root/.openclaw/workspace-rss",
      "identity": {
        "name": "Musk",
        "theme": "RSS消息 AI 助手",
        "emoji": "📮"
      }
    }, {
      "id": "code",
      "name": "code",
      "workspace": "/root/.openclaw/workspace-code",
      "identity": {
        "name": "Gates",
        "theme": "代码 AI 助手",
        "emoji": "💻"
      }
    }]
  }
}

2、直接通过机器人创建agent 配置

在飞书机器人对话中,直接输入要求:

基于下面的json信息配置 agent : {
  "agents": {
    "list": [{
      "id": "x",
      "name": "x",
      "workspace": "/root/.openclaw/workspace-x",
      "identity": {
        "name": "Trump",
        "theme": "X(Twitter)消息 AI 助手",
        "emoji": "📺"
      }
    }, {
      "id": "rss",
      "name": "rss",
      "workspace": "/root/.openclaw/workspace-rss",
      "identity": {
        "name": "Musk",
        "theme": "RSS消息 AI 助手",
        "emoji": "📮"
      }
    }, {
      "id": "code",
      "name": "code",
      "workspace": "/root/.openclaw/workspace-code",
      "identity": {
        "name": "Gates",
        "theme": "代码 AI 助手",
        "emoji": "💻"
      }
    }]
  }
}

openclaw 会自动创建独立的 workspace 目录,并在下面创建初始的配置文件信息

3、重启 openclaw

openclaw gateway restart

0x02 创建飞书群,获取群ID

  • 创建群组后,设置群机器人,拉取机器人入群。

  • 打开openclaw 实时日志: openclaw logs --follow

  • @机器人,发送测试消息

  • 从日志提取群组id, 以 oc_开头。

0x03 绑定agent 和群ID

在私聊飞书机器人窗口输入:

请根据 agent 的id ,对飞书群组id 进行绑定:
code : oc_f03ae3c54281aa03c7b3f0c85e8a
rss : oc_69dc757572415aae8a3dcca22e2a
x :  oc_3a21044628b3e7ab33bae43786ff

完成后,重启 openclaw。

到这里,就完成了通过群聊向不同"人格"的 openclaw agent 进行直接聊天了。

0x04 配置主agent 自动管理子agent

直接来一句:

请更新 main agent 配置,可以管理和调用其他三个 agent 来完成任务

然后重启 openclaw

到这里,已经完成了理论上的AI团队的建设工作。

0xAA 常用命令

# 重启 openclaw 服务
openclaw gateway restart

# 查看实时日志
openclaw logs --follow

心得: 配置文件的更新,尽量直接通过会话方式完成。 手动更新效率低且易出错。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容