Skip to main content

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.

Features

  • Pure Mathematical Aggregation (agorai.aggregate): 25+ aggregation methods from social choice theory, welfare economics, and game theory
  • LLM-Based Synthesis (agorai.synthesis): Multi-provider LLM integration (OpenAI, Anthropic, Ollama, Google) with unified opinion synthesis
  • Bias Mitigation (agorai.bias): Full pipeline for detecting and mitigating AI bias through cultural perspective diversity

Installation

# Minimal installation (aggregation only)
pip install agorai

# With LLM synthesis support
pip install agorai[synthesis]

# With bias mitigation support
pip install agorai[bias]

# Full installation
pip install agorai[all]

Quick Start

1. Pure Mathematical Aggregation

from agorai.aggregate import aggregate

# Aggregate utilities from multiple agents
utilities = [
    [0.8, 0.2, 0.5],  # Agent 1's utilities for 3 candidates
    [0.3, 0.7, 0.4],  # Agent 2's utilities
    [0.6, 0.5, 0.9],  # Agent 3's utilities
]

result = aggregate(utilities, method="atkinson", epsilon=1.0)
print(result)
# {'winner': 2, 'scores': [0.54, 0.42, 0.58], 'method': 'atkinson'}

2. LLM-Based Opinion Synthesis

from agorai.synthesis import synthesize, Agent

# Create diverse agents
agents = [
    Agent(provider="openai", model="gpt-4", api_key="sk-..."),
    Agent(provider="anthropic", model="claude-3-5-sonnet-20241022", api_key="sk-ant-..."),
    Agent(provider="ollama", model="llama3.2"),
]

# Synthesize opinions
result = synthesize(
    prompt="Should we approve this marketing campaign?",
    agents=agents,
    aggregation_method="majority"
)

print(result['decision'])  # The aggregated decision
print(result['confidence'])  # Confidence score

3. Bias Mitigation

from agorai.bias import mitigate_bias, BiasConfig

# Configure bias mitigation
config = BiasConfig(
    context="hate_speech_detection",
    providers=["openai", "anthropic"],
    aggregation_method="schulze_condorcet",
    cultural_perspectives=5
)

# Mitigate bias in content moderation
result = mitigate_bias(
    input_text="Is this content appropriate?",
    config=config
)

print(result['decision'])  # Bias-mitigated decision
print(result['fairness_metrics'])  # Fairness analysis

Available Aggregation Methods

  • Social Choice: majority, borda, schulze_condorcet, approval_voting, supermajority
  • Welfare Economics: maximin, atkinson, nash_bargaining
  • Machine Learning: centroid, robust_median, consensus
  • Game Theory: quadratic_voting, veto_hybrid

Use Cases

For AI Researchers

  • Experiment with multi-agent architectures
  • Integrate human feedback through democratic aggregation
  • Compare fairness properties of different aggregation methods

For ML Engineers

  • Build bias-resistant content moderation systems
  • Aggregate predictions from ensemble models with fairness guarantees
  • Implement human-in-the-loop AI systems

For Social Scientists

  • Study collective decision-making in AI systems
  • Analyze cultural bias in language models
  • Evaluate fairness of algorithmic decisions

Documentation

Full documentation available at: https://agorai.readthedocs.io

Citation

If you use AgorAI in your research, please cite:

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

License

Research and Non-Commercial License

Copyright (c) 2025 Samuel Schlenker

This software is free to use for:

  • ✅ Academic and scientific research
  • ✅ Educational purposes
  • ✅ Personal and private use
  • ✅ Non-profit organizations

Commercial use requires prior written agreement with Samuel Schlenker.

See LICENSE file for complete terms.

For commercial licensing inquiries, please contact Samuel Schlenker.

Contributing

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

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.0.tar.gz (25.9 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.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agorai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 daab8c48fb891992739c05ec5e6f233a9e517a2b96a928d17606870bb1f36943
MD5 33af91eebf23e1979b361b6299810cbb
BLAKE2b-256 c4ddc20066a12b5b91df12182997caf3f1cf83aa8db9562df45fc13fb0536da7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agorai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49606cf3b8f449a8471fef60ee75196d85c3fd0dc054aca6bf69704d2f99039b
MD5 34d5a10d86307e01567e7bd0442eb724
BLAKE2b-256 3890570c8249ab077e3ca6f929cd58d39a8f36b462d6cb978814f35f72042978

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