multi-agent-collaboration
Multi-Agent Collaboration
Multi-Agent Collaboration (MAC) involves a team of agents, each with a specific role, tools, and persona. They work together by exchanging messages, handing off tasks, or debating solutions. This mimics human organizational structures (e.g., a software team with a PM, Dev, and QA).
When to Use
- Separation of Concerns: To keep prompts simple and focused. Complex prompts often confuse models; specialized agents are more reliable.
- Role-Playing: When specific expertise or persona is needed (e.g., "Act as a grumpy editor").
- Scalability: Adding new capabilities is as simple as adding a new agent to the team.
- Simulating User Behavior: Modeling market dynamics, social networks, or game theory scenarios.
Use Cases
- Software Dev Team: Product Manager -> Developer -> Reviewer -> QA.
- Debate: Proposition Agent vs. Opposition Agent -> Moderator synthesizes.
- Creative Writing Room: Idea Generator -> Plot Outliner -> Dialogue Specialist -> Editor.
Implementation Pattern
class Agent:
def process(self, message):
# ... logic ...
return response
def collaboration_workflow(task):
# Define Roles
researcher = Agent(role="Researcher", tools=[search_tool])
writer = Agent(role="Writer", tools=[editor_tool])
reviewer = Agent(role="Reviewer", prompt="Critique for accuracy")
# Flow
# 1. Research
facts = researcher.process(f"Gather facts on: {task}")
# 2. Write Draft
draft = writer.process(f"Write an article using these facts: {facts}")
# 3. Review & Iterate
feedback = reviewer.process(draft)
if feedback.has_issues:
final_draft = writer.process(f"Fix these issues: {feedback}")
else:
final_draft = draft
return final_draft
More from lauraflorentin/skills-marketplace
reflection
A recursive pattern where an agent evaluates and critiques its own output to iteratively improve quality and catch errors. Use when user asks to "add self-reflection", "agent introspection", "self-critique", or mentions self-evaluation, meta-cognition, or quality self-assessment.
18parallelization
A concurrency pattern where multiple agent tasks are executed at the same time to speed up processing or gather diverse perspectives. Use when user asks to "run agents in parallel", "parallelize tasks", "concurrent execution", or mentions parallel processing, fan-out, or batch execution.
13routing
A control flow pattern where a central component classifies an input request and directs it to the most appropriate specialized agent or tool. Use when user asks to "route between agents", "agent routing", "task dispatch", or mentions classifier routing, intent detection, or agent selection.
12adaptation
A dynamic pattern where an agent system modifies its own behavior, prompts, or tools over time based on feedback or performance metrics. Use when user asks to "make my agent adaptive", "add learning capabilities", "self-improving agent", or mentions adaptive behavior, online learning, or feedback loops.
12prioritization
A management pattern where an agent assesses the urgency and importance of incoming tasks to organize a dynamic execution queue. Use when user asks to "prioritize tasks", "rank agent actions", "task ordering", or mentions priority queues, urgency scoring, or triage.
11goal setting & monitoring
An iterative pattern where an agent defines clear success criteria and continuously evaluates its progress, adjusting its actions until the goal is achieved.
8