Add one or more agents to your OpenClaw gateway with dedicated workspaces and messaging channels.
| Mode | When | Script |
|---|---|---|
| ------ | ------ | -------- |
| Single | Add one agent | scripts/setup-agent.sh |
| Batch | Add multiple agents at once | scripts/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.
| Field | Example |
|---|---|
| ------- | --------- |
| Agent name | "Luna" |
| Channel | telegram / discord / slack / feishu / whatsapp / signal / googlechat |
| Credentials | Bot token, app secret, or QR scan |
./scripts/setup-agent.sh {name}
This creates workspace files and registers the agent with openclaw agents add --non-interactive --workspace.
Each channel needs two things in openclaw.json:
channels.{channel}.accountsbindings array> ⚠️ The bindings array is at the root level of openclaw.json, NOT under agents.
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}
{
"agentId": "{name}-agent",
"match": {
"channel": "{channel}",
"accountId": "{name}"
}
}
Add "{name}-agent" to tools.agentToAgent.allow.
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}
When creating multiple agents one-by-one:
openclaw agents add modifies openclaw.json → triggers hot reloadBatch mode: all workspaces first, one config write, one restart.
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 emojichannel — Channel type"botToken": "...""appId": "..." and "appSecret": "...""token": "...""appToken": "..." and "botToken": "..."./scripts/batch-setup.sh agents.json
This will:
openclaw agents add --non-interactive)openclaw.json in one writeagentToAgent.allow in one writeFor each agent, send a message in the channel, then approve:
openclaw pairing approve {channel} {CODE}
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"
}
}
groupId matchagents.defaults.model.primary in your config共 1 个版本