multi-agent-patterns

Coordinate multiple specialized agents with handoff protocols and consensus mechanisms.

Updated Apr 15, 2025
One-click install
npx skills add https://github.com/khrore/nix-config --skill multi-agent-patterns-khrore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-agent-patterns
Source: https://github.com/khrore/nix-config/tree/main/dotfiles/common/.config/opencode/skills/multi-agent-patterns
Command: npx skills add https://github.com/khrore/nix-config --skill multi-agent-patterns-khrore

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Multi-agent-patterns addresses the limits of single-agent context windows by partitioning complex tasks across multiple specialized agents so each agent operates in a focused context, enabling parallel reasoning and tool-specific workflows while reducing context pollution.

Core Features & Use Cases

  • Supervisor and Orchestrator: Centralized decomposition, routing, and aggregation for tasks that require strict control and human-in-the-loop oversight.
  • Peer-to-Peer / Swarm: Flexible handoffs and direct agent-to-agent communication for emergent exploration and breadth-first workflows.
  • Hierarchical Layers: Strategy, planning, and execution layers for large projects requiring layered abstraction and clear separation of concerns.
  • Coordination Primitives: Handoff protocols, weighted voting and debate consensus, checkpointing, circuit breakers, and file-system-backed shared state to manage failures and convergence.
  • Use Case: Break a research assignment into parallel search, analysis, and synthesis agents, validate outputs with a fact-checker agent, and assemble a final report with a writer agent.

Quick Start

Use multi-agent-patterns to decompose a complex research request into supervisor, researcher, analyzer, and writer agents, run them in parallel with explicit handoffs, and aggregate their distilled results.

Frequently Asked Questions about multi-agent-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I coordinate multiple agents to handle complex tasks that exceed a single context window?

You coordinate multiple agents by partitioning complex tasks across specialized agents to isolate context and enable parallel reasoning. Supervisor, swarm, and hierarchical topologies manage these decomposed subtasks while reducing context pollution.

What is the best way to structure handoffs and consensus between specialized agents?

The best way to structure handoffs and consensus is by using explicit handoff protocols combined with weighted voting and debate mechanisms. These coordination primitives ensure agents converge properly and manage direct agent-to-agent communication effectively.

How do I add failure recovery to a multi-agent system to prevent cascading errors?

You add failure recovery to a multi-agent system by implementing checkpointing and circuit breakers. These measures preserve shared state via file-system-backed storage and prevent cascading errors across the agent topology.

When should I use a hierarchical topology versus a peer-to-peer swarm for agent coordination?

Use a hierarchical topology for large projects requiring layered abstraction and clear separation of concerns. Use a peer-to-peer swarm topology for emergent exploration, flexible handoffs, and breadth-first workflows.

Can I use a supervisor pattern for centralized task decomposition and human-in-the-loop oversight?

Yes, you can use a supervisor and orchestrator pattern for centralized task decomposition, routing, and aggregation. It provides strict control over specialized agents and supports human-in-the-loop oversight for complex workflows.

Does multi-agent context isolation work for parallel research, analysis, and synthesis workflows?

Yes, context isolation works effectively for parallel research, analysis, and synthesis workflows. It separates specialized agents into focused contexts, enabling parallel reasoning and reducing context pollution during final aggregation.