← 返回
未分类 中文

New Agent

Create new OpenClaw agents and connect them to messaging channels (Telegram, Discord, Slack, Feishu, WhatsApp, Signal, Google Chat). Supports single and batc...
创建新的OpenClaw代理并将其连接到消息渠道(Telegram、Discord、Slack、飞书、WhatsApp、Signal、Google Chat),支持单条和批量操作。
joansongjr joansongjr 来源
未分类 clawhub v2.1.0 1 版本 99834.7 Key: 无需
★ 0
Stars
📥 604
下载
💾 0
安装
1
版本
#latest

概述

New Agent

Add one or more agents to your OpenClaw gateway with dedicated workspaces and messaging channels.

When to Use

  • User wants to add a new AI agent or bot
  • User wants to connect a bot to a messaging platform
  • User wants to create a team of agents at once (batch mode)

Modes

ModeWhenScript
--------------------
SingleAdd one agentscripts/setup-agent.sh
BatchAdd multiple agents at oncescripts/batch-setup.sh

> ⚠️ Always prefer batch mode when creating 2+ agents. Single-agent creation modifies openclaw.json each time, triggering a gateway hot reload per agent. For channels with persistent connections (Feishu WebSocket, Discord gateway), this causes repeated disconnects. Batch mode writes config once and restarts once.


Single Agent Mode

Required Information

FieldExample
----------------
Agent name"Luna"
Channeltelegram / discord / slack / feishu / whatsapp / signal / googlechat
CredentialsBot token, app secret, or QR scan

Step 1: Workspace + Registration

./scripts/setup-agent.sh {name}

This creates workspace files and registers the agent with openclaw agents add --non-interactive --workspace.

Step 2: Channel Configuration

Each channel needs two things in openclaw.json:

  1. An account entry under channels.{channel}.accounts
  2. A binding in the top-level bindings array

> ⚠️ The bindings array is at the root level of openclaw.json, NOT under agents.

Account Entry Templates

Add under channels.{channel}.accounts.{name}:

Telegram:

{
  "dmPolicy": "pairing",
  "botToken": "YOUR_BOT_TOKEN",
  "groupPolicy": "open",
  "streaming": "partial"
}

Discord:

{
  "token": "YOUR_BOT_TOKEN"
}

Slack:

{
  "mode": "socket",
  "appToken": "xapp-...",
  "botToken": "xoxb-..."
}

Feishu / Lark:

{
  "appId": "YOUR_APP_ID",
  "appSecret": "YOUR_APP_SECRET"
}

For Lark (global), add "domain": "lark".

WhatsApp / Signal — Use interactive login:

openclaw channels login --channel whatsapp --account {name}
openclaw channels login --channel signal --account {name}

Binding (Top-Level)

{
  "agentId": "{name}-agent",
  "match": {
    "channel": "{channel}",
    "accountId": "{name}"
  }
}

Agent-to-Agent (Optional)

Add "{name}-agent" to tools.agentToAgent.allow.

Step 3: Verify & Pair

openclaw gateway restart
openclaw agents list --bindings
openclaw channels status --probe

For DM channels, send /start to the bot, then:

openclaw pairing approve {channel} {CODE}

Batch Mode (Recommended for 2+ Agents)

Why Batch?

When creating multiple agents one-by-one:

  • Each openclaw agents add modifies openclaw.json → triggers hot reload
  • Each channel account addition → another hot reload
  • Feishu/Discord WebSocket disconnects and reconnects each time
  • Messages sent during reload may be lost

Batch mode: all workspaces first, one config write, one restart.

Step 1: Define Agents

Create a JSON manifest file listing all agents:

[
  {
    "name": "基金经理",
    "id": "fund-manager",
    "role": "管理投资研究团队",
    "emoji": "📈",
    "channel": "feishu",
    "appId": "cli_xxx",
    "appSecret": "xxx"
  },
  {
    "name": "科技研究员",
    "id": "tech-researcher",
    "role": "科技行业投资研究",
    "emoji": "💻",
    "channel": "feishu",
    "appId": "cli_yyy",
    "appSecret": "yyy"
  }
]

Fields:

  • name — Display name (used in IDENTITY.md)
  • id — Agent ID slug (lowercase, used for agent-id, account-id, workspace dir)
  • role — Role description (used in SOUL.md)
  • emoji — Agent emoji
  • channel — Channel type
  • For Telegram: add "botToken": "..."
  • For Feishu: add "appId": "..." and "appSecret": "..."
  • For Discord: add "token": "..."
  • For Slack: add "appToken": "..." and "botToken": "..."

Step 2: Run Batch Setup

./scripts/batch-setup.sh agents.json

This will:

  1. ✅ Create all workspaces (IDENTITY.md, SOUL.md, AGENTS.md, USER.md)
  2. ✅ Register all agents (openclaw agents add --non-interactive)
  3. ✅ Add all channel accounts to openclaw.json in one write
  4. ✅ Add all bindings in one write
  5. ✅ Add all agents to agentToAgent.allow in one write
  6. ✅ Restart gateway once

Step 3: Pair

For each agent, send a message in the channel, then approve:

openclaw pairing approve {channel} {CODE}

Shared Channel (Multiple Agents, One Bot)

You can route multiple agents through a single bot using group-based bindings:

{
  "agentId": "tech-researcher",
  "match": {
    "channel": "feishu",
    "accountId": "shared-bot",
    "groupId": "oc_xxxxx"
  }
}
  • DM → routes to default agent for that account
  • Group messages → route based on groupId match
  • One bot, multiple brains

Notes

  • All agents share existing model credentials — no extra API keys needed
  • One channel is enough to bring an agent online
  • Add more channels later by repeating the single-agent steps
  • The default model comes from agents.defaults.model.primary in your config
  • Batch mode prevents hot-reload churn — always use it for 2+ agents

版本历史

共 1 个版本

  • v2.1.0 当前
    2026-03-31 16:06 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,398 📥 323,039
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,471 📥 535,561
knowledge-management

CN Web Search

joansongjr
中文网页搜索 - 聚合28个免费搜索引擎,无需API Key,纯网页抓取,支持公众号/财经/技术/学术/知识/美股/宏观/上市前搜索
★ 36 📥 9,799