Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add DonggangChen/antigravity-agentic-skills --skill "multi_agent_patterns"
Install specific skill from multi-skill repository
# Description
Multi-agent architecture design, orchestration patterns, and agent collaboration guide.
# SKILL.md
name: multi_agent_patterns
router_kit: AIKit
description: Multi-agent architecture design, orchestration patterns, and agent collaboration guide.
metadata:
skillport:
category: architecture
tags: [agents, algorithms, artificial intelligence, automation, chatbots, cognitive services, deep learning, embeddings, frameworks, generative ai, inference, large language models, llm, machine learning, model fine-tuning, multi agent patterns, natural language processing, neural networks, nlp, openai, prompt engineering, rag, retrieval augmented generation, tools, vector databases, workflow automation] - patterns
π€ Multi-Agent Patterns
Multi-agent architecture and orchestration guide.
π When to use Multi-Agent?
| Situation | Single Agent | Multi-Agent |
|---|---|---|
| Simple task | β | β |
| Context limit exceeded | β | β |
| Different expertises | β | β |
| Parallel processing | β | β |
| Complex workflow | β | β |
ποΈ Architecture Patterns
1. Orchestrator Pattern
βββββββββββββββ
β Orchestratorβ
ββββββββ¬βββββββ
β
ββββββββββββΌβββββββββββ
βΌ βΌ βΌ
βββββββββ βββββββββ βββββββββ
βAgent 1β βAgent 2β βAgent 3β
βCoder β βTester β βReviewerβ
βββββββββ βββββββββ βββββββββ
Usage: Complex workflows, task delegation
2. Pipeline Pattern
βββββββββ βββββββββ βββββββββ
β Parse β -> βProcessβ -> β Outputβ
βββββββββ βββββββββ βββββββββ
Usage: Sequential processing, data transformation
3. Specialist Pattern
βββββββββββββββ
β Router β
ββββββββ¬βββββββ
β (task type)
ββββββββββββΌβββββββββββ
βΌ βΌ βΌ
βββββββββ βββββββββ βββββββββ
β SQL β β API β β UI β
βExpert β βExpert β βExpert β
βββββββββ βββββββββ βββββββββ
Usage: Domain-specific expertise
4. Debate Pattern
βββββββββ βββββββββ
βAgent Aβ <-----> βAgent Bβ
β(Pro) β debate β(Con) β
βββββββββ βββββββββ
\ /
\ /
\ /
βββββββββ
β Judge β
βββββββββ
Usage: Decision making, option evaluation
π§ Implementation
Agent Definition
class Agent:
def __init__(self, name, role, skills):
self.name = name
self.role = role
self.skills = skills
def process(self, task):
# Agent logic
pass
Orchestrator
class Orchestrator:
def __init__(self, agents):
self.agents = agents
def route(self, task):
# Determine which agent handles task
agent = self.select_agent(task)
return agent.process(task)
def select_agent(self, task):
# Routing logic
pass
π Communication Patterns
| Pattern | Description |
|---|---|
| Direct | Agent β Agent |
| Broadcast | Orchestrator β All Agents |
| Pub/Sub | Topic-based messaging |
| Request/Response | Sync communication |
| Event-driven | Async, event queue |
β οΈ Best Practices
- Clear Roles: Each agent must have a clear task
- Minimal Overlap: No task overlap
- Fallback: Plan B if Agent fails
- Monitoring: Monitor each agent
- Context Sharing: Share necessary information
Multi-Agent Patterns v1.1 - Enhanced
π Workflow
Source: AutoGen Documentation & CrewAI
Phase 1: Role Definition
- [ ] Persona Design: Write a clear "System Message" for each agent (What represent, what to do, what not to do).
- [ ] Tools: Give the agent only the tools it needs (Reduces LLM hallucination risk).
- [ ] Hierarchy: Who reports to whom? (Manager -> Worker) or (Peer-to-Peer)?
Phase 2: Interaction Pattern
- [ ] Chat Topology: Choose between "Group Chat" (Everyone talks) vs "Nested Chats" (Subgroups).
- [ ] Handoffs: Define clear trigger phrases for task handoffs.
- [ ] Human-in-the-loop: Add "User Proxy Agent" or approval mechanism for critical decisions.
Phase 3: Execution & Output
- [ ] Consolidation: Assign a "Summarizer Agent" to consolidate results.
- [ ] Validation: Add a validator to check if output matches format (JSON/Markdown).
- [ ] Cost Control: Set Max Turns and token limits.
Checkpoints
| Phase | Verification |
|---|---|
| 1 | Do agents interrupt each other (Broken turn-taking)? |
| 2 | Is there a risk of Infinite Loop? |
| 3 | Are complex tasks correctly divided into sub-parts? |
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.