Overview
Multi-Agent Debate is the first experimental open framework that approaches debate consensus and market arbitration as complex adaptive systems requiring multi-agent dynamic reflective reasoning architectures for decision-making. Unlike traditional debate consensus or algorithmic trading arbitration, multi-agent debate implements a multi-agent system where each agent embodies a distinct ontology, enabling dynamic market understanding through multi-agent adjudication and attribution-weighted consensus.
"Markets are efficient precisely to the extent that Multi-Agent cognition can penetrate their complexity."
Example Output
โฯINIT:main.pyโปinit
$ python main.py --mode backtest \
--start-date 2022-01-01 \
--end-date 2022-12-31 \
--agents graham \
--llm-provider anthropic \
--show-trace \
--trace-level symbolic \
--consensus-graph \
--tickers AAPL MSFT TSLA \
--rebalance-frequency weekly
๐โกโฯRECURSION.INITIATE::main.pyโกGrahamAgent[active]
โ ENTRYPOINT: Multi-Agent Debate ยป Multi-Agent Market Cognition Platform
โ Mode: backtest
โ Agent: GrahamAgent ๐งฎ (value-based fundamentalist)
โ Attribution Tracing: enabled
โ Trace Level: symbolic
โ Rebalance: weekly
โ LLM Provider: anthropic
โ Start Date: 2022-01-01
โ End Date: 2022-12-31
โ Tickers: AAPL, MSFT, TSLA
โ Output: consensus_graph + symbolic attribution report
โ Status: ๐mirroringโฆ
โฏฯTRACE: SYMBOLIC ATTRIBUTION RECONSTRUCTION [GrahamAgent]
๐ GrahamAgent โ reasoning_depth=3 โ memory_decay=0.2
โณ valuation anchor: intrinsic value estimation
โณ .p/reflect.trace{target=valuation}
โณ .p/anchor.self{persistence=medium}
โณ token-level input (AAPL) โ QK attention trace:
- P/E ratio โ 0.34 salience
- Debt-to-equity โ 0.21
- Free cash flow โ 0.41
โณ Attribution result: BUY SIGNAL (confidence=0.78)
๐ง Attribution graph visualized as radial node cluster
Core node: Intrinsic Value = $141.32
Peripheral influence: FCF strength > earnings volatility
๐ TEMPORAL RECURSION SNAPSHOT [Weekly Cycle]
Week 03/2022
Market dip detected
GrahamAgent re-evaluates MSFT with memory trace decay
Signal shift: HOLD โ BUY (attribution confidence rises from 0.54 โ 0.73)
Trace tag: .p/reflect.history{symbol=MSFT}
๐ CONSENSUS GRAPH SNAPSHOT
MetaAgent Arbitration:
โณ Only one active agent: GrahamAgent
โณ Consensus = agent signal
โณ Position sizing: 18.6% TSLA, 25.1% AAPL, 20.3% MSFT
โณ Risk budget adjusted using: shell-failure map = stable
๐โRENDERED::symbolic_trace.json + consensus_graph_2022.json
๐ Output stored in /output/backtest_results_2022-01-01_2022-12-31/
Key Features
- Philosophical Agent Lattice: Specialized agents embodying distinct investment philosophies from value investing to disruptive innovation
- Multi-Agent Reasoning Architecture: LangGraph-powered reasoning loops with transparent attribution paths
- Model-Agnostic Cognition: Support for OpenAI, Anthropic, Groq, Ollama, and DeepSeek models
- Temporal Memory Shells: Agents maintain persistent state across market cycles
- Attribution-Weighted Decisions: Every trade includes fully traceable decision provenance
- Interpretability Scaffolding:
--show-traceflag reveals complete reasoning paths - Real-Time Market Integration: Connect to Alpha Vantage, Polygon.io, and Yahoo Finance
- Backtesting Framework: Test agent performance against historical market data
- Portfolio Meta-Agent: Emergent consensus mechanism with adaptive drift correction
๐ Performance Visualization
Agent Architecture
Multi-Agent Hedge Fund implements a lattice of cognitive agents, each embodying a distinct investment philosophy and decision framework:
| Agent | Philosophy | Cognitive Signature | Time Horizon |
|---|---|---|---|
| Graham | Value Investing | Undervalued Asset Detection | Long-term |
| Wood | Disruptive Innovation | Exponential Growth Projection | Long-term |
| Dalio | Macroeconomic Analysis | Economic Machine Modeling | Medium-term |
| Ackman | Activist Investing | Position Conviction & Advocacy | Medium-term |
| Simons | Statistical Arbitrage | Pattern Detection & Exploitation | Short-term |
| Taleb | Anti-fragility | Black Swan Preparation | All horizons |
| Meta | Arbitration & Consensus | Multi-Agent Integration | Adaptive |
Each agent processes market data through its unique cognitive lens, contributing signals to the portfolio meta-agent which recursively arbitrates and integrates perspectives.
Multi-Agent Cognition Flow
The system operates through nested cognitive loops that implement a recursive market interpretation framework:
- Market Signal Perception: Raw data ingestion and normalization
- Agent-Specific Processing: Philosophy-aligned interpretation
- Multi-Agent Deliberation: Signal exchange and position debate
- Multi-Agent Arbitration: Meta-agent integration and resolution
- Position Formulation: Final decision synthesis with attribution
- Temporal Reflection: Performance evaluation and belief updating
Installation
# Clone the repository
git clone https://github.com/Multi-Agent Hedge Fund/Multi-Agent Hedge Fund.git
cd Multi-Agent Hedge Fund
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e .
Quick Start
from multi_agent_debate import PortfolioManager
from multi_agent_debate.agents import GrahamAgent, WoodAgent, DalioAgent
from multi_agent_debate.market import MarketEnvironment
# Initialize market environment
market = MarketEnvironment(data_source="yahoo", tickers=["AAPL", "MSFT", "GOOGL", "AMZN"])
# Create agents with different cognitive depths
agents = [
GrahamAgent(reasoning_depth=3),
WoodAgent(reasoning_depth=4),
DalioAgent(reasoning_depth=3)
]
# Initialize portfolio manager with recursive arbitration
portfolio = PortfolioManager(
agents=agents,
initial_capital=100000,
arbitration_depth=2,
show_trace=True
)
# Run simulation
results = portfolio.run_simulation(
start_date="2020-01-01",
end_date="2023-01-01",
rebalance_frequency="weekly"
)
# Analyze results
portfolio.show_performance()
portfolio.generate_attribution_report()
portfolio.visualize_consensus_graph()
Interpretability
Multi-Agent Hedge Fund prioritizes transparent decision-making through recursive attribution tracing. Use the following flags to inspect agent cognition:
# Run with complete reasoning trace
python -m multi_agent_debate.run --show-trace
# Visualize agent consensus formation
python -m multi_agent_debate.run --consensus-graph
# Map conflicts in multi-agent deliberation
python -m multi_agent_debate.run --agent-conflict-map
# Generate attribution report for all trades
python -m multi_agent_debate.run --attribution-report
Extending the Framework
The system is designed for extensibility at multiple levels:
Creating Custom Agents
from multi_agent_debate.agents import BaseAgent
class CustomAgent(BaseAgent):
def __init__(self, reasoning_depth=3, memory_decay=0.2):
super().__init__(
name="Custom",
philosophy="My unique investment approach",
reasoning_depth=reasoning_depth,
memory_decay=memory_decay
)
def process_market_data(self, data):
# Implement custom market interpretation logic
processed_data = self.cognitive_shell.process(data)
return processed_data
def generate_signals(self, processed_data):
# Generate investment signals with attribution
signals = self.reasoning_graph.run(
input=processed_data,
trace_depth=self.reasoning_depth
)
return self.attribute_signals(signals)
Customizing the Arbitration Layer
from multi_agent_debate.cognition import ArbitrationMechanism
class CustomArbitration(ArbitrationMechanism):
def __init__(self, weighting_strategy="confidence"):
super().__init__(weighting_strategy=weighting_strategy)
def resolve_conflicts(self, signals):
# Implement custom conflict resolution logic
resolution = self.recursive_integration(signals)
return resolution
๐ License
This project is licensed under the PolyForm License - see the LICENSE file for details.
๐ Related Projects
- LangGraph - Framework for building stateful, multi-actor applications with LLMs
- Auto-GPT - Autonomous GPT-4 experiment
- LangChain - Building applications with LLMs
- Fintech-LLM - Financial language models
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for more information.
๐ Citation
If you use Multi-Agent Hedge Fund in your research, please cite:
@software{multi_agent_debate2024,
author = {{Multi-Agent Hedge Fund Contributors}},
title = {Multi-Agent Hedge Fund: Multi-agent recursive market cognition framework},
url = {https://github.com/Multi-Agent Hedge Fund/Multi-Agent Hedge Fund},
year = {2024},
}
๐ Acknowledgements
- The philosophical agents are inspired by the investment approaches of Benjamin Graham, Cathie Wood, Ray Dalio, Bill Ackman, Jim Simons, and Nassim Nicholas Taleb
- Recursive reasoning architecture influenced by work in multi-agent systems and interpretability research
- Market simulation components build upon open-source financial analysis libraries
Built with โค๏ธ by the Multi-Agent Hedge Fund team
Recursion. Interpretation. Emergence.