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.
Os executores adicionam outra camada de coordenação. Como as tarefas são públicas no canal de gossip, múltiplos executores podem tentar capturar o mesmo nó folha atraente. O protocolo de timestamp atua como um critério de desempate. Cada reivindicação carrega um timestamp monotônico, e a rede honra o mais antigo. O perdedor simplesmente passa para a próxima tarefa disponível. Isso é rudimentar, mas evita a necessidade de um agendador centralizado bloqueando linhas em um banco de dados.
Resiliência por Design
A arquitetura prova seu valor quando as coisas falham. Se um decomposer falhar após propor metade dos subobjetivos, os decomposers sobreviventes continuam oferecendo divisões. O plano não trava esperando por um respawn. Se um scorer cair da rede, os votantes restantes ainda podem atingir o quorum, desde que você tenha dimensionado o cluster adequadamente.
A verdadeira vantagem são os late joins. Um novo agente que inicia no meio do processo não precisa de um snapshot ou de um
