实验性功能:Agent Teams需要手动启用,适用于需要多人协作的复杂任务。
Agent Teams 让多个Claude Code实例作为团队协作,每个teammate可以使用本插件提供的80+专家agents。
| 特性 | Subagents | Agent Teams |
|---|---|---|
| 运行方式 | 单个会话中 | 多个独立Claude实例 |
| Context | 共享context | 每个teammate独立context |
| 通信方式 | 只能向主对话报告 | Teammates直接相互通信 |
| 适用场景 | 专注任务 | 需要讨论协作的复杂工作 |
| Token成本 | 较低 | 较高(每个teammate独立计费) |
在 ~/.claude/settings.json 中添加:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
claude任务:开发新功能从需求到上线
Create an agent team for implementing user authentication:
- Use product-manager agent for requirements analysis
- Use system-architect agent for architecture design
- Use golang-expert agent for backend implementation
- Use react-expert agent for frontend development
- Use automation-expert agent for testing
- Use devops-expert agent for deployment
Let them coordinate through shared task list.
优势:
- 每个角色在独立context中工作,不互相干扰
- 通过消息系统协调接口设计和数据结构
- 并行开发,缩短交付时间
任务:全面审查PR
Create an agent team to review PR #142 from different angles:
- security-expert: Check for vulnerabilities and security issues
- performance-expert: Analyze performance impact and bottlenecks
- code-reviewer: Validate code quality and best practices
- test-architect: Ensure comprehensive test coverage
Have them review independently and then discuss findings.
优势:
- 4个维度并行审查(不是顺序)
- 专家间可以相互质疑发现
- 最后形成综合审查报告
任务:排查复杂bug
Users report the app crashes after login. Create an agent team with
competing hypotheses:
- golang-expert: Check backend session management
- react-expert: Investigate frontend state handling
- dba-expert: Examine database connection pooling
- infrastructure-expert: Review deployment configuration
- network-expert: Analyze network layer issues
Let them debate and try to disprove each other's theories.
优势:
- 多个假设并行验证
- 专家间辩论避免锚定偏差
- 更快找到根本原因
任务:大型项目规划
I want to launch a new product feature. Create a VP-level coordination team:
- vp-product: Market analysis and product strategy
- vp-technology: Technical feasibility and architecture
- vp-creative: UX/UI design and brand consistency
- vp-marketing: Go-to-market strategy
Have them work together to create a comprehensive launch plan.
优势:
- VP级agents协调各自部门的专家agents
- 跨职能视角综合决策
- 形成完整的产品战略
所有teammates在主终端运行:
claude # 自动选择in-process模式- 使用 Shift+Up/Down 切换teammate
- 适合任何终端
每个teammate有独立窗格:
# 需要安装tmux
brew install tmux
# 在tmux中启动
tmux
claude- 同时看到所有teammate的输出
- 点击窗格直接交互
- 需要tmux或iTerm2
Show me the current team members and their tasks
In-process模式:
- Shift+Up/Down 选择teammate
- 输入消息直接发送
Split-pane模式:
- 点击teammate窗格
- 直接输入消息
Ask the golang-expert teammate to shut down
完成后清理所有资源:
Clean up the team
重要:先关闭所有teammates,再清理团队。
Agent Teams使用明显更多token:
- 每个teammate是独立的Claude实例
- 建议用于:研究、审查、新功能开发
- 日常任务用单个subagent更经济
✅ 适合使用Agent Teams:
- 并行探索增加价值
- 需要代理间讨论和协作
- 跨多个领域的复杂任务
- 竞争假设验证
❌ 不适合使用Agent Teams:
- 顺序任务
- 编辑同一文件
- 有大量依赖关系的工作
- 简单任务(协调开销>收益)
- In-process模式不支持会话恢复
- 任务状态可能滞后
- 每个会话只能有一个团队
- 不支持嵌套团队(teammate不能创建team)
Teammates自动加载项目context(CLAUDE.md、MCP servers、skills),但不继承主对话历史。
在生成提示中包含详细信息:
Spawn a security-expert teammate with prompt: "Review authentication
module at src/auth/. Focus on JWT token handling and session management.
The app uses httpOnly cookies for token storage."
- 太小:协调开销超过收益
- 太大:浪费时间风险高
- 恰当:自包含单元,产生清晰可交付成果
- 检查teammates进度
- 重定向无效方法
- 及时综合发现
- 避免长时间无人值守
如果是新手,从明确边界的任务开始:
- 审查PR
- 研究库
- 调查错误
避免一开始就进行复杂的并行实现。
VP级agents(vp-technology、vp-product等)非常适合担任team lead:
Use vp-technology as team lead to coordinate a refactoring project.
Have it spawn appropriate expert agents for different modules.
80个expert agents可作为teammates使用:
Create a team with:
- golang-expert for backend
- react-expert for frontend
- automation-expert for tests
Each teammate should use the corresponding agent definition.
Use vp-technology to create a team for microservices migration:
1. system-architect: Design new architecture
2. golang-expert: Implement user service
3. nodejs-expert: Implement payment service
4. data-pipeline-architect: Setup data sync
5. devops-expert: Configure deployment
6. test-architect: End-to-end testing strategy
Coordinate through shared task list and let them discuss
API contracts and data schemas.