# varshith-reddy-m/multi-agent-ai-debate-system architecture

> Architecture diagram of the GitHub repository varshith-reddy-m/multi-agent-ai-debate-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/varshith-reddy-m/multi-agent-ai-debate-system
- Repository: https://github.com/varshith-reddy-m/multi-agent-ai-debate-system

## Overview

AI Debate Arena accepts a topic through either its Gradio UI or a terminal entry point, then runs a four-turn PRO/ANTI debate. The debate engine asks three independent judges for votes, resolves them into a winner, and asks an analyzer for a reasoning breakdown; the UI presents the transcript and results. Prompts define each agent’s role, and agents.py handles streamed OpenRouter requests with retries. The README documents cloud deployment, but deployment wiring is not shown in the sampled source.

Main entry points: [`debate_engine.py`](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py) (Debate engine), [`agents.py`](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/agents.py) (Streaming agent client), [`app.py`](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/app.py) (Gradio interface), [`main.py`](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/main.py) (Terminal entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_gradio["Gradio interface<br/>[app.py]"]
  node_terminal["Terminal entry<br/>[main.py]"]
end

subgraph group_debate["Debate orchestration"]
  node_engine["Debate engine<br/>[debate_engine.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_pro["PRO turns<br/>[debate_engine.py]"]
  node_anti["ANTI turns<br/>[debate_engine.py]"]
end

subgraph group_evaluation["Evaluation and analysis"]
  node_judges["Three judges<br/>[debate_engine.py]"]
  node_voting["Consensus voting<br/>[debate_engine.py]"]
  node_winner["Vote parser<br/>[winner.py]"]
  node_analyzer["Debate analyzer<br/>[debate_engine.py]"]
end

subgraph group_llm["Model access"]
  node_agent["Streaming agent client<br/>[agents.py]"]
end

node_user(("Topic user"))
node_openrouter{{"OpenRouter API"}}

node_user -->|"enters topic"| node_gradio
node_gradio -->|"starts debate"| node_engine
node_user -->|"enters topic"| node_terminal
node_terminal -->|"runs debate"| node_engine
node_engine -->|"runs turns"| node_pro
node_engine -->|"runs turns"| node_anti
node_engine -->|"formats prompts"| node_prompts
node_pro -->|"requests response"| node_agent
node_anti -->|"requests response"| node_agent
node_engine -->|"requests evaluations"| node_judges
node_judges -->|"requests judgments"| node_agent
node_engine -->|"parses votes"| node_winner
node_engine -->|"counts votes"| node_voting
node_engine -->|"requests analysis"| node_analyzer
node_analyzer -->|"requests breakdown"| node_agent
node_agent -->|"streams requests"| node_openrouter
node_engine -->|"returns results"| node_gradio

click node_gradio "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/app.py"
click node_terminal "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/main.py"
click node_engine "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py"
click node_prompts "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/prompts.py"
click node_pro "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py"
click node_anti "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py"
click node_judges "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py"
click node_voting "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py"
click node_winner "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/winner.py"
click node_analyzer "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py"
click node_agent "https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/agents.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gradio,node_terminal,node_user toneBlue
class node_engine,node_prompts,node_pro,node_anti toneAmber
class node_judges,node_voting,node_winner,node_analyzer,node_openrouter toneMint
class node_agent toneRose
```

## Components

### Entry points

- [Gradio interface](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/app.py): `app.py`
- [Terminal entry](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/main.py): `main.py`

### Debate orchestration

- [Debate engine](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py): `debate_engine.py`
- [Agent prompts](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/prompts.py): `prompts.py`
- [PRO turns](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py): `debate_engine.py`
- [ANTI turns](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py): `debate_engine.py`

### Evaluation and analysis

- [Three judges](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py): `debate_engine.py`
- [Consensus voting](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py): `debate_engine.py`
- [Vote parser](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/winner.py): `winner.py`
- [Debate analyzer](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/debate_engine.py): `debate_engine.py`

### Model access

- [Streaming agent client](https://github.com/varshith-reddy-m/multi-agent-ai-debate-system/blob/master/agents.py): `agents.py`

### Other components

- **Topic user**
- **OpenRouter API**

## Connections

- Topic user → Gradio interface: enters topic (evidence: `app.py`)
- Gradio interface → Debate engine: starts debate (evidence: `app.py`)
- Topic user → Terminal entry: enters topic (evidence: `main.py`)
- Terminal entry → Debate engine: runs debate (evidence: `main.py`)
- Debate engine → PRO turns: runs turns (evidence: `debate_engine.py`)
- Debate engine → ANTI turns: runs turns (evidence: `debate_engine.py`)
- Debate engine → Agent prompts: formats prompts (evidence: `debate_engine.py`)
- PRO turns → Streaming agent client: requests response (evidence: `debate_engine.py`)
- ANTI turns → Streaming agent client: requests response (evidence: `debate_engine.py`)
- Debate engine → Three judges: requests evaluations (evidence: `debate_engine.py`)
- Three judges → Streaming agent client: requests judgments (evidence: `debate_engine.py`)
- Debate engine → Vote parser: parses votes (evidence: `debate_engine.py`)
- Debate engine → Consensus voting: counts votes (evidence: `debate_engine.py`)
- Debate engine → Debate analyzer: requests analysis (evidence: `debate_engine.py`)
- Debate analyzer → Streaming agent client: requests breakdown (evidence: `debate_engine.py`)
- Streaming agent client → OpenRouter API: streams requests (evidence: `agents.py`)
- Debate engine → Gradio interface: returns results (evidence: `app.py`)
