Build a Multi‑Agent AI Bot System in Feishu Using OpenClaw
This guide explains why a single AI bot becomes inefficient, introduces OpenClaw’s multi‑agent architecture, and provides a step‑by‑step tutorial—including CLI commands, configuration files, and JSON bindings—to set up isolated agents in different Feishu groups that can collaborate through internal communication channels.
Many users of OpenClaw run all tasks—copywriting, code generation, image creation—through one main agent, which quickly leads to memory bloat, context contamination, and high token costs. The article proposes a multi‑agent solution that isolates each functional role into its own virtual employee while keeping a single bot endpoint.
Why Multi‑Agent?
Memory burden : The main agent’s memory files (USER.md, memory/…) grow huge over time.
Context confusion : Past interactions (e.g., code changes) pollute the context when the agent is asked to write a public article.
High cost : Each conversation reads a large amount of irrelevant background data.
The proposed solution is a single gateway + one bot + multiple Feishu groups , giving each group a physically isolated expert team (its own workspace, memory, and model).
Two Design Patterns
Clone ("分身术") : One bot is added to different groups; bindings route each group to a different agent. Simple to configure, ideal for personal efficiency.
Independent team ("独立团") : Separate bots for research, design, coding, etc. Each has its own avatar and name, providing strong role identity and true multi‑entity collaboration.
Core Concepts of an Agent
Workspace : The agent’s personal office containing files such as SOUL.md (personality) and prompts.
AgentDir : Identity directory with authentication info and model configuration.
Sessions : Private chat history that never mixes with other agents.
This file‑based isolation makes the AI’s behavior more stable, controllable, and gives the workflow a professional intuition.
Step‑by‑Step Configuration
Step 1 – Add a New Agent via CLI
openclaw agents add work \
--model zai/glm-4.7 \
--workspace ~/.openclaw/workspace-workThe command creates a new agent named work with its own workspace.
Step 2 – Set Identity (name and emoji)
openclaw agents set-identity --agent work \
--name "All‑Purpose Assistant" \
--emoji "🤖"Step 3 – Write "On‑boarding" Files
In the agent’s workspace create SOUL.md, AGENTS.md and USER.md. These files define the agent’s personality, capabilities, and user information, turning the CLI‑created body into a fully fledged virtual employee.
Step 4 – Bind the Agent to a Feishu Group
Obtain the group conversation ID from Feishu and add a binding entry:
{
"bindings": [
{
"agentId": "work",
"match": {
"channel": "feishu",
"peer": {
"kind": "group",
"id": "oc_d46347c35dd403daad7e5df05d08a890"
}
}
}
]
}Set requireMention": false if you want the bot to respond without being @‑mentioned.
Step 5 – Enable Agent‑to‑Agent Communication
In openclaw.json enable the agentToAgent tool and whitelist the agents that may talk to each other:
{
"tools": {
"agentToAgent": {
"enabled": true,
"allow": ["main", "mulerun", "brainstorm", "writer", "coder"]
}
}
}Now the chief agent (named main) can dispatch tasks to specialized agents such as brainstorm, writer, or coder.
Agent Communication Mechanism
Agents do not shout at each other; they use OpenClaw’s built‑in sessions_send tool, which acts like an internal telephone line. The chief agent receives user commands, decides which specialized agent should handle the request, and routes the instruction via sessions_send. This ensures that if a worker agent stalls, the chief can intervene and keep the workflow alive.
Final Thoughts
With the multi‑agent architecture in place, you have an AI “army” ready to execute complex pipelines. The real power lies not in stacking models but in designing an effective organizational structure—linear pipelines for sequential tasks or parallel dependency graphs for more intricate workflows.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ops Development Stories
Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
