Skip to content

ChiragSW/LLM-Town-Hall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Policy Town Hall Simulator

A multi-agent AI system where 5 autonomous stakeholder agents, each with a distinct identity, bias, and value system, debate any policy question across multiple rounds of structured deliberation. A Summarizer agent synthesizes the debate into a structured impact report with consensus areas, key disagreements, actionable recommendations, implementation roadmaps, and preserved minority dissent. Reports are automatically saved to Google Drive and emailed via Gmail. The entire system runs through a real-time Streamlit web interface with live debate streaming, powered by local LLM inference via Ollama, no API costs, no cloud dependency.


Architecture

Logo

Quick Start

1. Clone and enter the project

git clone https://github.com/ChiragSW/LLM-Town-Hall.git
cd policy-town-hall

2. Create and activate a virtual environment

python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment

copy .env.example .env     # Windows
# cp .env.example .env     # macOS/Linux

Edit .env with your settings. The defaults work out of the box with Ollama.

5. Install and start Ollama

Download from ollama.com, then:

ollama pull qwen2.5:3b-instruct
ollama pull qwen2.5:7b-instruct

6. Run the application

streamlit run ui/app.py

Open http://localhost:8501 in your browser.


The 5 Stakeholder Agents

# Emoji Name Identity Core Values
1 👤 Citizen Representative Priya Sharma, 34, mid-sized city resident Fairness, affordability, human dignity
2 📊 Independent Economist Dr. Arjun Mehta, development economist, 15yr experience Evidence, data, non-partisan analysis
3 🌱 Environmental Scientist Dr. Meera Nair, climate policy researcher Ecological health, environmental justice
4 🏭 Business Representative Rajesh Kapoor, MSME entrepreneur, 140 employees Practicality, business viability, anti-stupid-regulation
5 🏛️ Senior Policy Analyst Vikram Rao, 20-year IAS veteran Implementation feasibility, institutional realism

Best Demo Policies

These three policies are tested to produce genuinely split, engaging debates:

  1. "Should Ahmedabad ban petrol and diesel auto-rickshaws by 2027 and replace them with CNG/electric?"

  2. "Should India impose a carbon tax of ₹2,000 per tonne on all industrial CO2 emissions?"

  3. "Should public schools in India serve free mid-day meals through Grade 12?"


Google OAuth Setup (Drive + Gmail)

To enable automatic report saving and email delivery:

Step 1: Create a Google Cloud Project

  1. Go to Google Cloud Console
  2. Create a new project (e.g., "Policy Town Hall")
  3. Enable the Google Drive API and Gmail API from APIs & Services → Library

Step 2: Create OAuth Credentials

  1. Go to APIs & Services → Credentials
  2. Click "Create Credentials" → "OAuth 2.0 Client ID"
  3. Application type: Desktop app
  4. Download the JSON file and save it as client_secret.json in the project root

Step 3: Configure OAuth Consent Screen

  1. Go to APIs & Services → OAuth consent screen
  2. Set to External (or Internal for Workspace)
  3. Add your email as a test user

Step 4: First Run

On first run with Drive/Gmail enabled, a browser window will open for OAuth consent. After authorization, a token.json file is created automatically for future runs.

Note: Google OAuth is optional. The debate and report generation work perfectly without it. The app gracefully handles missing Google credentials.


What Makes This Different

  • Multi-agent adversarial debate -> Not a single-prompt summarizer. Five agents with genuinely different value systems build on, challenge, and respond to each other across multiple rounds, producing richer analysis than any single-agent system.

  • Evidence-grounded reasoning -> DuckDuckGo web search injects real-world data, statistics, and precedents into each agent's context. Agents cite sources. Claims are traceable.

  • Preserved minority dissent -> The summarizer is explicitly instructed to never smooth over disagreements. The report preserves the most important dissenting view with full attribution — because silenced dissent is a policy failure waiting to happen.

  • Local-first, zero-cost inference -> Runs entirely on your machine via Ollama with 3B/7B models. No API keys required for the core debate loop. Cloud LLM (Anthropic) is an optional fallback.


Resume Bullet Point

Built a 5-agent autonomous policy simulation system with local LLM inference (Ollama), multi-round debate orchestration, DuckDuckGo-grounded evidence snippets, and automated Google Drive/Gmail delivery — generating structured policy impact reports with preserved minority dissent in under 2 minutes.


Project Structure

policy-town-hall/
├── .env.example          # Environment variable template
├── .gitignore            # Git ignore rules
├── config.py             # Central config + unified LLM call wrapper
├── requirements.txt      # Python dependencies
├── README.md             # This file
├── SETUP.md              # Quick setup commands
│
├── agents/
│   ├── __init__.py
│   ├── definitions.py    # 5 stakeholder agent identities + system prompts
│   ├── orchestrator.py   # Frames policy → structured debate plan
│   └── summarizer.py     # Debate → structured impact report
│
├── core/
│   ├── __init__.py
│   ├── debate.py         # Multi-round debate engine w/ context builder
│   ├── google_tools.py   # Google Drive + Gmail integration (OAuth2)
│   └── search.py         # DuckDuckGo search wrapper
│
├── data/
│   ├── __init__.py
│   └── storage.py        # SQLite persistence layer
│
├── ui/
│   ├── __init__.py
│   └── app.py            # Streamlit web interface
│
└── tests/
    ├── __init__.py
    └── test_debate.py    # Unit tests for debate engine + agents

About

Wanted to know if a policy is good to implement? let 5 people LLMs debate and get a good insight about it. Enjoy the debate without drama

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages