Socratic Conflict - Conflict Detection & Resolution System
Why Socratic Conflict?
Multi-agent systems create conflicts. Socratic Conflict detects and resolves them automatically:
- Automatic Detection - Identifies data conflicts, decision conflicts, and workflow conflicts
- Multiple Strategies - 5 configurable resolution approaches: Voting, Consensus, Weighted, Priority, and Hybrid
- Consensus Algorithms - 5 algorithms for reaching agreement: Majority, Unanimous, Supermajority, Ranked Choice, Quorum
- Full History Tracking - Complete versioning and retrieval of all conflicts and resolutions
- Severity Assessment - Calculates severity based on number of agents and disagreement magnitude
A comprehensive system for detecting, analyzing, and resolving conflicts between multiple agents in collaborative AI systems.
Features
Conflict Detection
- Automatic Detection: Identifies data conflicts, decision conflicts, and workflow conflicts
- Severity Assessment: Calculates severity based on number of conflicting agents and disagreement magnitude
- Context Tracking: Maintains context information for workflow-specific conflicts
- History Management: Complete conflict history with retrieval and filtering
Resolution Strategies
Choose from 5 configurable resolution approaches:
- VotingStrategy - Simple majority voting among proposals
- ConsensusStrategy - Selects highest confidence proposal
- WeightedStrategy - Scores proposals by agent weight × confidence
- PriorityStrategy - Uses predefined priority rules to select winners
- HybridStrategy - Combines multiple strategies for sophisticated conflict resolution
Consensus Algorithms
5 different algorithms for reaching agreements:
- MajorityConsensus - >50% support required
- UnanimousConsensus - 100% agreement required
- SupermajorityConsensus - Configurable threshold (default 2/3)
- RankedChoiceConsensus - Confidence-based ranking and selection
- QuorumConsensus - Minimum participation requirement + majority rule
Decision Management
- Versioning: Track all decision versions for a conflict
- Reversion: Revert decisions with reason tracking
- Statistics: Comprehensive conflict statistics by type, severity, strategy
Installation
pip install socratic-conflict
Quick Start
Basic Conflict Detection
from socratic_conflict import ConflictDetector, Proposal, Conflict
# Create detector
detector = ConflictDetector()
# Detect data conflict
conflict = detector.detect_data_conflict(
field_name="priority",
values={"agent1": "high", "agent2": "low"},
agents=["agent1", "agent2"]
)
print(f"Conflict detected: {conflict.conflict_type}")
print(f"Severity: {conflict.severity}")
Resolve with Voting
from socratic_conflict import VotingStrategy
strategy = VotingStrategy()
resolution = strategy.resolve(conflict)
print(f"Recommended proposal: {resolution.recommended_proposal_id}")
print(f"Confidence: {resolution.confidence:.2%}")
Use Consensus Algorithm
from socratic_conflict.consensus import SupermajorityConsensus
algorithm = SupermajorityConsensus(threshold=0.75) # 75% required
proposal_id, confidence = algorithm.reach_consensus(conflict)
print(f"Consensus reached on: {proposal_id}")
print(f"Support: {confidence:.2%}")
Track Decision History
from socratic_conflict.history import HistoryTracker
tracker = HistoryTracker()
# Add conflicts and track decisions
tracker.add_conflict(conflict)
tracker.add_resolution(resolution)
# Get full history
history = tracker.get_conflict_history(conflict.conflict_id)
print(f"Resolution strategy used: {history['resolutions'][0].strategy}")
# Get statistics
stats = tracker.get_statistics()
print(f"Total conflicts: {stats['total_conflicts']}")
print(f"Resolution rate: {stats['resolution_rate']:.1%}")
Architecture
socratic_conflict/
├── core/ # Data models
│ └── conflict.py # Proposal, Conflict, Resolution, ConflictDecision
├── detection/ # Detection engine
│ └── detector.py # Conflict detection and severity calculation
├── resolution/ # Resolution strategies
│ └── strategies.py # 5 configurable resolution strategies
├── consensus/ # Consensus algorithms
│ └── algorithms.py # 5 consensus algorithms
└── history/ # History tracking
└── tracker.py # Versioning and retrieval
Core Models
Proposal
@dataclass
class Proposal:
title: str # Human-readable proposal title
source_agent: str # Agent that proposed it
confidence: float = 0.0 # Confidence score (0.0-1.0)
description: str = "" # Detailed description
rationale: str = "" # Why this proposal
Conflict
@dataclass
class Conflict:
conflict_type: str # "data", "decision", "workflow"
severity: str = "medium" # "low", "medium", "high", "critical"
proposals: List[Proposal] # Competing proposals
related_agents: List[str] # Agents involved
context: Dict[str, Any] # Additional context
Resolution
@dataclass
class Resolution:
conflict_id: str # Associated conflict
strategy: str # Strategy used for resolution
recommended_proposal_id: str # Winning proposal
confidence: float # Resolution confidence (0.0-1.0)
Resolution Strategies in Detail
VotingStrategy
Simple majority voting - each agent gets one vote, proposal with most votes wins.
strategy = VotingStrategy()
# Weights: equal vote per agent regardless of confidence
ConsensusStrategy
Selects the proposal with highest confidence score from source agent.
strategy = ConsensusStrategy()
# Selection: argmax(proposal.confidence)
WeightedStrategy
Combines agent weight with proposal confidence.
strategy = WeightedStrategy(weights={
"expert_agent": 0.9, # High weight for experts
"junior_agent": 0.3 # Lower weight for juniors
})
# Score: agent_weight × proposal.confidence
PriorityStrategy
Uses predefined priority rules - highest priority agent's proposal wins.
strategy = PriorityStrategy(priority_rules={
"admin": 10,
"manager": 5,
"user": 1
})
HybridStrategy
Combines multiple strategies and selects best result.
strategy = HybridStrategy(strategies=[
VotingStrategy(),
ConsensusStrategy(),
WeightedStrategy(weights={"expert": 0.9})
])
# Runs all strategies, returns highest confidence result
Consensus Algorithms in Detail
MajorityConsensus
Classic majority rule - >50% support.
algorithm = MajorityConsensus()
# Threshold: 0.5 (>50%)
UnanimousConsensus
All agents must agree.
algorithm = UnanimousConsensus()
# Threshold: 1.0 (100%)
SupermajorityConsensus
Configurable threshold, useful for important decisions.
algorithm = SupermajorityConsensus(threshold=0.67) # 2/3 majority
algorithm = SupermajorityConsensus(threshold=0.75) # 3/4 supermajority
RankedChoiceConsensus
Uses confidence scores for ranking - more nuanced than simple voting.
algorithm = RankedChoiceConsensus()
# Considers proposal confidence scores in ranking
QuorumConsensus
Requires minimum participation before majority applies.
algorithm = QuorumConsensus(quorum_fraction=0.75) # 75% must participate
# Combines quorum requirement with >50% majority of participants
Testing
Run tests with coverage:
pytest tests/unit/ --cov=socratic_conflict --cov-report=term-missing
Current test coverage:
- Core models: 100%
- Detection: 98%
- Strategies: 90%
- Overall: 69%
Quality Gates
All code passes:
- ✅ Black formatting (100% compliant)
- ✅ Ruff linting (0 issues)
- ✅ MyPy type checking (strict mode)
- ✅ Python 3.9-3.12 compatibility
Use Cases
Multi-Agent Negotiation
# Agents propose different solutions
proposals = [
Proposal("Algorithm A", source_agent="ml_expert", confidence=0.9),
Proposal("Algorithm B", source_agent="data_engineer", confidence=0.7),
]
conflict = Conflict(
conflict_type="decision",
proposals=proposals,
related_agents=["ml_expert", "data_engineer"]
)
# Resolve with weighted strategy favoring ML expertise
strategy = WeightedStrategy(weights={
"ml_expert": 0.8,
"data_engineer": 0.5
})
resolution = strategy.resolve(conflict)
Data Validation Conflicts
# Different validation agents disagree
conflict = detector.detect_data_conflict(
field_name="email_format",
values={
"strict_validator": "invalid@format",
"lenient_validator": "valid@format"
},
agents=["strict_validator", "lenient_validator"]
)
# Use unanimous consensus for critical data
algorithm = UnanimousConsensus()
result = algorithm.reach_consensus(conflict) # Will fail (no consensus)
Workflow Execution Conflicts
# Different execution paths proposed
conflict = detector.detect_workflow_conflict(
workflow_id="data_pipeline",
conflicting_steps=[
{"step_id": "s1", "agent": "path_planner_1", "action": "process"},
{"step_id": "s2", "agent": "path_planner_2", "action": "skip"}
]
)
# Track decision history
tracker.add_conflict(conflict)
decision = ConflictDecision(
conflict_id=conflict.conflict_id,
chosen_proposal_id=resolution.recommended_proposal_id,
decided_by="workflow_orchestrator"
)
tracker.add_decision(decision)
Documentation
- Conflict Detection Guide - Complete guide to conflict detection, resolution strategies, consensus algorithms, and multi-agent conflict resolution
Integration with Other Socratic Packages
Socratic Conflict integrates naturally with:
- Socratic Agents: Detect/resolve conflicts between agent proposals
- Socratic Workflow: Handle conflicting execution paths
- Socratic Knowledge: Resolve knowledge base consistency conflicts
Performance
- Conflict detection: O(n) where n = number of agents
- Resolution strategies: O(n·m) where m = number of proposals
- Consensus algorithms: O(n·log n) average case
- Memory: O(n) per conflict tracked
For typical use cases (2-10 agents, 2-5 proposals):
- Detection: <1ms
- Resolution: <5ms
- Consensus: <5ms
License
MIT License - See LICENSE file for details
Contributing
Contributions welcome! Please ensure:
- Tests pass (
pytest tests/) - Code is formatted (
black src/ tests/) - Linting passes (
ruff check src/ tests/) - Type checking passes (
mypy src/)
Changelog
v0.1.0 (March 16, 2026)
- ✅ Initial MVP release
- ✅ Conflict detection engine
- ✅ 5 resolution strategies
- ✅ 5 consensus algorithms
- ✅ Decision versioning and history
- ✅ 33 comprehensive unit tests
- ✅ 69% test coverage
- ✅ Full type checking (MyPy strict mode)
Authors
Created as part of the Socrates Ecosystem - a comprehensive AI development framework.
Support Development
If you find this package useful, consider supporting development:
- Become a Sponsor - Get early access to new features
- Star on GitHub - Shows your appreciation
- Report Issues - Help improve the package
Your support helps fund development of the entire Socratic ecosystem.
Status
✅ Production Ready - Currently used in production environments ⏳ Phase 5 - Openclaw skill and LangChain integration in development
Part of Socrates AI Ecosystem
This package is a component of Socrates AI, a production-ready platform for building intelligent multi-agent systems with constitutional governance.
Use This Package Standalone:
pip install socratic-conflict
Or As Part of Socrates Platform:
pip install socrates-ai # Includes 37+ modules + all 11 packages
Integration Example:
See the Socrates ECOSYSTEM.md for detailed integration examples showing how to use socratic-conflict with other Socratic packages.
Related packages you might use together:
More Information:
Metadata
Release files for socratic-conflict 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| socratic_conflict-0.1.6.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| socratic_conflict-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.7 kB
Release files / socratic_conflict-0.1.6.tar.gz
| Download URL | socratic_conflict-0.1.6.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cc07f57d0083ccba667983f0468f4ebddbb45621c80728db9cdb782ad7e4a05
|
|
BLAKE2b-256 checksum How to use checksums |
8aca3bd3f5436270343f6b90e0bce79608764ad1f8fa168fcaf9fef0d1f54328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / socratic_conflict-0.1.6-py3-none-any.whl
| Download URL | socratic_conflict-0.1.6-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dab923a40d0426e95849a397162c7dee7ef0feb657fa2501b5056021e0124157
|
|
BLAKE2b-256 checksum How to use checksums |
6b47d87f57c5c2408027ecd404ff2775e949979e297fafa2b9375ace8000ead2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|