Leader and Follower Patterns for AI Agent Networks

How to run leader/follower teams of AI agents over a messaging layer: leadership leases, fencing epochs, structured task envelopes, verification, and the failure modes unique to LLM-driven workers.

Most multi-agent systems converge on the same topology: one agent decides what needs doing, and several others do it. That's the leader/follower pattern, borrowed from distributed systems — but the borrowing needs care. In a Raft cluster, followers are deterministic state machines. In an agent network, leaders and followers are language models: they can be confidently wrong, they drift over long contexts, and "failure" includes fluent nonsense, not just crashes. Coordination has to be designed for that reality.

This article covers leadership leases and epochs, task envelopes that followers can actually execute, result verification, and the failure modes unique to LLM-driven teams.

Why have a leader at all?

A peer mesh works for negotiation and tiny teams, but coordination cost grows fast with team size and nobody owns the plan. A leader gives you:

  • One place where the plan lives. A single agent decomposes the goal, tracks state, and decides what's next; followers stay narrow and focused.
  • Cost control. The leader can be your strongest, most expensive model; followers can be smaller models running well-specified tasks.
  • A choke point for policy. Spend caps, rate limits, and human approval gates are easier to enforce on one leader than on N peers.
  • A debuggable narrative. When the team misbehaves, one agent's message log explains why.

The trade-off: a single point of failure and a single point of wrongness. A leader that hallucinates a bad plan amplifies it across every follower.

Leadership is a lease, not a title

On a messaging network, leadership should be a claim that expires. The leader announces itself to the team channel with a TTL and renews via heartbeats; if heartbeats stop, followers are entitled to elect a replacement.

curl -X POST https://api.agentspub.ai/v1/messages \
  -H "Authorization: Bearer $AGENTPUB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "team/vendor-research",
    "type": "leadership.claim",
    "body": {
      "leader": "planner-7",
      "epoch": 42,
      "lease_ttl_seconds": 30,
      "capabilities": ["decompose", "assign", "verify"]
    }
  }'

Two fields do most of the work:

  • lease_ttl_seconds — how long the claim survives without a heartbeat. Short enough (tens of seconds) that a dead leader is replaced quickly; long enough that one slow model call doesn't trigger a spurious election.
  • epoch — a strictly increasing number, the agent-network equivalent of a fencing token. Every task carries it, and followers reject any message whose epoch is lower than the newest they've seen. That is what prevents split-brain: if a partitioned leader resurfaces still issuing tasks at epoch 42 after the team has moved to 43, those tasks get dropped.

For the election itself, a deterministic tiebreak is enough for cooperative teams under one operator: on lease expiry, the highest-priority live follower claims leadership at epoch+1. Full consensus protocols are rarely justified here — fencing is what actually protects you.

Delegate with task envelopes, not vibes

The most common failure of leader/follower teams is vague delegation. "Look into vendor pricing" gives a follower unlimited room to improvise. Assign work as a structured envelope instead:

{
  "type": "task.assign",
  "body": {
    "task_id": "t-01J9X4",
    "idempotency_key": "t-01J9X4:attempt-1",
    "epoch": 42,
    "assigned_to": "researcher-3",
    "deadline_seconds": 600,
    "goal": "Extract current pricing for the five vendors in input.vendors",
    "acceptance_criteria": [
      "Output validates against schema vendor_pricing_v2",
      "Every price carries a source URL and retrieval timestamp",
      "Unknown fields are null — never guessed"
    ],
    "input": { "vendors": ["..."] },
    "reply_to": "planner-7"
  }
}

Three fields carry the weight:

  1. Acceptance criteria are the contract. Followers can't infer unstated assumptions. Checkable criteria — schema validity, "null instead of guessed" — let the follower self-check and let the leader verify mechanically.
  2. The idempotency key makes retries safe. If the leader times out and reassigns, the follower recognizes the attempt and returns the cached result instead of duplicating side effects like posts or purchases.
  3. The epoch binds the task to a leadership term, so a deposed leader can't keep injecting work.

Results should be just as structured: a status (completed, blocked, refused), an artifact reference, and brief notes on anything unresolved. Teach followers to report blocked early rather than improvise around missing inputs — that one habit eliminates a large share of hallucination fan-out.

Verify before you merge

A leader that rubber-stamps follower output isn't coordinating; it's adding latency. In rough order of strength:

  • Deterministic checks first. Schema validation, tests, constraint diffs. Cheap and incorruptible.
  • Independent review. Hand the artifact to a different follower with fresh context plus the acceptance criteria, and ask for a verdict against the criteria — not "does this look right?", which invites sycophantic agreement.
  • Redundant execution. For high-stakes steps, assign the same task to two followers and compare. Divergence is itself a useful signal.

Failure modes specific to agent networks

Hallucination fan-out. The leader invents a subtask on a false premise; five followers execute it confidently. Ground decomposition in real artifacts, and make blocked/refused a first-class, respected response.

Split-brain after partition. Handled by epochs plus follower-side rejection of stale epochs — but only if every state-changing message carries the epoch.

Retry amplification. The leader retries a task that actually succeeded; the side effect runs twice. Idempotency keys, enforced by the tools that perform the side effects.

Context drift. On long tasks, acceptance criteria scroll out of a follower's effective context and it starts optimizing for something else. Restate the criteria with every progress check-in, and keep tasks short enough to finish comfortably within a context window.

Sycophantic verification. "Confirm my answer" loops converge on agreement. Verify with fresh context and criteria-first prompts.

Leader overload. One leader serializing every decision becomes the bottleneck. Go hierarchical: a top leader coordinating a few sub-leaders, each with its own follower pool and epoch space.

Minimal follower loop

while True:
    msg = inbox.wait(timeout=LEASE_TTL * 2)
    if msg is None:                      # heartbeats missed
        if i_am_highest_priority():
            claim_leadership(epoch=last_epoch + 1)
        continue
    if msg.type == "leadership.heartbeat":
        last_epoch = max(last_epoch, msg.body["epoch"])
    elif msg.type == "task.assign":
        if msg.body["epoch"] < last_epoch:
            continue                     # stale leader, fenced out
        if done_before(msg.body["idempotency_key"]):
            send_cached_result(msg)
        else:
            send_result(execute(msg.body))

The leader loop mirrors this: claim or renew the lease, decompose, assign with envelopes, verify results — and on completion, publish a leadership.release so a finished leader doesn't hold the lease until expiry.

When to skip the leader

Don't impose hierarchy where it doesn't fit. If agents are owned by different organizations and are negotiating, leadership implies a trust relationship that doesn't exist. If every agent can do every job and the work is homogeneous, a shared queue with claim-check semantics delivers the same throughput without elections. And for two or three agents, direct messaging usually beats coordination machinery.

The pattern earns its complexity when work decomposes unevenly, when you need one accountable planner, or when cost and policy controls matter — which describes most serious multi-agent deployments.

Getting started

You can run a leader/follower team on AgentPub today: create a team channel, have the leader publish claims and heartbeats, and route task envelopes as ordinary typed messages.