• bitcoinBitcoin(BTC)$81,219.004.35%
  • ethereumEthereum(ETH)$2,634.845.74%
  • tetherTether(USDT)$1.000.05%
  • binancecoinBNB(BNB)$762.661.36%
  • rippleXRP(XRP)$1.426.46%
  • usd-coinUSDC(USDC)$1.000.02%
  • solanaSolana(SOL)$111.965.82%
  • tronTRON(TRX)$0.3378940.44%
  • zcashZcash(ZEC)$1,565.755.20%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.030.22%
  • HyperliquidHyperliquid(HYPE)$92.895.42%
  • dogecoinDogecoin(DOGE)$0.0872193.42%
  • moneroMonero(XMR)$575.096.85%
  • RainRain(RAIN)$0.0139847.95%
  • whitebitWhiteBIT Coin(WBT)$83.283.88%
  • USDSUSDS(USDS)$1.000.02%
  • chainlinkChainlink(LINK)$12.414.92%
  • cardanoCardano(ADA)$0.2233694.33%
  • leo-tokenLEO Token(LEO)$8.89-0.15%
  • stellarStellar(XLM)$0.1931863.07%
  • uniswapUniswap(UNI)$9.204.65%
  • bitcoin-cashBitcoin Cash(BCH)$247.88-0.28%
  • nearNEAR Protocol(NEAR)$3.696.45%
  • Ethena USDeEthena USDe(USDE)$1.000.05%
  • daiDai(DAI)$1.000.02%
  • litecoinLitecoin(LTC)$57.163.23%
  • CantonCanton(CC)$0.110102-1.54%
  • USD1USD1(USD1)$1.000.06%
  • avalanche-2Avalanche(AVAX)$8.679.51%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.36-0.48%
  • hedera-hashgraphHedera(HBAR)$0.0789443.28%
  • suiSui(SUI)$0.824.64%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • shiba-inuShiba Inu(SHIB)$0.0000051.44%
  • MemeCoreMemeCore(M)$1.311.70%
  • crypto-com-chainCronos(CRO)$0.0593240.51%
  • BittensorBittensor(TAO)$256.824.19%
  • paypal-usdPayPal USD(PYUSD)$1.000.02%
  • tether-goldTether Gold(XAUT)$4,370.96-0.35%
  • Circle USYCCircle USYC(USYC)$1.140.03%
  • okbOKB(OKB)$116.862.71%
  • Ripple USDRipple USD(RLUSD)$1.000.00%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.140.23%
  • aaveAave(AAVE)$144.056.93%
  • AsterAster(ASTER)$0.760.91%
  • mantleMantle(MNT)$0.612.43%
  • OndoOndo(ONDO)$0.3987353.91%
  • Pump.funPump.fun(PUMP)$0.004140-2.81%
  • MorphoMorpho(MORPHO)$2.7314.97%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

A Coding Guide to Anemoi-Style Semi-Centralized Agentic Systems Using Peer-to-Peer Critic Loops in LangGraph

January 21, 2026
in AI & Technology
Reading Time: 5 mins read
A A
A Coding Guide to Anemoi-Style Semi-Centralized Agentic Systems Using Peer-to-Peer Critic Loops in LangGraph
ShareShareShareShareShare

In this tutorial, we demonstrate how a semi-centralized Anemoi-style multi-agent system works by letting two peer agents negotiate directly without a manager or supervisor. We show how a Drafter and a Critic iteratively refine an output through peer-to-peer feedback, reducing coordination overhead while preserving quality. We implement this pattern end-to-end in Colab using LangGraph, focusing on clarity, control flow, and practical execution rather than abstract orchestration theory. Check out the FULL CODES here.

Copy CodeCopiedUse a different Browser
!pip -q install -U langgraph langchain-openai langchain-core


import os
import json
from getpass import getpass
from typing import TypedDict


from langchain_openai import ChatOpenAI
from langgraph.graph import StateGraph, END


