DEV Community

defidaddydavid
defidaddydavid

Posted on

I Built a 12-Agent AI Swarm That Debates Crypto Predictions (Open Source)

What if instead of asking one AI for a prediction, you made 12 AI agents with different personalities argue about it?

That's what I built. PolySwarm is an open-source multi-agent forecasting engine where AI agents with distinct market personas — macro analyst, quant trader, contrarian skeptic, options flow reader, etc. — independently estimate probabilities, then debate across multiple rounds and update their beliefs.

Why This Exists

Single-model predictions are noisy. Research from IARPA and Philip Tetlock's superforecasting work shows that aggregating diverse, independent forecasters consistently beats individual experts. PolySwarm applies that principle to AI agents.

How It Works

python main.py forecast "Will BTC hit $150k before 2027?" --odds 0.25

  1. 23 live data sources are fetched in parallel — Binance spot/futures, Deribit options chain, DeFi Llama TVL, Fear & Greed Index, Polymarket odds, funding rates, liquidation data, Reddit sentiment, and more.

  2. 12 agents each receive the data and independently produce a probability estimate with reasoning.

  3. Debate rounds — agents see each other's estimates and reasoning, then update (or defend) their positions. Genuine belief updating, not just averaging.

  4. 10 aggregation methods combine the final estimates:

    • Weighted arithmetic mean
    • Trimmed mean (outlier-resistant)
    • Bayesian updating
    • Extremized aggregation (IARPA/Tetlock method)
    • Surprisingly Popular algorithm (Prelec, Nature 2017)
    • Logarithmic opinion pool
    • Cooke's Classical Model
    • Meta-probability weighting
    • Neutral pivoting
    • Coherence-weighted synthesis
  5. Game theory diagnostics check for herding, information cascades, and Nash equilibrium.

Two Modes

Forecast Mode — binary probability estimation:

python main.py forecast "Will ETH flip BTC market cap by 2028?"

Scenario Mode — simulate how a crowd of crypto investors would react to a hypothetical event:

python main.py scenario "SEC bans crypto staking in the US"

This returns crowd sentiment, predicted market moves, and second-order effects.

The Stack

  • Python with async data fetching
  • Any LLM — Claude, GPT-4o, Llama via Ollama (free/local), or any OpenAI-compatible API (Groq, Together, etc.)
  • Rich terminal UI with branded theme
  • FastAPI REST API with optional auth
  • SQLite for calibration tracking (Brier scores per agent)
  • Redis caching for data sources
  • Docker ready — docker compose up
  • Plugin system — add a data source by dropping a single Python file, zero config

What Makes It Different From "Just Prompting GPT"

Single LLM Call PolySwarm
Perspectives 1 12 distinct personas
Data Whatever's in training 23 real-time sources
Aggregation None 10 peer-reviewed methods
Calibration None Brier score tracking
Bias detection None Herding, cascade, Nash checks
Debate None Multi-round belief updating

Quick Start

git clone https://github.com/defidaddydavid/polyswarm.git
cd polyswarm
pip install -r requirements.txt
cp .env.example .env
# Add your API key (Anthropic, OpenAI, or use Ollama for free)
python main.py forecast "Will Bitcoin hit $200k by end of 2027?"

Works with Ollama for completely free, local inference — no API key needed.
Enter fullscreen mode Exit fullscreen mode

Links
GitHub: github.com/defidaddydavid/polyswarm
Live Site & Docs: defidaddydavid.github.io/polyswarm
Part of: PlimaFlow (plimaflow.com)
MIT Licensed. Feedback, issues, and PRs welcome.

If you're interested in prediction markets, superforecasting, or multi-agent AI systems, I'd love to hear what questions you'd throw at it.

Top comments (0)