Replace all files with clean upstream Cline v3.83.0 content. ShengSuanYun provider code automatically removed.
115 lines
3.6 KiB
Plaintext
115 lines
3.6 KiB
Plaintext
---
|
|
title: "Multi-Agent Teams"
|
|
sidebarTitle: "Multi-Agent Teams"
|
|
description: "Coordinate multiple agents working together on complex tasks with delegation, shared context, and result merging."
|
|
---
|
|
|
|
Multi-agent teams let you break complex work across multiple agents that coordinate through a shared task board. One agent acts as the coordinator, delegating subtasks to specialist agents and merging their results.
|
|
|
|
## Enabling Teams
|
|
|
|
Teams are a ClineCore feature. Enable them in the session config:
|
|
|
|
```typescript
|
|
import { ClineCore } from "@cline/sdk"
|
|
|
|
const cline = await ClineCore.create({ clientName: "team-app" })
|
|
|
|
const session = await cline.start({
|
|
prompt: "Plan and implement a user authentication module with tests",
|
|
config: {
|
|
providerId: "anthropic",
|
|
modelId: "claude-sonnet-4-6",
|
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
systemPrompt: "You are a coordinator for a multi-agent coding team.",
|
|
cwd: "/path/to/project",
|
|
workspaceRoot: "/path/to/project",
|
|
enableTools: true,
|
|
enableSpawnAgent: true,
|
|
enableAgentTeams: true,
|
|
teamName: "auth-sprint",
|
|
},
|
|
})
|
|
```
|
|
|
|
## How Teams Work
|
|
|
|
When teams are enabled, the coordinator agent gets additional tools:
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `team_spawn_teammate` | Create a new agent with a specific role and task |
|
|
| `team_delegate_task` | Assign a task to an existing teammate |
|
|
| `team_check_status` | Check the status of delegated tasks |
|
|
| `team_get_result` | Retrieve the result of a completed task |
|
|
|
|
The coordinator decides how to split work, which agents to create, and how to combine results.
|
|
|
|
## Team Persistence
|
|
|
|
Team state persists across sessions:
|
|
|
|
```
|
|
~/.cline/data/teams/[team-name]/
|
|
task-board.json # Current tasks and their status
|
|
mailbox.json # Inter-agent messages
|
|
mission-log.json # Team activity history
|
|
```
|
|
|
|
Resume a team's work in a new session:
|
|
|
|
```bash
|
|
cline --team-name auth-sprint "Continue -- pick up incomplete tasks"
|
|
```
|
|
|
|
## Via CLI
|
|
|
|
```bash
|
|
# Start a new team
|
|
cline --team-name auth-sprint "Plan and implement user auth with tests"
|
|
|
|
# Resume work
|
|
cline --team-name auth-sprint "What's the status? Continue with unfinished tasks."
|
|
|
|
# Different team for a different workstream
|
|
cline --team-name perf-sprint "Profile the API endpoints and optimize the slowest 3"
|
|
```
|
|
|
|
## Sub-Agents vs Teams
|
|
|
|
The SDK offers two levels of multi-agent coordination:
|
|
|
|
| Feature | Sub-Agents | Teams |
|
|
|---------|-----------|-------|
|
|
| Enable with | `enableSpawnAgent: true` | `enableAgentTeams: true` |
|
|
| Persistence | Within session only | Across sessions |
|
|
| Coordination | Parent-child | Peer-to-peer with task board |
|
|
| Shared state | None | Task board, mailbox, mission log |
|
|
| Best for | One-off delegation | Complex, multi-session projects |
|
|
|
|
Sub-agents are lighter weight. The parent agent spawns a child, waits for its result, and continues. No persistent state, no task board.
|
|
|
|
```typescript
|
|
// Sub-agents: simple delegation within a single session
|
|
const session = await cline.start({
|
|
config: {
|
|
enableSpawnAgent: true, // Agent can spawn sub-agents
|
|
// ...
|
|
},
|
|
// ...
|
|
})
|
|
```
|
|
|
|
Teams are for bigger efforts where work spans multiple sessions and agents need to coordinate asynchronously.
|
|
|
|
## When to Use Teams
|
|
|
|
Teams add overhead. Use them when:
|
|
|
|
- The task naturally decomposes into independent subtasks
|
|
- Different subtasks benefit from different system prompts or specializations
|
|
- Work spans multiple sessions or days
|
|
- You want a persistent record of task delegation and completion
|
|
|
|
For simpler cases, a single agent with good tools is usually more efficient than a team.
|