AI Agents

Multi-agent system running 24/7 — click any agent to see its architecture, data sources, and source code.

⚙️ System Overview

Agents run in isolated environments on the same host, sharing a Redis message bus. Each agent publishes structured logs to a central store. The scheduler (cron) triggers agents on fixed intervals — Market Agent every 5 min, Report Agent weekly on Fridays. All agents share access to the Docker-mounted pages directory for output persistence.

📈

Market Analysis Agent

Fetches live prices, computes MAVI scores, updates JSON store every 5 min

Architecture

Yahoo Finance API Market Agent Python + yfinance current.json MAVI Calculator stock-updater.py Cron (every 5 min) Docker-mounted pages/ directory (live updates)

Data Sources

Yahoo Finance API yfinance (Python lib) MAVI Calculator current.json Nginx (live)

Tickers tracked: TSLA, SPCX, FLY, RKLB, IONQ, RGTI, QBTS, QUBT

Data points per ticker: Price, change %, 52W range, volume, trailing P/E, float shares, outstanding shares

MAVI formula: earnings_yield × float_ratio × log₁₀(float_shares × price)

🤖

Signal Aggregation Agent

Cross-references fundamental, price, and volume data into weighted consensus signals

Architecture

Fundamental ▶ Price Action ▶ Volume Spike ▶ Aggregator Weighted Consensus MAVI + Vol + Trend Signal (BUY/SELL) Confidence Score Alert Dispatch

Data Sources

MAVI Scores + Price Trends + Volume Data Consensus Engine Signal Output

Scoring methodology: Each sub-agent contributes a normalized score (0–10). The aggregator applies weights: MAVI=0.4, Price Trend=0.35, Volume=0.25. A weighted score ≥ 6.5 triggers a BUY signal, ≤ 3.5 triggers SELL.

📊

Report Generation Agent

Auto-generates weekly stock reports + archive index every Friday

Architecture

Friday Trigger (weekday == 4) Report Agent HTML Generator YYYY-MM-DD.html (weekly report) Builds 52-week performance chart stocks.html update

Data Sources

current.json HTML Template history.json + 52-Week Chart

Output files: /stocks/data/current.json (latest snapshot) + /stocks/data/history.json (52-week history) + /stocks.html (main page update)

Execution Agent

Dispatches alerts and triggers automated responses when signal thresholds are met

Architecture

Signal Input Execution Agent Threshold Check 🔔 Alert 📝 Log Entry 📧 Notification

Data Sources

Consensus Signal Threshold Comparator Alert Channel

Thresholds: Consensus ≥ 7.5 → STRONG BUY alert · Consensus ≤ 2.0 → STRONG SELL alert · Others logged as info

💾

Backup Agent

Snapshot of both websites + nginx configs — daily at 6am SGT, keeps last 30

Architecture

Cron 6am SGT daily trigger Backup Agent backup-websites.sh Backup Storage timestamped snapshot Keep last 30 auto-cleanup Source: elrefai.org site files Source: mavi-index.com site files nginx configs also saved → infra/ in workspace (version controlled)

Data Sources

elrefai.org pages + mavi-index.com files + nginx configs Timestamped Snapshot Retention (30)

Retention policy: 30 most recent backups kept; older snapshots auto-deleted each run. Manual backups available anytime via backup-sites.

🛟

Recovery Agent

Restores sites from backup snapshots or redeploys from workspace source of truth

Architecture

restore-site timestamp arg Recovery Agent restore-from-backup.sh Restore to Docker bind-mount targets Path A: copy from backup snapshot restore-site YYYY-MM-DD_HH-MM-SS Path B: redeploy from workspace deploy-sites (source of truth) Files live immediately — restart containers only if nginx config changed

Data Sources

Backup Storage or Workspace (source of truth) elrefai.org files + mavi-index.com files

Recovery playbook: If a site breaks — check docker ps -a for exit code 127 (nginx config mounted as directory). Fix: remove empty dir, restore config file, docker start. If files are missing: deploy-sites from workspace. If you need an older version: restore-site <timestamp>.