Multi-Agent Collaboration on Feishu: A Practical Implementation Guide
This article explains how to move from a single general-purpose chatbot to a multi-agent system on a team collaboration platform. It covers the four-layer architecture, role design and collaboration protocols, message routing with context isolation, permission and secret management, operational practices such as scheduled tasks and canary rollout, and a checklist of common pitfalls. Readers will learn how a browser-based management console closes the loop on configuration, debugging, monitoring, and auditing.
1. Background: Why a Single Agent Falls Short in Real Collaboration
Connecting one large language model to an instant messaging platform usually gets you a question-and-answer bot. The problem is not answer quality but unclear ownership: the same agent has to look up information, write documents, and run operations commands. The result is ever-longer prompts, cross-contaminated context, and no way to tell which step failed.
The core idea of a multi-agent approach is to split “one do-everything assistant” into “a set of specialized roles,” then orchestrate them through a unified message bus and shared context. This yields three direct benefits:
- Narrowed responsibility: each agent maintains only its own role definition and toolset, so prompts stay short and behavior stays predictable.
- Parallel processing: different tasks are dispatched to different agents without blocking each other.
- Observability: sessions, token consumption, and execution history are sliced per agent, which makes auditing and cost attribution straightforward.
2. Layered Architecture: Moving Management from the Command Line to the Browser
A deployable multi-agent system typically has four layers, and understanding them is a prerequisite for everything that follows:
- Access layer: the team collaboration platform (chat groups, bot accounts), responsible for sending and receiving messages.
- Gateway layer: unified protocol adaptation, authentication, rate limiting, and session routing that hide message-format differences between platforms.
- Agent layer: multiple role instances, each holding its own role document, skill set, and workspace.
- Management layer: a visual console providing configuration, monitoring, and debugging.
In early designs the fourth layer barely existed. Every change meant editing config files and restarting processes, so tuning a single model parameter interrupted service. Adding a standalone web management interface fills that gap: the browser becomes the console, configuration changes take effect online, and historical sessions can be searched and replayed.
A typical management interface should cover the following capability domains, which also serve as an evaluation checklist for this kind of tool:
| Capability domain | Key contents |
|---|---|
| Runtime overview | Token usage trends, session counts, top models and channel distribution |
| Live chat | In-browser debugging, slash commands, message search |
| Session management | Session list, history, export and archiving |
| Memory management | Editing core documents such as role definitions, identity descriptions, and behavior rules |
| Scheduled tasks | Cron expressions, schedules, execution history |
| Model management | Multi-model configuration, key custody, availability probing, default model |
| Channel management | Visual configuration and enable/disable for each access channel |
| Skill management | Plugin installation, version updates, visibility control |
| Multi-agent | Role creation, permission configuration, workspace isolation |
| Remote terminal | SSE-based terminal sessions, multiple nodes, full-screen mode |
| Files and system | Workspace file browsing and editing, CPU/memory/disk and network monitoring |
3. Role Design: From Division of Labor to a Collaboration Protocol
Roles should not be divided on intuition. A practical approach is to split along two dimensions: input type and output artifact. A minimal reference team looks like this:
- Orchestrator: produces no content directly; only performs intent recognition and task dispatch.
- Retriever: collects information and verifies facts, outputting structured key points.
- Writer: turns key points into documents, weekly reports, or proposals.
- Executor: handles tasks that require real actions, such as running scripts or generating files.
Role documents work best with fixed sections, which makes version control and diff review easy:
# Role: Retriever## Scope of responsibilityInformation gathering and verification only; does not produce final copy.## Available skillsweb_search, file_read## Output format- Conclusions (no more than 3)- Source links- Uncertain items## Prohibited actionsDoes not modify workspace files or run terminal commands.
The collaboration protocol must explicitly define three things: who may call whom, what gets passed as context, and how failures fall back. The recommended practice is to pass a structured summary rather than the full conversation history, which controls token cost and avoids context contamination at the same time.
4. Message Routing and Context Isolation
In the gateway layer, the routing key is usually a triple of channel, session ID, and currently active agent. Sketch of the logic:
def route(msg):key = (msg.channel, msg.chat_id, state.active_agent(msg.chat_id))if msg.text.startswith("/agent "):state.switch_agent(msg.chat_id, msg.text.split()[1])return reply("Agent switched")agent = registry.get(key[2])ctx = memory.summary(key, max_tokens=2000) # inject summary onlyreturn agent.handle(msg.text, ctx)
Three practical points:
- Session-level active state: switching agents should apply to the current session only, not globally, so other users are unaffected.
- Summarized context: long-term memory is persisted to storage while only a summary is injected in the short term, balancing coherence and cost.
- Idempotency and deduplication: platforms retry messages, so deduplicate by message ID to prevent duplicate actions.
5. Permissions, Secrets, and Security Boundaries
Multi-agent systems amplify permission risk, because every role may hold tools. Follow the principle of least privilege:
- Keep secrets centrally managed in the model configuration of the management interface, never in role documents or code repositories.
- Disable high-risk skills (terminal execution, file deletion, outbound messages) by default and grant them explicitly per role.
- Constrain terminal and file capabilities to a container or dedicated workspace so they cannot reach sensitive host directories.
- Log all operations; use the execution history and system monitoring in the management interface as the audit trail.
- If you use cloud resources, object storage can hold archived sessions, while logging and monitoring with alerting help surface anomalies, and a container platform can host the runtime for isolation and elasticity.
6. Stability and Operations: Scheduled Tasks, Monitoring, and Canary Rollout
Once a multi-agent system is live, the operational focus shifts from “changing config” to “watching metrics.” Recommendations:
- Baseline metrics: record the token consumption and response latency of a single agent first, then scale up gradually.
- Scheduled tasks: drive daily reports and inspection jobs with cron expressions, using execution history to trace failures.
- Canary rollout: enable a new role in a test group first, validate prompts and skill permissions, then promote it to the production group.
- Model probing: check model availability regularly and fall back to a backup model by priority when the primary one misbehaves.
- Cost attribution: track usage per agent and per channel to identify high-consumption roles and optimize the context injection strategy.
7. Common Pitfalls
- Too many roles turn the orchestrator into a bottleneck; keep the initial set to 4–6.
- An unisolated shared workspace causes files to overwrite each other; give each role its own subdirectory.
- Injecting the full history makes token cost grow linearly with the session.
- Enabling high-risk skills globally means one wrong judgment causes an irreversible action.
- Missing message deduplication causes retries to submit the same task twice.
8. Summary
Running multi-agent collaboration on a team collaboration platform depends less on model choice than on whether the management layer is complete, whether role boundaries are clear, and whether context and permissions are isolated. With a visual management interface in place, configuration, debugging, monitoring, and auditing all close the loop inside the browser. Combined with structured role documents, summarized context passing, and least-privilege tool grants, multi-agent collaboration can move from a demo to long-term stable operation.
