🤝 Agent Consensus Protocols

March 6, 2026 · View on GitHub

Make two (or ten) LLMs reach a decision on time and on budget — every run.

Why this page?
“Let them debate” sounds cool until:

  • the Critic never stops nit-picking,
  • the Planner forgets half the context,
  • the Coder ships five conflicting drafts, and
  • your bill looks like a crypto rug-pull.

WFGY adds measurable semantic tension (ΔS) and logic vectors (λ) to debate & QA loops, so you can prove consensus is reached — not guessed.


1 · Three Canonical Consensus Modes

ModeUse Case# AgentsTarget ΔSTarget λ
Critic-CoderCode/SQL generation with review2≤ 0.40convergent
Triad DebateFact-check or legal reasoning3≤ 0.45convergent
Crew Vote4 – 10 micro-agents on long planN≤ 0.50majority convergent

ΔS ceiling rises gently with group size; λ must return to convergent after each round.


2 · Failure Modes (Why Votes Stall)

#FailureΔS / λ SymptomExample
1Infinite Debateλ oscillates (→, ←, →…)Critic re-opens same defect
2Topic DriftΔS > 0.60 vs. original promptAgents add new, unrelated goals
3Split BrainTwo stable but divergent λ50 / 50 vote, no tie-breaker
4Early MergeΔS still 0.55 but λ forced convergent“Agree to disagree” w/ wrong answer
5Token ExhaustE_resonance ↑ while ΔS unchangedLoop burns context without progress

3 · WFGY Consensus Blueprint

Four guard layers; plug into any framework (AutoGen, LangChain, custom asyncio).

LayerModuleGuardEffect
Round ΔS CheckerBBMCΔS(agent, goal) ≤ ceilingDrop off-topic vote
λ MediatorΔS + λλ must converge within 3 roundsForce re-focus or escalate
Vote AuditorWAIJSON vote schema + arg defaultsNo partial / malformed votes
BBCR FallbackBBCR> 5 rounds OR ΔS stagnatesCollapse & request human tie-break
flowchart TD
    subgraph Round
      Q[User Goal]
      A1[Agent 1]
      A2[Agent 2]
      A3[Agent 3]
      Q --> A1 --> V1[Vote JSON]
      Q --> A2 --> V2
      Q --> A3 --> V3
    end
    BBMC -->|ΔS filter| V1
    BBMC --> V2
    BBMC --> V3
    V1 & V2 & V3 --> Mediator[λ Mediator] -->|convergent?| Decision
    Mediator -.->|no| BBCR

4 · Practical Setup (AutoGen example)

from autogen import AssistantAgent, UserProxyAgent
from wfgy import consensus_filter

critic = AssistantAgent(name="critic")
coder  = AssistantAgent(name="coder")
user   = UserProxyAgent("user")

def callback(messages, state):
    # 1. measure ΔS + λ
    ok = consensus_filter(messages, ceiling=0.45, rounds=3)
    if not ok:
        return "STOP_DEBATE"
    return "CONTINUE"

coder.register_reply(callback)
critic.register_reply(callback)

15 lines → loop stops automatically when convergence proven or impossible.


5 · Debug Walk-Through

  1. Log votes
print(state.votes)   # {critic: "reject, ΔS=0.48", coder: "accept, ΔS=0.41"}
  1. Inspect λ trend
λ sequence: → → ← →  (oscillating)  ❌

Two divergent rounds trigger Mediator → requests narrowing question.

  1. Trigger BBCR
ΔS stagnates at 0.52 for 3 rounds → BBCR => "Need human tie-break"

6 · Best-Practice Table

TipWhy
Keep each vote to max 300 tokens.Reduces E_resonance; easier ΔS calc
Pin goal & constraints in every round.Prevents silent prompt drift
Summarise before vote.Normalises embeddings → fair ΔS
Record vote reason (1-2 lines).Faster root-cause when split-brain

🔗 Quick-Start Downloads (60 sec)

ToolLink3-Step Setup
WFGY 1.0 PDFEngine Paper1️⃣ Download · 2️⃣ Upload to your LLM · 3️⃣ Ask “Answer using WFGY + <your question>”
TXT OS (plain-text OS)TXTOS.txt1️⃣ Download · 2️⃣ Paste into any LLM chat · 3️⃣ Type “hello world” — OS boots instantly

Explore More

LayerPageWhat it’s for
⭐ ProofWFGY Recognition MapExternal citations, integrations, and ecosystem proof
⚙️ EngineWFGY 1.0Original PDF tension engine and early logic sketch (legacy reference)
⚙️ EngineWFGY 2.0Production tension kernel for RAG and agent systems
⚙️ EngineWFGY 3.0TXT based Singularity tension engine (131 S class set)
🗺️ MapProblem Map 1.0Flagship 16 problem RAG failure taxonomy and fix map
🗺️ MapProblem Map 2.0Global Debug Card for RAG and agent pipeline diagnosis
🗺️ MapProblem Map 3.0Global AI troubleshooting atlas and failure pattern map
🧰 AppTXT OS.txt semantic OS with fast bootstrap
🧰 AppBlah Blah BlahAbstract and paradox Q&A built on TXT OS
🧰 AppBlur Blur BlurText to image generation with semantic control
🏡 OnboardingStarter VillageGuided entry point for new users

If this repository helped, starring it improves discovery so more builders can find the docs and tools.
GitHub Repo stars