
Author: Manuela Schrittwieser
Co-Developer & Technical Co-Author: Gemini (Google DeepMind)
Repository: github.com/MANU-de/Cryptosentinator
Live Demo: Hugging Face Spaces: Cryptosentinator-v3
Traditional cryptocurrency sentiment analysis pipelines predominantly rely on isolated natural language processing (NLP) of retail social media feeds. In volatile digital asset markets, these approaches exhibit severe blind spots: they routinely mistake retail FOMO for sustained institutional momentum, overlook leverage imbalances in derivatives markets, and fail to ground strategic hypotheses against verifiable on-chain capital movements.
This paper introduces CryptoSentinator v3, a significant evolution from the foundational multi-agent architecture published in v2. The updated system shifts from synthetic, isolated sentiment scoring to a multi-modal, stateful intelligence pipeline powered by LangGraph, Google Gemini, and Hugging Face serverless open-weight models. Key architectural contributions include:
Qwen/Qwen2.5-72B-Instruct), and real-time generator streaming in a Gradio 5+ visual analytics interface.In our previous release (v2), CryptoSentinator established a modular 4-agent LangGraph workflow composed of a Scout, Analyst, Strategist, and Evaluator. While v2 validated the multi-agent design pattern for autonomous financial intelligence, practical deployments revealed three fundamental limitations:
CryptoSentinator v3 was engineered to address these challenges directly.
The engine operates on a strictly typed, immutable acyclic state graph managed by LangGraph. State transitions are governed by an enriched schema defined in graph_state.py:
┌──────────────────────────────────────────────┐
│ Input Query │
│ (e.g., Target: "BTC") │
└──────────────────────┬───────────────────────┘
│
▼
┌──────────────────────────────────────────────┐
│ 1. SCOUT AGENT │
│ - Binance Perpetual Funding Rates (8h) │
│ - DefiLlama On-Chain TVL Delta │
│ - Social & News Feeds │
│ - Local Disk Cache Layer (TTL: 300s) │
└──────────────────────┬───────────────────────┘
│ RawDocument[]
▼
┌──────────────────────────────────────────────┐
│ 2. INTELLIGENCE ANALYST AGENT │
│ - Crypto Narrative Taxonomy Classification │
│ - Source-Aware Dynamic Sentiment Scoring │
│ - Retail vs. Leverage Polarization │
└──────────────────────┬───────────────────────┘
│ ProcessedDocument[]
▼
┌──────────────────────────────────────────────┐
│ 3. STRATEGIST AGENT │
│ - Multi-Timeframe Decoupling │
│ [24h Tactical] vs [7d Strategic] │
│ - Quantitative Invalidation Criteria │
│ - Model Router (Gemini 2.0 Flash / Qwen 72B)│
└──────────────────────┬───────────────────────┘
│ StrategicSummary[]
▼
┌──────────────────────────────────────────────┐
│ 4. EVALUATOR AGENT │
│ - Dual Benchmarking (Simulated + Live 24h) │
│ - Timeframe-Aware Directional Matcher │
│ - Persistent Logging (backtest_history.jsonl)│
│ - Rolling Win-Rate & Calibration Engine │
└──────────────────────┬───────────────────────┘
│
▼
┌──────────────────────────────────────────────┐
│ Gradio 5+ Streaming Interface │
│ - Plotly Dynamic Narrative Heatmap │
│ - Markdown Intelligence Briefing Export │
└──────────────────────────────────────────────┘
The state container enforces strict type safety across agent boundaries using Python TypedDict primitives:
class RawDocument(TypedDict): source: str content: str timestamp: str keyword: str class ProcessedDocument(RawDocument): sentiment_score: Optional[float] sentiment_label: Optional[str] topic: Optional[str] entities: Optional[List[str]] class StrategicSummary(TypedDict): cryptocurrency: str hypothesis: str confidence: str reasoning: str supporting_evidence: List[str] class PerformanceEvaluation(TypedDict): cryptocurrency: str hypothesis_tested: str simulated_outcome: str evaluation_result: str evaluation_notes: str class GraphState(TypedDict): keywords: List[str] raw_documents: List[RawDocument] processed_documents: List[ProcessedDocument] strategic_summaries: List[StrategicSummary] evaluation: Optional[PerformanceEvaluation]
Rather than relying purely on text search APIs, the updated Scout Agent queries live financial infrastructure without imposing mandatory paid third-party subscriptions:
/fapi/v1/fundingRate), the Scout measures the periodic fee paid between long and short contract holders. A funding rate /v2/historicalChainTvl/) to compute 24-hour percentage variations in smart contract capital allocation (@disk_cache(ttl_seconds=300)). If an upstream API returns an HTTP 429 rate-limiting status code, the Scout falls back to stale cache entries, protecting the host system from runtime failures.A central contribution of v3 is the move away from uniform sentiment scoring. The Analyst Agent implements a structured narrative taxonomy:
The agent evaluates sentiment contextually based on data provenance:
Each ingested document is transformed into a ProcessedDocument with an explicit narrative category tag and normalized sentiment score.
The Strategist Agent synthesizes processed evidence into actionable intelligence using advanced foundation models. Rather than predicting a generic trajectory, the agent prompt enforces a rigorous, falsifiable hypothesis structure:
{ "cryptocurrency": "BTC", "hypothesis": "[24h Tactical]: Expect range-bound consolidation with high volatility as retail sentiment remains fractured. [7d Strategic]: Bullish bias supported by resilient on-chain TVL growth suggesting institutional capital accumulation despite short-term social noise. [Invalidation Trigger]: A decisive breakdown below the $80,000 support level combined with a spike in perpetual swap funding rates to negative territory.", "confidence": "Medium", "reasoning": "Market sentiment is currently bifurcated...", "supporting_evidence": [...] }
The inclusion of an explicit Invalidation Trigger converts LLM narrative outputs into testable strategies. If spot price action breaches support or leverage indicators flip sign, downstream algorithmic systems or human operators can reject the strategic thesis before significant capital degradation occurs.
The updated Evaluator Agent implements an empirical feedback loop:
[24h Tactical] clause using regular expressions to evaluate immediate market movement rather than misinterpreting longer-term strategic optimism as an immediate forecasting error.backtest_history.jsonl, storing the timestamp, target asset, full hypothesis string, simulated stress outcome, actual Binance 24h market delta, result category (Correct, Partially Correct, Incorrect), and scalar accuracy score.To guarantee accessibility across both commercial cloud endpoints and the open-source community, CryptoSentinator v3 replaces hardcoded API calls with a dynamic routing abstraction layer (tools/llm_client.py):
┌────────────────────────────┐
│ Input Strategy Prompt │
└─────────────┬──────────────┘
│
▼
┌────────────────────────────┐
│ Check GEMINI_API_KEY? │
└──────┬──────────────┬──────┘
│ Yes │ No / Error (429)
▼ │
┌──────────────────────┐ │
│ Google Gemini API │ │
│ (gemini-2.0-flash) │ │
└──────────┬───────────┘ │
│ │
▼ Fail ▼
┌────────────────────────────────────────┐
│ Hugging Face Serverless Inference API │
│ Model: Qwen/Qwen2.5-72B-Instruct │
│ Token: Injected HF_TOKEN (Zero-Cost) │
└──────────────────┬─────────────────────┘
│
▼
┌────────────────────────────┐
│ Validated Output JSON │
└────────────────────────────┘
gemini-2.0-flash-lite-preview for high-throughput, low-latency synthesis.GEMINI_API_KEY is absent, or if quota limits are exceeded, the router automatically dispatches the prompt via huggingface_hub.InferenceClient to Qwen/Qwen2.5-72B-Instruct or meta-llama/Llama-3.3-70B-Instruct. This allows the Hugging Face Space to operate out-of-the-box without requiring visitors to provide personal API credentials.The Gradio 5+ visual interface was rebuilt to prioritize execution transparency and data density:
yield) pipeline enables the UI to provide real-time status notifications as each agent begins and completes its task, displaying intermediate states instead of freezing during execution.gr.DownloadButton dynamically packages the multi-agent findings, narrative distributions, supporting microstructure citations, and cumulative backtest stats into an executive Markdown briefing (.md).| Technical Metric / Feature | CryptoSentinator v2 | CryptoSentinator v3 |
|---|---|---|
| Market Data Sources | Static Mocks | Live Binance Futures Funding Rates + Spot 24h Data |
| On-Chain Tracking | None | Real-Time DefiLlama Protocol / Chain TVL Delta |
| Semantic Extraction | Single Generic Sentiment Score | Domain Narrative Clustering across 5 Taxonomies |
| Strategy Formulation | Broad Directional Statement | Decoupled 24h Tactical vs. 7d Strategic Horizons |
| Risk Boundary | None | Explicit Quantitative Invalidation Trigger |
| LLM Dependency | Hardcoded Commercial API | Hybrid Router (Gemini 2.0 Flash + HF Qwen 2.5 72B) |
| Backtesting Engine | Transient, Ephemeral Simulation | Persistent Log (.jsonl), Rolling Win-Rate Tracking |
| Caching Layer | None | Disk Cache with Stale Fallback (TTL: 300s) |
| User Interface | Static Markdown Block | Streaming Steps, Interactive Plotly Visualizer, MD Export |
The codebase is structured as a standard, self-contained Python package designed for containerized or virtual environment execution:
# Clone the v3.0.0 release git clone -b v3.0.0 https://github.com/MANU-de/Cryptosentinator.git cd Cryptosentinator # Initialize isolated environment python3 -m venv .venv source .venv/bin/activate # Install dependencies (strictly pinning Pydantic for schema stability) pip install -r requirements.txt # Run CLI verification suite python main.py # Launch interactive visual analytics terminal python app.py
CryptoSentinator v3 demonstrates that autonomous financial agents become substantially more reliable when conversational LLMs are bound to verifiable market microstructure data, explicit temporal scopes, and continuous, persistent backtesting. By transitioning from isolated social sentiment to a unified multi-modal state graph, the system bridges the gap between natural language processing and quantitative digital asset research.
Future iterations will explore the integration of high-frequency order book imbalance metrics (via WebSocket L2 feeds), automated Bayesian prompt optimization driven by evaluator backtest regressions, and on-chain trade execution hooks via decentralized smart contract routers.