Skip to main content

Democratic AI: Multi-agent opinion aggregation with fairness guarantees

Project description

AgorAI: Democratic AI Through Multi-Agent Aggregation

Python 3.8+ License: Research

AgorAI is a Python library for building fair, unbiased AI systems through democratic multi-agent opinion aggregation. It combines social choice theory, welfare economics, and modern LLMs to enable collective decision-making with provable fairness guarantees.

🎯 What is AgorAI?

AgorAI addresses a fundamental challenge in AI: How do we make fair decisions when different perspectives disagree?

Instead of relying on a single AI model's judgment, AgorAI:

  1. Gathers opinions from multiple diverse agents (different models, cultural perspectives, or stakeholders)
  2. Aggregates these opinions using mathematically rigorous methods from social choice theory
  3. Produces decisions with provable fairness guarantees

Perfect for: AI researchers, ML engineers, and social scientists building fair multi-agent systems.

📦 Installation

pip install agorai[all]

API Keys (Optional):

  • For LLM synthesis: OPENAI_API_KEY, ANTHROPIC_API_KEY, or configure Ollama locally
  • For counterfactual testing: OPENAI_API_KEY or REPLICATE_API_TOKEN

🚀 Quick Start

Use Case 1: Aggregate Opinions from Multiple Agents

The most common use case - combine utilities/opinions from multiple agents:

from agorai.aggregate import aggregate

# Three agents provide utilities for three candidates
utilities = [
    [0.8, 0.2, 0.5],  # Agent 1's utilities
    [0.3, 0.7, 0.4],  # Agent 2's utilities
    [0.6, 0.5, 0.9],  # Agent 3's utilities
]

# Use "fair" aggregation (Atkinson method)
result = aggregate(utilities, method="fair")
print(f"Winner: Candidate {result['winner']}")
print(f"Scores: {result['scores']}")

Try different methods:

# Protect minorities
result = aggregate(utilities, method="minority-focused")  # Maximin

# Resist outliers
result = aggregate(utilities, method="robust")  # Robust Median

# Democratic voting
result = aggregate(utilities, method="democratic")  # Majority

# Or use technical names
result = aggregate(utilities, method="schulze_condorcet")

See all options: Aggregation Methods Documentation


Use Case 2: Mitigate Bias Through Multi-Perspective Analysis

Detect and mitigate bias by synthesizing diverse cultural perspectives:

from agorai.bias import mitigate_bias

# Analyze content from multiple cultural perspectives
result = mitigate_bias(
    input_text="Is this job posting discriminatory?",
    input_image=None,  # Optional: for multimodal analysis
    aggregation_method="fair",
    num_perspectives=5  # Generate 5 diverse cultural perspectives
)

print(f"Decision: {result['decision']}")
print(f"Confidence: {result['confidence']:.2%}")
print(f"Fairness metrics: {result['fairness_metrics']}")

See full guide: Bias Mitigation Documentation


📚 Documentation

Core Functionality

Applications

Advanced Topics

Reference

🎓 Key Concepts

Aggregation Methods (14+ Available)

Category Methods Use When
Social Choice Majority, Borda, Schulze, Approval Democratic legitimacy, ranked preferences
Welfare Economics Maximin, Atkinson Fairness, inequality aversion, minority protection
Machine Learning Robust Median, Consensus Outlier resistance, ensemble predictions
Game Theory Nash Bargaining, Veto Hybrid Strategic settings, minority veto power

Full list: Aggregation Methods Documentation

Why Democratic Aggregation?

Problem: Single AI models can be biased, unfair, or make decisions that don't align with diverse human values.

Solution: Democratic aggregation provides:

  • Fairness: Mechanisms with provable properties (anonymity, Pareto efficiency, minority protection)
  • Diversity: Incorporates multiple perspectives systematically
  • Transparency: Clear mathematical procedures, not black-box decisions
  • Robustness: Resistant to outliers and strategic manipulation

🔬 Research & Citations

AgorAI builds on decades of research in social choice theory, welfare economics, and multi-agent AI systems.

Related Research:

  • Constitutional AI (Anthropic)
  • Multi-agent reinforcement learning (MARL)
  • Test-time compute scaling (OpenAI o1)
  • Collective decision-making in AI

Citing AgorAI:

@software{agorai2025,
  author = {Schlenker, Samuel},
  title = {AgorAI: Democratic AI Through Multi-Agent Aggregation},
  year = {2025},
  url = {https://github.com/yourusername/agorai}
}

🤝 Contributing

Contributions for research and non-commercial purposes are welcome! See CONTRIBUTING.md for guidelines.

Areas where we'd love help:

  • Additional benchmark datasets
  • New aggregation mechanisms
  • Documentation improvements
  • Bug reports and feature requests

📄 License

Research and Non-Commercial License

Copyright (c) 2025 Samuel Schlenker

Free for academic research, education, and non-commercial use. Commercial use requires prior written agreement.

See LICENSE for full terms.

📧 Contact


Built with ❤️ for the democratic AI research community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agorai-0.1.2.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agorai-0.1.2-py3-none-any.whl (78.5 kB view details)

Uploaded Python 3

File details

Details for the file agorai-0.1.2.tar.gz.

File metadata

  • Download URL: agorai-0.1.2.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for agorai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e9efbae84db8d0c9f152a717e1cdbb88489ea945821500d556f1cc0510f9574e
MD5 d6f331fbd077f67ab0b957eaea89caa6
BLAKE2b-256 2b0b7c68678f320bd5f48518cd46682dc8087950e0cddec9409375fa204dd976

See more details on using hashes here.

File details

Details for the file agorai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: agorai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 78.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for agorai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e7dc2054787f364fd030088ae7dd4a2d3a5ae5a21cb466a1c5f046bbac27356
MD5 e010441f9667cbb140c977442ae33875
BLAKE2b-256 26f0e74c429d7c742b2048af411393d57a6971b5c0d34dafbbd831ed71f1f6ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page