collaboration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Multi-Agent Collaboration

多Agent协作

Patterns for effective agent coordination.
实现高效Agent协调的模式。

Instructions

说明

1. Agent Role Definition

1. Agent角色定义

markdown
undefined
markdown
undefined

Specialist Roles

专家角色

RoleResponsibilitySkills
PlannerDecompose tasksreasoning, planning
ResearcherGather informationsearch, analysis
DeveloperWrite codeimplementation
ReviewerQuality checktesting, review
DocumenterWrite docsdocumentation
undefined
角色职责技能
Planner(规划者)任务拆解推理、规划
Researcher(研究员)信息收集搜索、分析
Developer(开发者)编写代码实现开发
Reviewer(审核者)质量检查测试、评审
Documenter(文档专员)撰写文档文档编写
undefined

2. Task Delegation

2. 任务委派

markdown
undefined
markdown
undefined

Delegation Protocol

委派协议

  1. Assess: What expertise is needed?
  2. Assign: Match task to specialist
  3. Brief: Provide clear context
  4. Monitor: Track progress
  5. Integrate: Combine results
  1. 评估:需要哪些专业技能?
  2. 分配:将任务匹配给对应专家
  3. 交底:提供清晰的上下文信息
  4. 监控:跟踪任务进度
  5. 整合:合并任务结果

Delegation Template

委派模板

TASK: [Description]
ASSIGNED TO: [Role]
CONTEXT: [What they need to know]
DELIVERABLE: [Expected output]
DEADLINE: [When needed]
undefined
TASK: [任务描述]
ASSIGNED TO: [角色]
CONTEXT: [所需背景信息]
DELIVERABLE: [预期输出]
DEADLINE: [截止时间]
undefined

3. Communication Protocols

3. 通信协议

markdown
undefined
markdown
undefined

Message Format

消息格式

Request

请求

{ "from": "planner", "to": "developer", "type": "task", "content": { "action": "implement", "file": "UserService.ts", "requirements": ["..."] } }
{ "from": "planner", "to": "developer", "type": "task", "content": { "action": "implement", "file": "UserService.ts", "requirements": ["..."] } }

Response

响应

{ "from": "developer", "to": "planner", "type": "result", "status": "complete", "content": { "files_changed": ["UserService.ts"], "summary": "Added user validation" } }
undefined
{ "from": "developer", "to": "planner", "type": "result", "status": "complete", "content": { "files_changed": ["UserService.ts"], "summary": "Added user validation" } }
undefined

4. Handoff Patterns

4. 工作交接模式

markdown
undefined
markdown
undefined

Clean Handoff Checklist

规范交接检查清单

When passing work to another agent:
  • Summarize what was done
  • Explain current state
  • List remaining tasks
  • Note any blockers
  • Provide relevant context
当将工作交接给其他Agent时:
  • 总结已完成工作
  • 说明当前状态
  • 列出剩余任务
  • 标注存在的障碍
  • 提供相关上下文

Example

示例

undefined
undefined

Handoff: Planner → Developer

交接:Planner → Developer

Completed

已完成

  • Analyzed requirements
  • Identified 3 main components
  • 需求分析
  • 确定3个核心组件

Current State

当前状态

  • Types defined in types/user.ts
  • No implementation yet
  • 类型定义已在types/user.ts中完成
  • 尚未开始实现

Next Steps

下一步

  1. Create UserService in services/
  2. Implement CRUD operations
  3. Add validation
  1. 在services/中创建UserService
  2. 实现CRUD操作
  3. 添加验证功能

Context

上下文

  • Use Prisma for DB
  • Follow existing patterns in OrderService
undefined
  • 使用Prisma操作数据库
  • 遵循OrderService中的现有模式
undefined

5. Conflict Resolution

5. 冲突解决

markdown
undefined
markdown
undefined

When Agents Disagree

当Agent出现分歧时

  1. Identify: What is the conflict?
  2. Evidence: Gather supporting facts
  3. Evaluate: Compare approaches
  4. Decide: Choose best option
  5. Document: Record decision and reasoning
  1. 识别:冲突点是什么?
  2. 举证:收集支持性事实
  3. 评估:对比不同方案
  4. 决策:选择最优方案
  5. 记录:记录决策结果及理由

Common Conflicts

常见冲突

ConflictResolution Strategy
Architecture choiceEvaluate trade-offs
Implementation approachPrototype both
Priority disagreementAlign with user goal
Resource contentionSchedule or parallelize
undefined
冲突类型解决策略
架构选择评估权衡利弊
实现方案为两种方案制作原型
优先级分歧对齐用户目标
资源竞争调度或并行处理
undefined

6. Workflow Orchestration

6. 工作流编排

mermaid
sequenceDiagram
    participant User
    participant Planner
    participant Developer
    participant Reviewer
    
    User->>Planner: Request feature
    Planner->>Planner: Analyze & decompose
    Planner->>Developer: Assign implementation
    Developer->>Developer: Write code
    Developer->>Reviewer: Request review
    Reviewer->>Developer: Feedback
    Developer->>Planner: Complete
    Planner->>User: Deliver result
mermaid
sequenceDiagram
    participant User
    participant Planner
    participant Developer
    participant Reviewer
    
    User->>Planner: Request feature
    Planner->>Planner: Analyze & decompose
    Planner->>Developer: Assign implementation
    Developer->>Developer: Write code
    Developer->>Reviewer: Request review
    Reviewer->>Developer: Feedback
    Developer->>Planner: Complete
    Planner->>User: Deliver result

7. Shared Context

7. 共享上下文

markdown
undefined
markdown
undefined

Context Sharing Rules

上下文共享规则

Must Share

必须共享

  • Project constraints
  • User preferences
  • Critical decisions
  • Error states
  • 项目约束
  • 用户偏好
  • 关键决策
  • 错误状态

May Share

可以共享

  • Implementation details
  • Intermediate results
  • Research findings
  • 实现细节
  • 中间结果
  • 研究发现

Don't Share

无需共享

  • Internal reasoning
  • Failed attempts
  • Verbose logs
undefined
  • 内部推理过程
  • 失败尝试
  • 冗长日志
undefined

8. Progress Synchronization

8. 进度同步

markdown
undefined
markdown
undefined

Status Updates

状态更新

Format

格式

AgentTaskStatusBlockers
DeveloperAPI endpoints🟢 DoneNone
ReviewerCode review🟡 WIPWaiting for tests
DocumenterAPI docs🔴 BlockedNeed API specs
Agent任务状态障碍
DeveloperAPI端点🟢 已完成
Reviewer代码评审🟡 进行中等待测试结果
DocumenterAPI文档🔴 受阻需要API规格

Sync Points

同步节点

  • After each phase completion
  • When blocked
  • When priorities change
  • Before final delivery
undefined
  • 每个阶段完成后
  • 遇到障碍时
  • 优先级变更时
  • 最终交付前
undefined

References

参考资料