TOPIC / RESOURCE

Multi-agent Feishu bot setup

When to use multi-agent (context too long, mixed task types, parallel execution), architecture patterns (pipeline, parallel, hierarchical), workspace.

Best for

  • 已经把单机器人飞书路线跑稳
  • 希望让不同机器人绑定不同 Agent
  • 准备做角色分工、渠道分流或上下文隔离

When to use multi-agent

Consider it when different bots should have different roles, you want routing by channel or account, personal and work contexts need strong separation, or the single-agent setup is already stable. If you have not reliably run a single Feishu bot yet, focus on that first.

Core concepts

  • agentId — A distinct "brain" with its own workspace, state directory, and sessions.
  • accountId — A concrete Feishu app instance (one bot identity).
  • binding — A rule that routes incoming messages from a channel/account to a specific agentId.

Directory structure

Keep workspace, agentDir, and sessions distinct. Avoid multiple agents sharing the same agentDir; auth and sessions will conflict. Example:

~/.openclaw/
├── agents/ (main/agent/, dev/agent/, content/agent/)
└── workspace/ (main/, dev/, content/)

Minimal multi-agent template

Start with 2–3 agents. Ensure unique ids, separate workspaces, separate agentDirs, matching accountId ↔ binding, and tools.agentToAgent.allow includes all cooperating agents.

{
  "agents": { "list": [{ "id": "main", "workspace": "~/.openclaw/workspace/main", "agentDir": "~/.openclaw/agents/main/agent" }, { "id": "content", "workspace": "~/.openclaw/workspace/content", "agentDir": "~/.openclaw/agents/content/agent" }] },
  "channels": { "feishu": { "enabled": true, "accounts": { "main": {}, "content": {} } } },
  "bindings": [
    { "agentId": "main", "match": { "channel": "feishu", "accountId": "main" } },
    { "agentId": "content", "match": { "channel": "feishu", "accountId": "content" } }
  ],
  "tools": { "agentToAgent": { "enabled": true, "allow": ["main", "content"] } }
}

Feishu app setup

  1. Create a separate Feishu app per agent.
  2. Record each app's App ID and App Secret correctly.
  3. Enable bot capability and "join group as bot."
  4. Prefer long connection over webhook for initial setup.
  5. Publish the app — many "bot offline" issues come from unpublished apps.

Shared memory vs independent context

  • Shared memory — When agents must align on user preferences or cross-session facts.
  • Independent context — When roles are isolated and each agent should not leak context. Define this explicitly in tools.agentToAgent and workspace rules.

Common mistakes

IssueCheck
Bot offlineApp ID/Secret, app published, auth errors in logs
Agents not cooperatingagentToAgent.allow, each workspace has AGENTS.md
Send-only or receive-onlyEvent subscription, message permissions, long connection
Routing not workingCorrect bindings, accountId matches Feishu app

External links

FAQ

Topic FAQ

When you have stable single-bot flow and need role separation, channel routing, or different context isolation.

Not strictly, but starting with one bot per agent is the easiest way to configure and debug.