What happens when you plan a big project with nobody in charge? Most software stacks assume a single orchestrator. One process holds the state, queues the jobs, and hands out tasks. If that coordinator restarts, the entire workflow stumbles. A new project flips that assumption entirely. It shows how a swarm of AI agents can decompose a goal like "plan a two-week trip to Japan" into a full task tree without any single node holding the complete plan at any moment.
Why Build a Leaderless System?
Centralized planners are easy to reason about. You send a request to a server, it splits the work, and workers report back. The problem is the server becomes a cognitive and physical bottleneck. It owns the truth.
In a distributed setup, truth turns into a shared picture that the network converges on through gossip. This specific Python implementation wires together two distinct concepts. The first is an iterative refinement loop: one agent writes a proposal, another scores it, and a third polishes it. The second is a peer-to-peer networking layer built on libp2p, which lets agents discover each other automatically without a registry or a load balancer. The result is a cluster where peers appear, propose, vote, and execute without anyone playing orchestra conductor.
The Four Roles
The system assigns every participant one of four personalities. You do not need four physical machines. They can coexist on one laptop or spread across a home network. The roles are:
Decomposer. This agent receives the top-level goal and proposes a split into subgoals. Because the system runs multiple decomposers in parallel, you might get three different recipes for the same Japan trip. One could break the journey down by geography: Tokyo, Kyoto, Osaka. Another might split by activity: transit, lodging, dining, sightseeing. A third could sequence by day. The network considers all of them.
Scorer. These agents act as the editorial board. They inspect a proposed split and rate it. A score reflects whether the subgoals are concrete enough, non-overlapping, and collectively exhaustive. More importantly, a scorer decides if a proposal is good enough to accept. Without its blessing, a split stays in limbo.
Executor. Once the tree reaches leaf nodes small enough to act on, executors race to claim them. They do not wait for permission from a central queue. Instead, they use a timestamp protocol to settle who gets dibs on a task. The winner runs the job through a local LLM call and broadcasts the result.
Observer. This is the wallflower that every network needs. It listens silently to the gossip, reconstructs the plan tree from the chatter, and prints a readable snapshot. Because it never speaks, it proves an important point: anyone joining late can figure out the entire plan just by overhearing.
Gossip as the Source of Truth
The libp2p layer handles discovery and messaging. Agents find each other through the protocol's built-in peer discovery, then broadcast messages onto a shared topic. There is no database of record, no Redis cache holding the canonical plan.
Each peer keeps its own copy of the plan tree and updates it based on the gossip it hears. When a decomposer broadcasts a proposal, every other node receives it, validates the format, and adds the branch to its local tree. When scorers cast votes, the tally propagates the same way. If two executors publish conflicting claims to the same task, the timestamp protocol resolves the collision. The network settles on the earlier claim and discards the late one.
Over time, the tree grows downward from the original goal through layers of accepted subgoals until it reaches bite-sized tasks. The process resembles a blockchain reaching consensus, except the payload is a travel itinerary or a software spec rather than a ledger of coins.
Voting and the Race to Execute
Democracy is expensive, and this system pays the price in latency. A split only wins if enough scorers agree. That threshold could be a simple majority or a stricter quorum, depending on how you configure the cluster. The decomposers do not stop proposing, so the network often evaluates several competing trees at once. Eventually one reaches the required votes and its subgoals graduate from draft to accepted.
Executors add another layer of coordination. Because tasks are public on the gossip channel, multiple executors might try to grab the same attractive leaf node. The timestamp protocol acts as a tiebreaker. Each claim carries a monotonic timestamp, and the network honors the earliest one. The loser simply moves on to the next available task. This is crude, but it avoids the need for a centralized scheduler locking rows in a database.
Resilience by Design
The architecture earns its keep when things break. If a decomposer crashes after proposing half the subgoals, the surviving decomposers continue offering splits. The plan does not stall waiting for a respawn. If a scorer drops off the network, the remaining voters can still reach quorum as long as you sized the cluster appropriately.
The real payoff is late joins. A new agent that boots up halfway through does not need a snapshot or a
