Overview
Concrete tool for multi-agent debates where multiple LLM agents argue over a problem across rounds and converge on a final answer via judge or self-consistency.
Description
The MultiAgentDebateActionGraph class extends ActionGraph to implement a Google MAD-style debate framework. It creates debater CustomizeAgent instances with personas, runs multiple debate rounds where each agent sees previous rounds' transcripts (configurable via `transcript_mode`), and generates a final consensus via either an LLM judge or self-consistency voting. Supports optional TF-IDF-based candidate pruning, group graph mode (replacing debaters with workflow graphs), and custom debater/judge agents.
Usage
- Multi-agent debate: Create the graph with an `LLMConfig` and call `execute(problem=..., num_agents=3, num_rounds=3)`.
- Custom debaters: Pass `debater_agents=[...]` with pre-configured `CustomizeAgent` instances.
- Self-consistency: Set `judge_mode="self_consistency"` to vote on final answers instead of using a judge.
- With pruning: Set `enable_pruning=True` to filter low-quality candidates via TF-IDF similarity.
Code Reference
Source Location
- Repository: EvoAgentX
- File: evoagentx/frameworks/multi_agent_debate/debate.py (L43-1041)
Signature
class MultiAgentDebateActionGraph(ActionGraph):
name: str = "MultiAgentDebate"
description: str = "Multi-agent debate workflow framework"
llm_config: LLMConfig # default: OpenAILLMConfig(model="gpt-4o-mini")
debater_agents: Optional[List[CustomizeAgent]] = None
judge_agent: Optional[CustomizeAgent] = None
llm_config_pool: Optional[List[LLMConfig]] = None
group_graphs_enabled: bool = False
group_graphs: Optional[List[ActionGraph]] = None
def execute(
self,
problem: str,
num_agents: int = 3,
num_rounds: int = 3,
judge_mode: str = "llm_judge", # or "self_consistency"
personas: Optional[List[str]] = None,
return_transcript: bool = True,
agent_llm_configs: Optional[List[LLMConfig]] = None,
enable_pruning: bool = False,
pruning_qp_threshold: float = 0.15,
pruning_dp_similarity_threshold: float = 0.92,
pruning_enable_mr: bool = False,
pruning_mr_llm_config: Optional[LLMConfig] = None,
pruning_snapshot_mode: bool = False,
transcript_mode: str = "prev", # "prev" or "all"
**kwargs
) -> dict
async def async_execute(self, problem: str, ...) -> dict
Import
from evoagentx.frameworks.multi_agent_debate.debate import MultiAgentDebateActionGraph
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| llm_config |
LLMConfig |
Yes |
Default LLM config for all agents
|
| problem |
str |
Yes (for execute) |
Problem statement to debate
|
| num_agents |
int |
No |
Number of debaters (default: 3, must be > 1)
|
| num_rounds |
int |
No |
Debate rounds (default: 3, must be > 0)
|
| judge_mode |
str |
No |
"llm_judge" or "self_consistency" (default: "llm_judge")
|
| return_transcript |
bool |
No |
Include full transcript in result (default: True)
|
| enable_pruning |
bool |
No |
Enable TF-IDF candidate pruning (default: False)
|
Outputs
| Name |
Type |
Description
|
| final_answer |
Final answer from judge or voting
|
| winner |
Winning agent ID (for llm_judge mode)
|
| rationale |
Judge's reasoning
|
| transcript |
Full debate transcript (if return_transcript=True)
|
Usage Examples
Basic Debate
from evoagentx.frameworks.multi_agent_debate.debate import MultiAgentDebateActionGraph
from evoagentx.models.model_configs import OpenAILLMConfig
debate = MultiAgentDebateActionGraph(
llm_config=OpenAILLMConfig(model="gpt-4o-mini", openai_key="sk-..."),
)
result = debate.execute(
problem="Is nuclear energy a viable solution to climate change?",
num_agents=3,
num_rounds=3,
judge_mode="llm_judge",
)
print(f"Final answer: {result['final_answer']}")
print(f"Winner: Agent #{result['winner']}")
With Self-Consistency and Pruning
result = debate.execute(
problem="What is the optimal number of layers in a transformer for NLP tasks?",
num_agents=5,
num_rounds=4,
judge_mode="self_consistency",
enable_pruning=True,
pruning_qp_threshold=0.15,
transcript_mode="all",
)
print(result["final_answer"])
Related Pages
Implements Principle
Requires Environment
Uses Heuristic