GitHub - saztd/debatechamber: Philosophical Debate Chamber - AI philosophers debate life's deepest questions

4 min read Original article β†—

A multi-agent philosophical debate platform powered by the GitHub Copilot SDK. Six AI agents embodying different philosophical traditions debate life's deepest questions, with a moderator synthesizing the final answer.

Philosophers

Agent Tradition Core Focus
πŸ›οΈ Marcus Stoic Virtue, self-mastery, accepting what we cannot control
🎭 Jean-Paul Existentialist Freedom, authenticity, creating our own meaning
πŸͺ· Thich Buddhist Impermanence, non-attachment, compassion
πŸ”§ William Pragmatist Practical consequences, what works in reality
πŸ”¬ RenΓ© Rationalist Reason, logic, first principles
πŸŽͺ Albert Absurdist Embracing life's absurdity with revolt and joy

Features

  • Real-time debates: Watch philosophers respond and challenge each other via Server-Sent Events
  • Moderator synthesis: A final synthesis highlighting agreements, tensions, and insights
  • Persistence: Debates are saved to database (SQLite for dev, PostgreSQL for production)
  • History: Browse and revisit past debates

Tech Stack

  • Backend: Python Flask
  • AI Runtime: GitHub Copilot SDK
  • Database: SQLAlchemy (SQLite / PostgreSQL)
  • Frontend: Vanilla JS with SSE streaming
  • Deployment: Azure Web App + Azure PostgreSQL

Quick Start

Prerequisites

  1. GitHub Copilot CLI installed and authenticated
  2. Python 3.8+

Local Development

# Clone the repository
git clone https://github.com/yourusername/debatechamber.git
cd debatechamber

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Copy environment file
cp .env.example .env

# Run the application
python app.py

Visit http://localhost:5000 to start debating!

Azure Deployment

1. Create Azure Resources

# Create resource group
az group create --name debate-chamber-rg --location eastus

# Create PostgreSQL server
az postgres flexible-server create \
  --resource-group debate-chamber-rg \
  --name debate-chamber-db \
  --admin-user adminuser \
  --admin-password <your-password> \
  --sku-name Standard_B1ms

# Create database
az postgres flexible-server db create \
  --resource-group debate-chamber-rg \
  --server-name debate-chamber-db \
  --database-name debatechamber

# Create Web App
az webapp create \
  --resource-group debate-chamber-rg \
  --plan debate-chamber-plan \
  --name debate-chamber-app \
  --runtime "PYTHON:3.11"

2. Configure Environment Variables

In Azure Portal, navigate to your Web App > Configuration > Application settings:

DATABASE_URL=postgresql://adminuser:<password>@debate-chamber-db.postgres.database.azure.com:5432/debatechamber?sslmode=require
FLASK_SECRET_KEY=<generate-a-secure-key>
FLASK_ENV=production
COPILOT_GITHUB_TOKEN=ghp_your_github_pat_with_copilot_access

3. Configure Startup Command

Set the startup command to: startup.sh

4. Deploy

# Deploy using Azure CLI
az webapp up --name debate-chamber-app --resource-group debate-chamber-rg

Authentication & Multi-User Access

How Authentication Works

The Copilot SDK requires authentication to access AI models. There are three options:

Option 1: Single-Owner Mode (Your Subscription)

Best for personal projects or demos where YOU pay for all usage.

  1. Create a GitHub Personal Access Token (PAT) with "Copilot Requests" scope
  2. Set COPILOT_GITHUB_TOKEN environment variable in Azure
  3. All API calls are billed to your Copilot subscription
# In Azure App Settings
COPILOT_GITHUB_TOKEN=ghp_your_personal_access_token

Option 2: BYOK - Bring Your Own Key (Enterprise)

Best for organizations wanting to use their own LLM API keys.

  1. Go to GitHub Enterprise Settings β†’ Copilot β†’ Models β†’ Custom Models
  2. Add API keys from: OpenAI, Anthropic, Azure OpenAI, AWS Bedrock, Google AI
  3. The SDK automatically uses your organization's configured keys
  4. Billing goes directly to your LLM provider

Supported providers:

  • OpenAI
  • Anthropic (Claude)
  • Azure OpenAI
  • AWS Bedrock
  • Google AI Studio
  • xAI (Grok)

Option 3: Per-User OAuth (Each User Pays)

Best for apps where each user has their own Copilot subscription.

  1. Implement GitHub OAuth login in your app
  2. Pass each user's token to the SDK
  3. Each user's API calls are billed to their own subscription

Environment Variables

Variable Description Default
DATABASE_URL Database connection string sqlite:///debates.db
FLASK_SECRET_KEY Session encryption key dev-secret-key-...
FLASK_ENV Environment (development/production) development
COPILOT_GITHUB_TOKEN GitHub PAT for Copilot access (uses CLI auth)
COPILOT_MODEL AI model to use gpt-4.1

Project Structure

debatechamber/
β”œβ”€β”€ app.py              # Flask application & routes
β”œβ”€β”€ config.py           # Configuration management
β”œβ”€β”€ models.py           # SQLAlchemy database models
β”œβ”€β”€ philosophers.py     # Agent definitions & prompts
β”œβ”€β”€ requirements.txt    # Python dependencies
β”œβ”€β”€ startup.sh          # Azure startup script
β”œβ”€β”€ .env.example        # Environment template
β”œβ”€β”€ static/
β”‚   └── style.css       # Styling
└── templates/
    β”œβ”€β”€ index.html      # Main debate page
    β”œβ”€β”€ debates.html    # Debate history list
    └── debate_detail.html  # Individual debate view

License

MIT Philosophical Debate Chamber