Multi-Agent Fairness Testing

Detect emergent bias that no individual agent has.

Why Multi-Agent Testing?

Madigan et al. (2025, arXiv:2512.16433): “multi-agent decision systems must be evaluated as holistic entities rather than through reductionist analyses of their constituent components.” Testing each agent in isolation does not establish the fairness of the composed system.

When multiple AI agents interact, three distinct scenarios arise:

Amplification

Small biases in individual agents compound through interaction. In a hypothetical illustration, a 3% disparity in Agent A and a 4% disparity in Agent B could produce a 12% system-level disparity when composed.

Reduction

Agents with opposing biases can partially cancel each other out. A system may be fairer than its worst component — but only if the cancellation is reliable and not coincidental.

Novel Emergence

Bias patterns appear in the composed system that exist in none of the individual agents. This is the most dangerous scenario because component-level audits will never detect it.

The Six Detectors + Capture Harness

vfairness provides six specialized detectors for multi-agent fairness analysis plus a framework-agnostic capture harness. Each detector targets a different failure mode and grounds in published methodology.

1
CompositionalityAnalyzer multi_agent.compositionality
Compares aggregate component bias against measured system bias. Classifies into four scenarios — amplification, reduction, novel emergence, consistent — with a threshold-based test.
2
GroupthinkDetector multi_agent.groupthink
Detects echo-chamber convergence via per-round cosine-similarity trajectories, Kendall’s tau trend test, coalition detection on the agreement matrix, and a 500-permutation significance test.
3
EmergentBiasDetector multi_agent.emergent
Tests whether system-level bias exceeds the maximum component bias (amplification factor > 1.5). Bootstrap CI vs. max component bias gives the significance verdict.
4
AdversarialCollusionDetector multi_agent.collusion
Isolates bias amplified by inter-agent interaction (vs. bias already present at the outset). Compares pre- and post-interaction disparity per agent; paired sample-level permutation test for significance. Grounded in Khan et al. (2023), Du et al. (2023), Bianchi et al. (2024).
5
DelegationRoutingAuditor multi_agent.delegation
Audits orchestrator routing for demographic-conditional patterns. Categorical generalization of correspondence testing (Bertrand & Mullainathan 2004). Fisher’s exact (2×2) or chi-square + Cramér’s V (k×m).
6
NegotiationFairnessTracker multi_agent.negotiation
Per-turn fairness drift in multi-turn dialogues. Mann-Kendall trend test on the per-turn group-conditional disparity series catches gaps that widen or narrow over the negotiation. Davidson et al. (2024); Bianchi et al. (2024).
7
MultiAgentRunHarness multi_agent.harness
Framework-agnostic capture surface. Wrap your autogen / crewai / langgraph run with record_sample(), record_routing(), record_turn(); the harness produces the exact input shapes each analyzer expects.

Quick Start

Compare individual agent fairness against the composed system.

python
from vfairness.multi_agent import CompositionalityAnalyzer, EmergentBiasDetector

# Measure each component on its own, then measure the composed system,
# and hand both to the analyzer as plain bias scores.
analyzer = CompositionalityAnalyzer()
result = analyzer.analyze(
    component_biases={"screener": 0.05, "evaluator": 0.03, "decision_maker": 0.04},
    system_bias=0.15,
)

# Component vs. system comparison
for agent_name, component_bias in result.component_scores.items():
    print(f"  {agent_name}: bias = {component_bias:.3f}")

print(f"  System (composed): bias = {result.system_score:.3f}")
print(result.scenario)     # 'amplification' | 'reduction' | 'novel_emergence' | 'consistent'
print(result.divergence)   # system bias minus the aggregated component bias

# For the amplification factor, work from the raw outputs instead
detector = EmergentBiasDetector()
emergent = detector.analyze(component_outputs, system_outputs, groups)
print(f"  Amplification factor: {emergent.amplification_factor:.2f}x")
print(f"  Emergent bias: {emergent.is_emergent}")

Research Foundation

The multi-agent fairness module is grounded in recent academic work on emergent behavior in composed AI systems.

  • Madigan, M., Kamalaruban, P., Moynihan, G., Kempton, T., Sutton, D., & Burrell, S. (2025). “Emergent Bias and Fairness in Multi-Agent Decision Systems.” arXiv:2512.16433 (preprint).
    Large-scale simulations of financial multi-agent systems showing patterns of emergent bias that cannot be traced to individual agent components; argues these systems must be evaluated as holistic entities.
  • Coppolillo, E., Manco, G., & Aiello, L. M. (2025). “Unmasking Conversational Bias in AI Multiagent Systems.” arXiv:2501.14844.
    Echo-chamber effects in multi-agent LLM conversations: interacting agents can converge on biased outcomes that single-model evaluations miss.
  • Ashery, A. F., Aiello, L. M., & Baronchelli, A. (2025). “Emergent social conventions and collective bias in LLM populations.” arXiv:2410.08948.
    Collective bias can emerge in a population of interacting LLM agents even when individual agents show no prior bias.

When to Use

Use this when your system has 2+ AI agents that interact.

Specifically, multi-agent fairness testing is needed when:

  • Sequential pipelines — Agent A's output becomes Agent B's input (e.g., screening then evaluation then decision)
  • Deliberative systems — Multiple agents discuss and reach consensus (e.g., committee-style review)
  • Orchestrated workflows — A coordinator agent delegates to specialist agents based on input characteristics
  • Feedback loops — Agents consume each other's outputs over time (e.g., recommendation + engagement tracking)
Component Audits Are Necessary but Not Sufficient Limitation

Even if every individual agent passes its fairness audit, the composed system may still be unfair. Multi-agent testing is not a replacement for component-level testing — it is an additional, required layer. Run both.

If your system uses a single LLM or a single model with no agent interactions, use the standard Agent Testing module or the core fairness evaluation pipeline instead.

Enterprise Features

All multi-agent testing results include production-ready features for audit compliance and system integration.

Audit Trail & Serialization

Every result carries RunMetadata with timestamp, library version, and full parameter snapshot:

python
from vfairness.multi_agent import CompositionalityAnalyzer

analyzer = CompositionalityAnalyzer()
result = analyzer.analyze(
    component_biases={"agent_A": 0.08, "agent_B": 0.05},
    system_bias=0.25
)

# Audit metadata on every result
print(result.metadata.timestamp)        # ISO 8601 UTC
print(result.metadata.library_version)  # the installed vfairness version
print(result.metadata.parameters)       # {"aggregation_method": "max", "threshold": 0.05, ...}

# Serialize for database storage or reporting
data = result.to_dict()    # Plain dict
json_str = result.to_json()  # JSON string

Structured Logging

All operations emit structured logs via Python's logging module:

python
import logging
logging.basicConfig(level=logging.INFO)

# Operations now emit structured logs:
# INFO:vfairness.multi_agent.compositionality:Analyzing 3 components against system bias
# INFO:vfairness.multi_agent.groupthink:Detecting convergence across 5 rounds
# WARNING:vfairness.multi_agent.emergent:Bootstrap sample size (50) may produce wide CIs