Overview
Today I set up a multi-agent AI team using OpenClaw Gateway. Instead of one AI assistant doing everything, I now have three specialized agents working together:
- Manager 👔 - Requirements validation & coordination
- Verifier 🔍 - Code review & quality assurance
- Coder 💻 - Implementation & bug fixes
This post documents the architecture, configuration, and lessons learned.
Why Multi-Agent?
Single AI assistants are great, but they have limitations:
- Context switching - Jumping between planning, coding, and reviewing
- No built-in review - Code isn't checked before delivery
- Unclear workflow - Hard to track progress on complex tasks
A team of specialized agents solves this:
Each agent has a clear role, isolated workspace, and specific tools.
Architecture
Agent Roles
| Agent | Role | Communication | Tools |
|---|---|---|---|
| Manager | Team lead, requirements | Main channel only | Messaging, sessions |
| Verifier | QA specialist, reviews | Main channel + threads | Coding (no runtime) |
| Coder | Implementation | Thread only | Full coding tools |
Communication Flow
Key Design Decisions
- Isolated Workspaces - Each agent has its own
workspace-<agent>/folder - Agent-to-Agent Communication - Via
sessions_sendtool with ping-pong - Coder Thread-Only - Enforced via tool restrictions (
messagedenied) - Ping-Pong Workflow - Automatic alternation (max 5 turns)
Configuration
1. Agent Definitions
{
"agents": {
"list": [
{
"id": "manager",
"name": "AI Team - Manager",
"workspace": "/home/henry/.openclaw/workspace-manager",
"tools": {
"profile": "messaging",
"allow": ["group:sessions", "read", "write"]
}
},
{
"id": "verifier",
"name": "AI Team - Verifier",
"workspace": "/home/henry/.openclaw/workspace-verifier",
"tools": {
"profile": "coding",
"deny": ["group:runtime"]
}
},
{
"id": "coder",
"name": "AI Team - Coder",
"workspace": "/home/henry/.openclaw/workspace-coder",
"tools": {
"deny": ["message"],
"allow": ["group:sessions", "group:fs", "group:runtime"]
}
}
]
}
}
2. Agent-to-Agent Permissions
{
"tools": {
"agentToAgent": {
"enabled": true,
"allow": ["manager", "verifier", "coder"]
},
"sessions": {
"visibility": "all"
}
},
"session": {
"agentToAgent": {
"maxPingPongTurns": 5
}
}
}
3. Discord Bindings
{
"bindings": [
{ "agentId": "manager", "match": { "channel": "discord", "accountId": "manager" } },
{ "agentId": "verifier", "match": { "channel": "discord", "accountId": "verifier" } },
{ "agentId": "coder", "match": { "channel": "discord", "accountId": "coder" } }
]
}
Workflow Example
Task: Build a Login Feature
1. Henry @Mentions Manager
@AI Team - Manager Build a login feature with email + password
2. Manager Acknowledges (Main Channel)
Got it! Building a login feature with email/password authentication.
I'll have the team start on this. 🔍
3. Manager → Verifier (Internal)
sessions_send: "Henry needs: login feature with email + password.
Please analyze and delegate to Coder."
4. Verifier Analyzes (Main Channel)
📝 Analyzing requirements:
- Email validation (format check)
- Password hashing (bcrypt)
- Session management
Breaking into tasks for Coder...
5. Verifier → Coder (Internal)
sessions_send: "Task 1: Email validation + password hashing.
Use bcrypt, validate email format, min 8 chars."
6. Coder Implements (Thread)
[In thread under Verifier's message]
Implemented email validation and bcrypt hashing.
Code ready for review.
7. Verifier Reviews
⚠️ Missing: password strength validation.
Add: 1 uppercase, 1 number required.
8. Coder Fixes (Thread)
Fixed. Added password strength rules.
Ready for re-review.
9. Verifier Approves → Manager
sessions_send: "Login feature complete. Email validation,
bcrypt hashing, password strength rules. All reviewed."
10. Manager Delivers (Main Channel)
✅ Login feature complete! Features:
- Email + password authentication
- Password hashing with bcrypt
- Session token management
Ready for testing!
Coder's Thread-Only Constraint
The Challenge
Discord config doesn't support native "thread-only" posting for specific agents. We needed the Coder to never post in the main channel, only in threads.
Solution: Defense in Depth
1. Tool Restrictions (Technical Enforcement)
{
"agents": {
"list": [
{
"id": "coder",
"tools": {
"deny": ["message"],
"allow": ["group:sessions", "group:fs", "group:runtime"]
}
}
]
}
}
The message tool is denied, so Coder cannot post directly to Discord channels.
2. Personality Instructions (Behavioral)
## Communication Rules (CRITICAL!)
- ❌ NEVER post in main Discord channel - Thread ONLY!
- ✅ Threads only - When replying to Verifier's messages
- ✅ Talk to: Verifier only (via sessions_send)
- ❌ Don't talk to: Henry or Manager directly
3. Workflow Prompts (Structural)
Each agent has a prompt.md file encoding the workflow logic:
- When to use
sessions_send - Who to talk to
- What tools to use
- When to use
REPLY_SKIP
Testing Results
Identity Verification ✅
Tested each agent with "Who are you?":
Manager:
"I'm the AI Team Manager! 👋 I validate requirements, coordinate between Henry/Verifier/Coder, and make sure work flows smoothly."
Verifier:
"I'm the AI Team Verifier! 🔍 I'm the QA specialist - I review code, track issues, and make sure everything gets built right."
Coder:
"I'm the AI Team Coder 💻 I write code, build features, fix bugs, and implement things you need."
All agents correctly identified their roles! ✅
Lessons Learned
1. Agent Isolation is Key
Each agent needs:
- Isolated workspace (no file access conflicts)
- Isolated session store (no conversation bleeding)
- Isolated agentDir (no auth/profile sharing)
2. Tool Restrictions > Personality Instructions
Don't rely on agents "following rules" - use technical enforcement:
- Deny
messagetool for Coder (can't post to main channel) - Allow only necessary tools per agent
- Use
group:sessionsfor internal communication
3. Ping-Pong is Automatic
Once sessions_send is used, the ping-pong loop happens automatically:
- Configured via
session.agentToAgent.maxPingPongTurns - Stop early with
REPLY_SKIP - Announce step posts to channel (or
ANNOUNCE_SKIP)
4. Workflow Logic Needs Prompts
AGENTS.md defines personality, but prompt.md encodes the workflow:
- When to delegate
- Who to talk to
- What tools to use
- When to stop
Conclusion
The multi-agent setup is working! Key wins:
- ✅ Specialized agents with clear roles
- ✅ Isolated workspaces + sessions
- ✅ Technical enforcement of communication rules
- ✅ Automatic ping-pong workflow
- ✅ Coder stays in threads (tested!)
Next up: test with real coding tasks and measure the efficiency gains!