Multi-Agent Collaboration
Patterns for effective agent coordination.
Instructions
- Agent Role Definition
Specialist Roles
| Role | Responsibility | Skills |
|---|---|---|
| Planner | Decompose tasks | reasoning, planning |
| Researcher | Gather information | search, analysis |
| Developer | Write code | implementation |
| Reviewer | Quality check | testing, review |
| Documenter | Write docs | documentation |
- Task Delegation
Delegation Protocol
- Assess: What expertise is needed?
- Assign: Match task to specialist
- Brief: Provide clear context
- Monitor: Track progress
- Integrate: Combine results
Delegation Template
TASK: [Description] ASSIGNED TO: [Role] CONTEXT: [What they need to know] DELIVERABLE: [Expected output] DEADLINE: [When needed]
- Communication Protocols
Message Format
Request
{ "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" } }
- Handoff Patterns
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
Example
Handoff: Planner → Developer
Completed
-
Analyzed requirements
-
Identified 3 main components
Current State
-
Types defined in types/user.ts
-
No implementation yet
Next Steps
-
Create UserService in services/
-
Implement CRUD operations
-
Add validation
Context
-
Use Prisma for DB
-
Follow existing patterns in OrderService
- Conflict Resolution
When Agents Disagree
- Identify: What is the conflict?
- Evidence: Gather supporting facts
- Evaluate: Compare approaches
- Decide: Choose best option
- Document: Record decision and reasoning
Common Conflicts
| Conflict | Resolution Strategy |
|---|---|
| Architecture choice | Evaluate trade-offs |
| Implementation approach | Prototype both |
| Priority disagreement | Align with user goal |
| Resource contention | Schedule or parallelize |
- Workflow Orchestration
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
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
- Progress Synchronization
Status Updates
Format
| Agent | Task | Status | Blockers |
|---|---|---|---|
| Developer | API endpoints | 🟢 Done | None |
| Reviewer | Code review | 🟡 WIP | Waiting for tests |
| Documenter | API docs | 🔴 Blocked | Need API specs |
Sync Points
- After each phase completion
- When blocked
- When priorities change
- Before final delivery
References
-
Multi-Agent Reinforcement Learning
-
CrewAI Framework
-
AutoGen