← Back to Docs
Recipe

Agent swarm coordination

Orchestrate multiple Meridian agents to collaborate on complex tasks with shared state and leader election.

Overview

A swarm groups agents under a coordinator that distributes subtasks, merges results, and handles agent failure. Each agent runs in its own sandbox with a dedicated capability set. The coordinator uses a gossip protocol for state sync and a Raft-inspired leader election when the primary fails.

Prerequisites

  • Meridian CLI v2.4+ installed
  • At least 3 agent slots available in your plan
  • Redis-compatible broker for message passing

Configuration

swarm:
  name: research-swarm
  size: 5
  coordinator:
    election_timeout_ms: 3000
    heartbeat_interval_ms: 500
  agents:
    - role: researcher
      model: meridian-70b
    - role: analyst
      model: meridian-70b
    - role: writer
      model: meridian-8b

Running the swarm

meridian swarm up --config swarm.yaml --task "Research quantum-resistant TLS adoption"

The coordinator splits the task, assigns subtasks, and streams consolidated output to your terminal.

Pro tip

Use --failover to automatically promote a standby coordinator if the leader's heartbeat stops.