Skip to content

nikhil-verma-ml/DebateGraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗣️ DebateGraph: Multi-Agent AI Debate System

Python LangGraph Groq

DebateGraph is an intelligent Multi-Agent System (MAS) that simulates structured debates between opposing AI personas. Built using LangGraph and LangChain, it orchestrates a strictly controlled workflow where agents maintain memory, adhere to turn-based constraints, and submit to a final verdict by an AI Judge.


🚀 Features

  • Dual-Agent Architecture: Simulates a clash between a Scientist (Empirical/Logic-driven) and a Philosopher (Ethics/Value-driven).
  • Structured Workflow: Enforces a strict 8-round debate format using a Directed Acyclic Graph (DAG).
  • State Management: Uses LangGraph to manage conversation state, turn history, and "next speaker" logic.
  • Smart Memory: Agents receive "sliced" context (only the relevant previous argument) to prevent context bloating.
  • AI Judge: A specialized node analyzes the full transcript to declare a winner based on logical coherence and persuasion.
  • High-Performance Inference: Optimized for Groq API (Llama 3.3) for lightning-fast responses without rate-limit bottlenecks.
  • Audit Logging: Automatically generates timestamped JSON logs for every state transition and argument.

🛠️ Tech Stack

  • Orchestration: LangGraph (StateGraph)
  • LLM Framework: LangChain Core
  • Inference Engine: Groq API (Llama-3.3-70b-versatile)
  • Language: Python 3.10+
  • Utilities: Pydantic (Validation), Python-Dotenv (Config)

⚙️ How It Works (The Graph)

The system operates as a State Machine with the following nodes:

  1. UserInput: Initializes the debate topic.
  2. Controller (Edge): Checks round count. If < 8, routes to the next speaker; if 8, routes to Judge.
  3. Agent Nodes (A/B): Generates arguments using specific system prompts (Scientist vs. Philosopher).
  4. Memory Node: Updates the conversation history and flips the "turn" flag.
  5. Judge Node: Critical analysis of the full debate logic and declares a winner.

DAG Diagram (Note: Diagram is generated automatically on the first run)


📦 Installation

  1. Clone the Repository

    git clone [https://github.com/Nikhil-Codehub/DebateGraph.git](https://github.com/Nikhil-Codehub/DebateGraph.git)
    cd DebateGraph
  2. Create a Virtual Environment

    python -m venv venv
    # Windows
    venv\Scripts\activate
    # Mac/Linux
    source venv/bin/activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Set up Environment Variables Create a .env file in the root directory:

    GROQ_API_KEY=gsk_your_groq_api_key_here

🏃 Usage

Run the main script via CLI:

python main.py

About

🗣️ Intelligent Multi-Agent Debate System built with LangGraph & Groq. Simulates structured arguments between AI personas (Scientist vs. Philosopher) with an automated AI Judge and DAG visualization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages