|
| 1 | +# Agent Teams |
| 2 | + |
| 3 | +A lead agent spawns specialist teammates in parallel, routes tasks between them, and aggregates results — all inside a single Feishu chat. |
| 4 | + |
| 5 | +## What It Does |
| 6 | + |
| 7 | +Agent Teams is the **runtime** team experience inside a single chat session: |
| 8 | + |
| 9 | +- A **lead agent** receives your request and decides what specialists are needed. |
| 10 | +- The lead spawns **teammates** (frontend, backend, reviewer, …) via the `Agent` tool. Teammates run as separate sub-agents under the same chat process. |
| 11 | +- Teammates can be addressed across turns: the lead routes tasks via `SendMessage`, asks teammates to report back, and aggregates the results. |
| 12 | +- Everything happens in one Feishu chat — you talk to the lead, the lead talks to the team. |
| 13 | + |
| 14 | +This is the runtime counterpart to [MetaSkill](metaskill.md): MetaSkill *generates* an agent team configuration (CLAUDE.md / AGENTS.md + skills), while Agent Teams *runs* it. |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +Prompt the lead agent to spawn teammates. You don't need a special command — just describe the team and the work: |
| 19 | + |
| 20 | +``` |
| 21 | +Act as a lead engineer. Spawn a frontend specialist and a backend specialist |
| 22 | +in parallel: the frontend handles the React UI changes, the backend adds the |
| 23 | +new /api/reports endpoint, and you review both PRs before merging. |
| 24 | +``` |
| 25 | + |
| 26 | +``` |
| 27 | +Spawn a researcher and a writer teammate. The researcher gathers everything |
| 28 | +we have on competitor X's pricing strategy from MetaMemory and the web. |
| 29 | +The writer turns it into a one-pager. Hand off when done. |
| 30 | +``` |
| 31 | + |
| 32 | +If your bot already has a generated team (via `/metaskill`), the orchestrator agent in that team is your lead — just describe the goal. |
| 33 | + |
| 34 | +## How It Works |
| 35 | + |
| 36 | +- **Persistent process per chat.** Teammates spawned in turn 1 are still addressable in turn N hours later, because each chat has one long-lived Claude process (see [How it works in CLAUDE.md](https://github.com/xvirobotics/metabot/blob/main/CLAUDE.md#persistent-claude-process-per-chat-stage-4--opt-in)). Without this, every turn would spawn a fresh subprocess and tear down all teammates. |
| 37 | +- **Agent tool spawns teammates.** The lead uses Claude's native `Agent` tool with a `team_name=` parameter to start a teammate. Teammates inherit the same working directory and tools. |
| 38 | +- **Cross-agent messaging.** Teammates and the lead use `SendMessage` to exchange messages. Replies are queued and delivered when the recipient is ready. |
| 39 | +- **Background activity surfacing.** Teammate progress between user turns shows up as a coalesced "Agent activity" card in Feishu (30-second debounce, so you don't get spammed during fast back-and-forth). |
| 40 | + |
| 41 | +## Current Limitations |
| 42 | + |
| 43 | +- **Team panel UX is coming soon.** A dedicated `🧑🤝🧑 Team` panel showing each teammate with a working/idle status icon and a shared task list is implemented in the card renderer, but the upstream SDK hooks that populate it (`TaskCreated` / `TaskCompleted` / `TeammateIdle`) do not fire reliably yet. Today, teammate activity surfaces in the existing **agent activity card** during the run. |
| 44 | +- **Claude engine only.** Teammate spawning relies on Claude's native `Agent` tool. Kimi and Codex bots don't support Agent Teams yet. |
| 45 | +- **One lead per chat.** The chat session has one process, so one lead agent. Use separate Feishu chats (or [peers](peers.md)) to run multiple independent teams. |
| 46 | +- **Budget is shared.** All teammates run inside the same chat's token budget. Heavy parallel work counts against `maxBudgetUsd`. |
| 47 | + |
| 48 | +## See Also |
| 49 | + |
| 50 | +- [MetaSkill](metaskill.md) — generate a team configuration before running it |
| 51 | +- [Goal Loops](goal-loops.md) — give the team a multi-turn objective |
| 52 | +- [Peers](peers.md) — run teams on separate MetaBot instances and route between them |
0 commit comments