Democratic AI: Multi-agent opinion aggregation with fairness guarantees
Project description
AgorAI: Democratic AI Through Multi-Agent Aggregation
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:
- Gathers opinions from multiple diverse agents (different models, cultural perspectives, or stakeholders)
- Aggregates these opinions using mathematically rigorous methods from social choice theory
- 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_KEYorREPLICATE_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
- Aggregation Methods - All 14+ methods with parameters and examples
- Mechanism Aliases - Intuitive names for aggregation methods
- Property Analysis - Select mechanisms based on theoretical properties
Applications
- Bias Mitigation - Detect and mitigate AI bias
- Council Creation - Auto-generate diverse perspectives
- Counterfactual Testing - Causal robustness evaluation
Advanced Topics
- Queue Processing - Batch operations and benchmarking
- Visualization - Plots and explanations
- Custom Extensions - Add your own methods
Reference
- API Reference - Complete function signatures
- Configuration - Environment variables and settings
- Examples - Code examples and demos
🎓 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
- Issues: GitHub Issues
- Email: samuel.schlenker@example.com
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agorai-0.1.2.1.tar.gz.
File metadata
- Download URL: agorai-0.1.2.1.tar.gz
- Upload date:
- Size: 73.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4920f205c484589512c5c2eb3a945e36836f256463bb894837395718bf6593a4
|
|
| MD5 |
e14c1616462b8ee0927b88eea58d8db9
|
|
| BLAKE2b-256 |
9dc5080a353c2a7d8180e3d9a0f6bb90caeb4ea13cad2bd18e2c4bfc5e94e15a
|
File details
Details for the file agorai-0.1.2.1-py3-none-any.whl.
File metadata
- Download URL: agorai-0.1.2.1-py3-none-any.whl
- Upload date:
- Size: 78.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03a95c443511066879323d0f95ccf81dd198fea34b904335c6b38e1656f09e13
|
|
| MD5 |
02fbc73537a663c2fb7c89278e36a7ce
|
|
| BLAKE2b-256 |
1de51255c26fa906721b142fea3929915e17c40e5c382439748f43b97cfbbd25
|