Multi-Agent Patterns
Coordination, consensus, and distributed patterns for building multi-agent systems with AgentiCraft.
Overview
AgentiCraft provides production-tested coordination patterns for multi-agent systems. These patterns handle the hard problems: consensus, fault tolerance, load distribution, and cascading failure prevention.
Pattern Categories
Coordination Patterns
Manage how agents work together on shared tasks.
Consensus — Agents agree on a shared decision. Handles Byzantine failures where agents may produce incorrect results.
Hub and Spoke — A central coordinator dispatches tasks to specialist agents and aggregates results. Simple but creates a single point of failure.
Gossip — Agents share state with random peers. Eventually consistent, highly fault-tolerant, no single point of failure.
Swarm — Emergent coordination through simple local rules. Each agent follows the same protocol; complex behavior emerges from interaction.
Cognitive Patterns
Shape how individual agents reason.
ReAct — Interleave reasoning and action. The agent thinks about what to do, does it, observes the result, and repeats.
Chain of Thought — Break complex problems into sequential reasoning steps. Improves accuracy on math and logic tasks.
Tree of Thought — Explore multiple reasoning paths in parallel and select the best. Useful when there are many possible approaches.
Self-Ask — The agent decomposes questions into sub-questions, answers them, and combines the results.
Resilience Patterns
Handle failures gracefully.
Circuit Breaker — Stop sending requests to a failing provider. Automatically test and recover when the provider comes back.
Retry with Backoff — Retry failed requests with exponential backoff and jitter. Prevents thundering herd on recovery.
Saga — Coordinate distributed transactions across agents. If one step fails, compensating actions undo previous steps.
Workflow Patterns
Structure multi-step processes.
Pipeline — Sequential processing where each agent's output feeds the next. Simple, predictable, easy to debug.
DAG — Directed acyclic graph of tasks with dependency tracking. Maximizes parallelism while respecting ordering constraints.
State Machine — Agents transition between well-defined states based on events. Good for complex business processes.
Choosing a Pattern
| Scenario | Recommended Pattern |
|---|---|
| Multiple agents must agree | Consensus |
| Central task dispatch | Hub and Spoke |
| High fault tolerance needed | Gossip |
| Complex reasoning | Chain of Thought or Tree of Thought |
| Provider reliability | Circuit Breaker |
| Multi-step workflows | Pipeline or DAG |
| Business processes | State Machine |
Combining Patterns
Patterns compose naturally. A common production setup:
- DAG workflow orchestrates the overall process
- Consensus coordinates agents within each DAG node
- Circuit breaker protects each LLM provider call
- ReAct drives individual agent reasoning
Next Steps
- Production Deployment — deploy patterns at scale
- Security Best Practices — secure agent communication
- Foundation API — formal verification of pattern correctness