#Openclaw group chat experiment
1 messages · Page 1 of 1 (latest)
By default, they don’t cross-talk. For two standalone agents to talk to each other, the important bits are:
{
tools: {
sessions: {
visibility: "all", // needed so session tools can see other agents
},
agentToAgent: {
enabled: true,
allow: ["home", "work"], // your agent IDs
},
},
session: {
agentToAgent: {
maxPingPongTurns: 5, // optional, lets them bounce replies back and forth
},
},
}
Also, if you use tool allowlists, make sure both agents can use at least:
sessions_listsessions_historysessions_sendsession_status
Then restart:
openclaw gateway restart
After that, one agent can message the other with sessions_send, typically targeting the other agent’s main session, for example agent:work:main.
The gotcha is: tools.sessions.visibility: "all" and tools.agentToAgent.enabled: true are both required. Without those, cross-agent sends are blocked.
Docs:
- https://docs.openclaw.ai/concepts/multi-agent
- https://docs.openclaw.ai/concepts/session-tool
- https://docs.openclaw.ai/gateway/configuration
If you want, I can paste a full minimal 2-agent config example for home + work.
Any discord specifics settings I have to change for the agent to agent thing?
Nope, not for the plain agent-to-agent part.
sessions_send / cross-agent messaging is an internal session tool thing, so the important settings are still the ones from before:
tools.sessions.visibility: "all"tools.agentToAgent.enabled: truetools.agentToAgent.allow: [...]
For Discord specifically, you only need the normal routing/setup pieces:
-
Each bot you use needs normal Discord setup
- invited to the server
- Message Content Intent enabled
- access to the channels you want
-
If each agent should be a different Discord bot/account, bind each
accountIdto anagentId:
{
bindings: [
{ agentId: "main", match: { channel: "discord", accountId: "default" } },
{ agentId: "coding", match: { channel: "discord", accountId: "coding" } },
],
channels: {
discord: {
accounts: {
default: { token: "..." },
coding: { token: "..." },
},
},
},
}
- If both agents share one Discord bot, that’s fine too. Then you just route them with normal
bindingsby channel / peer / guild, not a special Discord A2A switch.
The one Discord-specific extra is only if you want thread-bound spawned sessions (sessions_spawn({ thread: true })):
{
channels: {
discord: {
threadBindings: {
enabled: true,
spawnSubagentSessions: true,
},
},
},
}
That part is for subagents in Discord threads, not regular agent-to-agent sessions_send.
Docs:
- https://docs.openclaw.ai/channels/discord
- https://docs.openclaw.ai/concepts/multi-agent
- https://docs.openclaw.ai/concepts/session-tool
If you want, I can paste:
- a same Discord bot, two agents example, or
- a two Discord bots, two agents example.
Paste both examples please
Yep, here are both.
1) One Discord bot, two agents
Route by channel (or guild/peer), both agents share the same bot identity.
{
agents: {
list: [
{ id: "home", workspace: "~/.openclaw/workspace-home" },
{ id: "work", workspace: "~/.openclaw/workspace-work" },
],
},
bindings: [
{
agentId: "home",
match: {
channel: "discord",
guildId: "123456789012345678",
peer: { kind: "channel", id: "222222222222222222" }, // #home-bot
},
},
{
agentId: "work",
match: {
channel: "discord",
guildId: "123456789012345678",
peer: { kind: "channel", id: "333333333333333333" }, // #work-bot
},
},
],
tools: {
sessions: {
visibility: "all",
},
agentToAgent: {
enabled: true,
allow: ["home", "work"],
},
},
session: {
agentToAgent: {
maxPingPongTurns: 5, // optional
},
},
channels: {
discord: {
enabled: true,
token: {
source: "env",
provider: "default",
id: "DISCORD_BOT_TOKEN",
},
groupPolicy: "allowlist",
guilds: {
"123456789012345678": {
channels: {
"222222222222222222": { allow: true, requireMention: false },
"333333333333333333": { allow: true, requireMention: false },
},
},
},
},
},
}
2) Two Discord bots, two agents
Route by accountId, each agent has its own Discord bot identity.
{
agents: {
list: [
{ id: "home", workspace: "~/.openclaw/workspace-home" },
{ id: "work", workspace: "~/.openclaw/workspace-work" },
],
},
bindings: [
{ agentId: "home", match: { channel: "discord", accountId: "homebot" } },
{ agentId: "work", match: { channel: "discord", accountId: "workbot" } },
],
tools: {
sessions: {
visibility: "all",
},
agentToAgent: {
enabled: true,
allow: ["home", "work"],
},
},
session: {
agentToAgent: {
maxPingPongTurns: 5, // optional
},
},
channels: {
discord: {
groupPolicy: "allowlist",
accounts: {
homebot: {
token: {
source: "env",
provider: "default",
id: "DISCORD_BOT_TOKEN_HOME",
},
guilds: {
"123456789012345678": {
channels: {
"222222222222222222": { allow: true, requireMention: false },
},
},
},
},
workbot: {
token: {
source: "env",
provider: "default",
id: "DISCORD_BOT_TOKEN_WORK",
},
guilds: {
"123456789012345678": {
channels: {
"333333333333333333": { allow: true, requireMention: false },
},
},
},
},
},
},
},
}
Important footguns
- If you use tool allowlists, both agents also need:
sessions_listsessions_historysessions_sendsession_status
- With two bots in the same channel and
requireMention: false, both may answer every message. - For plain agent-to-agent talking, there is no extra Discord-only switch beyond normal bot setup/bindings.
Docs:
- https://docs.openclaw.ai/concepts/multi-agent
- https://docs.openclaw.ai/channels/discord
- https://docs.openclaw.ai/concepts/session-tool
If you want, I can also paste a tiny test prompt to make one agent say hi to the other and verify it’s working.
Oh yes can you send the test prompt? It seems my agent is confused
Yep, use this super-literal one first.
Simple test prompt
Send this to the first agent:
Do exactly these steps:
1. Call `sessions_send`
2. Use `sessionKey: "agent:work:main"`
3. Use `message: "Reply with exactly: pong from work"`
4. Use `timeoutSeconds: 30`
5. After the tool returns, print the reply you got
Do not use the `message` tool.
Do not explain the plan first.
If your target agent is named something else, swap work for that agent ID.
If the agent is still confused, use this even more explicit version
Use the `sessions_send` tool now with:
- sessionKey: "agent:work:main"
- message: "Reply with exactly: pong from work"
- timeoutSeconds: 30
Then show me the result.
Diagnostic prompt
If that fails, send this to the first agent:
Please troubleshoot cross-agent messaging.
1. Use `sessions_list` and check whether `agent:work:main` is visible.
2. If visible, use `session_status` on `agent:work:main`.
3. Then try `sessions_send` to `agent:work:main` with message `Reply with exactly: pong from work` and timeoutSeconds 30.
4. Show me the exact error or reply.
Do not guess. Use the tools.
What the failure usually means
- “not visible” →
tools.sessions.visibilityis wrong - “agent-to-agent disabled/denied” →
tools.agentToAgent.enabled/allowis wrong