115 words
1 minute
Building a Multi-Agent Debate Platform with LangGraph

Why LangGraph?#

Among the many AI frameworks, what attracted me most about LangGraph is its StateGraph mechanism. Compared to simple Chains, StateGraph provides more flexible control flow, making it ideal for scenarios requiring multiple agents to interact.

Architecture Design#

Role Design#

class DebateRole(Enum):
MODERATOR = "moderator"
PRO = "pro"
CON = "con"

State Design#

class DebateState(TypedDict):
topic: str
messages: list[Message]
current_speaker: DebateRole
round: int

Lessons Learned#

1. Message Ordering Issues#

Initially, I did not handle message ordering correctly, leading to incoherent agent responses.

2. Token Limits#

As debates progressed, historical messages became too long and exceeded token limits. The solution was implementing a summarization mechanism.

Results#

DebateAI can now conduct complete debate processes, including opening, interactive debate, and conclusion phases.

Next Steps#

  1. Add more role types
  2. Support multilingual debates
  3. Add scoring mechanism
Building a Multi-Agent Debate Platform with LangGraph
https://blog.roy422.dev/en/blog/langgraph-debate/
Author
Roy Lu
Published at
2026-01-12
License
CC BY-NC-SA 4.0