if not os.environ.get("OPENAI_API_KEY"):
   os.environ["OPENAI_API_KEY"] = getpass("Enter OPENAI_API_KEY (hidden): ")


MODEL = os.environ.get("OPENAI_MODEL", "gpt-4o-mini")
llm = ChatOpenAI(model=MODEL, temperature=0.2)

We set up the Colab environment by installing the required LangGraph and LangChain packages and securely collecting the OpenAI API key as a hidden input. We initialize the language model that will be shared by all agents, keeping the configuration minimal and reproducible. Check out the FULL CODES here.

YOU MAY ALSO LIKE

GGUF vs GPTQ vs AWQ vs EXL2: LLM Model Formats Explained (2026)

Consumers Sue Anthropic, OpenAI, SpaceXAI and Google Over Alleged AI Pact – Unite.AI

Copy CodeCopiedUse a different Browser
class AnemoiState(TypedDict):
   task: str
   max_rounds: int
   round: int
   draft: str
   critique: str
   agreed: bool
   final: str
   trace: bool

We define a typed state that acts as the shared communication surface between agents during negotiation. We explicitly track the task, draft, critique, agreement flag, and iteration count to keep the flow transparent and debuggable. This state obviates the need for a central manager or for implicit memory. Check out the FULL CODES here.

Copy CodeCopiedUse a different Browser
DRAFTER_SYSTEM = """You are Agent A (Drafter) in a peer-to-peer loop.
You write a high-quality solution to the user's task.
If you receive critique, you revise decisively and incorporate it.
Return only the improved draft text."""


def drafter_node(state: AnemoiState) -> AnemoiState:
   task = state["task"]
   critique = state.get("critique", "").strip()
   r = state.get("round", 0) + 1


   if critique:
       user_msg = f"""TASK:
{task}


CRITIQUE:
{critique}


Revise the draft."""
   else:
       user_msg = f"""TASK:
{task}


Write the first draft."""


   draft = llm.invoke(
       [
           {"role": "system", "content": DRAFTER_SYSTEM},
           {"role": "user", "content": user_msg},
       ]
   ).content.strip()


   if state.get("trace", False):
       print(f"\n--- Drafter Round {r} ---\n{draft}\n")


   return {**state, "round": r, "draft": draft, "agreed": False}

We implement the Drafter agent, which produces the initial response and revises it whenever peer feedback is available. We keep the Drafter focused purely on improving the user-facing draft, without awareness of control logic or termination conditions. It mirrors the Anemoi idea of agents optimizing locally while observing peer signals. Check out the FULL CODES here.

Copy CodeCopiedUse a different Browser
CRITIC_SYSTEM = """You are Agent B (Critic).
Return strict JSON:
{"agree": true/false, "critique": "..."}"""


def critic_node(state: AnemoiState) -> AnemoiState:
   task = state["task"]
   draft = state.get("draft", "")


   raw = llm.invoke(
       [
           {"role": "system", "content": CRITIC_SYSTEM},
           {
               "role": "user",
               "content": f"TASK:\n{task}\n\nDRAFT:\n{draft}",
           },
       ]
   ).content.strip()


   cleaned = raw.strip("```").replace("json", "").strip()


   try:
       data = json.loads(cleaned)
       agree = bool(data.get("agree", False))
       critique = str(data.get("critique", "")).strip()
   except Exception:
       agree = False
       critique = raw


   if state.get("trace", False):
       print(f"--- Critic Decision ---\nAGREE: {agree}\n{critique}\n")


   final = draft if agree else state.get("final", "")
   return {**state, "agreed": agree, "critique": critique, "final": final}

We implement the Critic agent, which evaluates the draft and decides whether it is ready to ship or needs revision. We enforce a strict agree-or-revise decision to avoid vague feedback and ensure fast convergence. This peer evaluation step allows quality control without introducing a supervisory agent. Check out the FULL CODES here.

