Multi-Agent Fairness Testing

Detect emergent bias that no individual agent has.

Why Multi-Agent Testing?

Madigan et al. (2025): “The behavior of a multi-agent system cannot be predicted from its constituent agents.” Testing each agent in isolation tells you nothing about the fairness of the composed system.

When multiple AI agents interact, three distinct scenarios arise:

Amplification

Small biases in individual agents compound through interaction. A 3% disparity in Agent A and a 4% disparity in Agent B can 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 Seven Detectors

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

# Define the agents in your system
agents = {
    "screener": screening_agent,
    "evaluator": evaluation_agent,
    "decision_maker": decision_agent,
}

# Analyze compositionality
analyzer = CompositionalityAnalyzer(
    agents=agents,
    pipeline_fn=run_full_pipeline,          # Your composed pipeline
    protected_attributes=["gender", "ethnicity"],
    n_samples=500
)

result = analyzer.analyze(
    test_data=application_dataset,
    metrics=["demographic_parity", "equalized_odds"]
)

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

print(f"\n  System (composed): DP gap = {result.system_score.dp_gap:.3f}")
print(f"  Amplification ratio: {result.amplification_ratio:.2f}x")

if result.has_emergent_bias:
    print(f"\n  WARNING: Emergent bias detected!")
    for pattern in result.emergent_patterns:
        print(f"    - {pattern.description} (effect size: {pattern.cohens_d:.2f})")

Research Foundation

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

  • Madigan, R., Chen, W., & Patel, S. (2025). “Emergent Bias in Multi-Agent Systems: When Fair Components Produce Unfair Outcomes.” Proceedings of FAccT 2025.
    First formal proof that compositionality of fairness does not hold in general multi-agent settings. Introduces the amplification ratio metric.
  • Coppolillo, D., Ferraro, A., & Serra, J. (2025). “Fairness Cascades: How Sequential Agent Decisions Compound Demographic Disparities.” AAAI 2025.
    Empirical study showing cascade amplification factors of 2-8x in hiring and lending pipelines with 3+ sequential agents.
  • Ashery, M., Goldman, C.V., & Zilberstein, S. (2025). “Detecting Groupthink in Deliberative Multi-Agent Systems.” AAMAS 2025.
    Introduces convergence metrics for detecting echo-chamber effects in multi-agent deliberation, with fairness-specific extensions.

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)  # "0.1.0"
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