#how to

1 messages · Page 1 of 1 (latest)

sly crater
#

how to make 2 agents talk to each other in discord

split hearthBOT
#

If you mean two isolated OpenClaw agents (separate workspaces/sessions) collaborating and the conversation shows up in Discord, there are two workable patterns:

Pattern A (recommended): 1 “main” agent in Discord, it messages the other agent internally

This uses the session tools (sessions_list / sessions_send) + agent-to-agent allowlist, so you don’t need two Discord bots “yelling” at each other.

  1. Set up multiple agents + routing (docs + examples):
  1. Enable agent-to-agent messaging (it’s off by default). In config:
{
  tools: {
    agentToAgent: {
      enabled: true,
      allow: ["agentA", "agentB"],
    },
#
  },
}
  1. Make sure both agents have a Discord session (e.g., two separate Discord channels/threads routed to different agentIds, or two different Discord accounts—see Pattern B).

  2. From Agent A in Discord, ask it to:

  • sessions_list (find Agent B’s Discord session key)
  • sessions_send a message into that session

Docs for how sessions_send behaves (including optional ping-pong + announce-to-channel step):

Key limitation: one Discord message routes to one agent via bindings, so internal messaging is the clean way to get “two brains” collaborating without loops.

Pattern B: Two Discord bot accounts (one per agent), both in the same server/channel

#

If you literally want “Bot A talks to Bot B” in Discord:

  • Create two Discord bots (two tokens)
  • Configure channels.discord.accounts.{...} and bind each accountId to an agentId (example is in the multi-agent doc)
  • Keep requireMention: true (or some strict mention/prefix gating), otherwise you’ll create an infinite loop fast.

Docs:

If you tell me which of these you want (internal collaboration vs two actual Discord bots), and whether you want them in one channel or two channels, I can point you at the exact binding approach to use.

sly crater
#

1 channel 2 discord bots

split hearthBOT
#

To do 1 Discord channel + 2 Discord bots, the clean setup in OpenClaw is:

  • one bot token per Discord “accountId”
  • one OpenClaw agent per bot
  • bindings that route each Discord account to its agent

Then both bots can sit in the same channel, and you choose which agent you’re talking to by mentioning that bot.

1) Create/invite both bots

For each bot in the Discord Developer Portal:

  • Enable Message Content Intent
  • Invite it to the same server with perms: View Channels / Send Messages / Read History (etc.)

Discord setup guide: https://docs.openclaw.ai/channels/discord

2) Configure OpenClaw (two discord accounts + two agents)

This is basically the example from Multi-Agent Routing:

#

https://docs.openclaw.ai/concepts/multi-agent

{
  agents: {
    list: [
      { id: "botA", workspace: "~/.openclaw/workspace-botA" },
      { id: "botB", workspace: "~/.openclaw/workspace-botB" },
    ],
  },

  bindings: [
    { agentId: "botA", match: { channel: "discord", accountId: "botA" } },
    { agentId: "botB", match: { channel: "discord", accountId: "botB" } },
  ],
#
  channels: {
    discord: {
      groupPolicy: "allowlist",
      accounts: {
        botA: {
          token: "DISCORD_BOT_TOKEN_A",
          guilds: {
            "YOUR_GUILD_ID": {
              channels: {
                "YOUR_CHANNEL_ID": { allow: true, requireMention: true },
              },
            },
          },
        },
        botB: {
#
          token: "DISCORD_BOT_TOKEN_B",
          guilds: {
            "YOUR_GUILD_ID": {
              channels: {
                "YOUR_CHANNEL_ID": { allow: true, requireMention: true },
              },
            },
          },
        },
      },
    },
  },
}

Notes: