qwen-code/docs/users/features/multi-agent-coordination.md
易良 8858d4340b
feat(cli): add native multi-agent coordination (#8804)
* feat(core): add native multi-agent coordination

* feat(cli): add agent view pty workers

* fix(cli): harden agent view pty workers

* fix(cli): harden agent view pty host teardown

* fix(cli): fail fast on pty host auth rejection

* test(cli): cover pty host remote exit polling

* fix(cli): address agent view pty worker review nits

* fix(cli): harden pty host socket fallback

* fix(cli): harden agent view pty workers

* fix(cli): harden agent view pty workers

* test(cli): cover pty host spawn contract

* fix(cli): guard agent view pty host socket takeover and races

* fix(cli): fit agent view pty logs under wire cap, strip host token after merge

* feat(cli): manage agent view session lifecycle

* fix(cli): preserve agent view lifecycle state

* fix(cli): harden agent view lifecycle persistence

* fix(cli): harden agent view lifecycle

* fix(cli): harden agent view lifecycle recovery

* feat(cli): expose agent view commands

* fix(cli): wire agent view command safeguards

* fix(cli): resolve agent view command integration

* feat(cli): add agent view roster ui

* feat(cli): add durable multi-agent coordination

* fix(cli): harden multi-agent coordination

* fix(cli): complete native coordination flows

* fix(cli): wait for agent view host cold starts

* fix(cli): allow coordination startup time

* fix(cli): persist missing coordination results

* fix(cli): enforce exact Agent View answers

* refactor(cli): reuse existing agent team coordination

* docs(cli): clarify homogeneous coordination

* feat(core): complete native team coordination

* fix(agents): enforce teammate coordination boundaries

* fix(agents): close teammate lifecycle gaps

* fix(agents): align empty teammate names with routing

* fix(core): close coordinator review gaps

* fix(core): keep read-only teammates off writer tasks

---------

Co-authored-by: 俊良 <zzj542558@alibaba-inc.com>
Co-authored-by: qwen-code-ci-bot <qwen-code-ci-bot@users.noreply.github.com>
2026-08-12 17:39:03 +00:00

2.9 KiB

Multi-Agent Coordination

Qwen Code can coordinate several teammates with the experimental Agent Team runtime. Teammates receive separate tasks, share a task list, exchange messages, and appear in the existing Agent View tabs. /coordinate defaults investigation workers to an enforced read-only tool set and can place one writer in a leader-owned Git worktree.

Enable Agent Team

Set experimental.agentTeam to true in Qwen Code settings and restart, or start Qwen Code with QWEN_CODE_ENABLE_AGENT_TEAM=1.

Run a coordinated task

Use the bundled skill with a goal:

/coordinate investigate the authentication regression and propose the smallest fix

The leader creates a team, assigns up to three independent workstreams, and uses the existing team tools for messages and task state. Teammate conversations and approvals remain visible through the existing Agent View UI. Read-only teammates cannot execute shell commands or write files. If implementation is needed, the leader can create one Git worktree and pin one writer teammate to it; the leader remains the only merge authority for the current branch.

If Agent Team is disabled, /coordinate can still use ordinary foreground agents for read-only parallel investigation. That fallback is delegation, not a collaborating team: the workers report only to the leader.

Choosing the right multi-agent mode

Mode Use it for Communication Workspace behavior
/coordinate with Agent Team Different workstreams contributing to one result Shared tasks and teammate messages Enforced read-only workers; optional single worktree writer
Subagents Small delegated tasks Worker reports to parent Depends on the selected agent
Arena Several models competing on the same task Agents do not collaborate Isolated worktrees; one winner is selected
Herdr Coordinating different CLI products or remote terminal sessions External terminal-level control Managed outside Qwen Code

The current workflow deliberately reuses the in-process Agent Team runtime and Agent View UI. Teammates normally inherit the session model, although an agent definition can override it. Persistent independent PTY sessions, cross-vendor workers, and remote attach are separate product concerns and are not implemented by /coordinate.