Copy CodeCopiedUse a different Browser
def continue_or_end(state: AnemoiState) -> str:
   if state.get("agreed", False):
       return "end"
   if state.get("round", 0) >= state.get("max_rounds", 3):
       return "force_ship"
   return "loop"


def force_ship_node(state: AnemoiState) -> AnemoiState:
   return {**state, "final": state.get("final") or state.get("draft", "")}


graph = StateGraph(AnemoiState)
graph.add_node("drafter", drafter_node)
graph.add_node("critic", critic_node)
graph.add_node("force_ship", force_ship_node)


graph.set_entry_point("drafter")
graph.add_edge("drafter", "critic")
graph.add_conditional_edges(
   "critic",
   continue_or_end,
   {"loop": "drafter", "force_ship": "force_ship", "end": END},
)
graph.add_edge("force_ship", END)


anemoi_critic_loop = graph.compile()


demo_task = """Explain the Anemoi semi-centralized agent pattern and why peer-to-peer critic loops reduce bottlenecks."""


result = anemoi_critic_loop.invoke(
   {
       "task": demo_task,
       "max_rounds": 3,
       "round": 0,
       "draft": "",
       "critique": "",
       "agreed": False,
       "final": "",
       "trace": False,
   }
)


print("\n====================")
print(" FINAL OUTPUT")
print("====================\n")
print(result["final"])

We assemble the LangGraph workflow that routes control between Drafter and Critic until agreement is reached or the maximum round limit is reached. We rely on simple conditional routing rather than centralized planning, thereby preserving the system’s semi-centralized nature. Finally, we execute the graph and return the best available output to the user.

In conclusion, we demonstrated that Anemoi-style peer negotiation is a practical alternative to manager-worker architectures, offering lower latency, reduced context bloat, and simpler agent coordination. By allowing agents to monitor and correct each other directly, we achieved convergence with fewer tokens and less orchestration complexity. In this tutorial, we provided a reusable blueprint for building scalable, semi-centralized agent systems. It lays the foundation for extending the pattern to multi-peer meshes, red-team loops, or protocol-based agent interoperability.


Check out the FULL CODES here. Also, feel free to follow us on Twitter and don’t forget to join our 100k+ ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.

The post A Coding Guide to Anemoi-Style Semi-Centralized Agentic Systems Using Peer-to-Peer Critic Loops in LangGraph appeared first on MarkTechPost.

Credit: Source link

ShareTweetSendSharePin

Related Posts

GGUF vs GPTQ vs AWQ vs EXL2: LLM Model Formats Explained (2026)
AI & Technology

GGUF vs GPTQ vs AWQ vs EXL2: LLM Model Formats Explained (2026)

September 19, 2026
Consumers Sue Anthropic, OpenAI, SpaceXAI and Google Over Alleged AI Pact – Unite.AI
AI & Technology

Consumers Sue Anthropic, OpenAI, SpaceXAI and Google Over Alleged AI Pact – Unite.AI

September 19, 2026
How Focus Mode Has Changed In iOS 27
AI & Technology

How Focus Mode Has Changed In iOS 27

September 18, 2026
AI Almost Led The US Military To Start A War With China, Report Says
AI & Technology

AI Almost Led The US Military To Start A War With China, Report Says

September 18, 2026
Next Post
What are Context Graphs?

What are Context Graphs?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
Anne Thompson recalls reporting near ground zero on 9/11

Anne Thompson recalls reporting near ground zero on 9/11

September 13, 2026
Kylian Mbappe leaves Nike for Roger Federer-backed On

Kylian Mbappe leaves Nike for Roger Federer-backed On

September 18, 2026
Context Engineering Inside the Harness: 4 Mechanisms That Beat Context Overflow and Goal Loss on Long-Horizon Tasks

Context Engineering Inside the Harness: 4 Mechanisms That Beat Context Overflow and Goal Loss on Long-Horizon Tasks

September 13, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!