Institutional-grade, parallel multi-agent AI system for Indian equity research.
Features • Architecture • Authentication • Installation • API Reference • Contributing
🌐 Live Preview: https://codehub5199.github.io/Multi-Agent-Stock-Research-Analyst/
🐙 GitHub: https://github.com/CodeHub5199/Multi-Agent-Stock-Research-Analyst
StockMind is a production-ready AI research platform that mimics how an institutional equity desk works — running specialized agents in parallel, synthesizing their signals, and stress-testing the thesis through a critic layer — all delivered in seconds.
Built on LangGraph for orchestration, Groq for ultra-fast LLM inference, Tavily for real-time news, and yfinance for market data. Optimized for NSE/BSE-listed equities with INR formatting and RBI/SEBI regulatory context.
Users sign in via Supabase Auth (email/password or Google OAuth), and every analysis they run is automatically saved to their private account — accessible anytime from the collapsible report history sidebar.
| Feature | Description |
|---|---|
| ⚡ Parallel Agent Execution | Fundamentals, Technical, and News agents run concurrently via LangGraph |
| 🔀 Synthesis Agent | Triangulates multi-agent signals with weighted consensus scoring |
| 🎯 Critic Agent | Stress-tests the bull thesis, surfaces bear cases, data gaps, and risks |
| 📊 Institutional Outputs | Signal scores, anomaly detection, S/R levels, high-impact events |
| 🖥️ Live Dashboard | Responsive single-page UI with animated charts and verdict banners |
| 🚀 FastAPI Backend | Async-first, production-ready REST API with OpenAPI docs |
| 🇮🇳 India Market Optimized | NSE/BSE focus, INR formatting, RBI/SEBI regulatory awareness |
| 🔍 Smart Autocomplete | Search from the full NSE stock universe as you type |
| 🔐 User Authentication | Secure sign-in via email/password or Google OAuth powered by Supabase |
| 📂 Report History | Every analysis auto-saved per user — revisit past reports from the sidebar |
| 🏠 Hero Landing Page | Engaging public-facing landing page with feature highlights and auth modal |
┌──────────────────────────────────┐
│ FastAPI Backend │
│ GET / → index.html │
│ GET /dashboard → dashboard │
│ POST /analyze → LangGraph │
│ GET /reports → Supabase DB │
└────────────────┬─────────────────┘
│
┌────────────────────▼──────────────────┐
│ LangGraph State Machine │
│ │ │
┌─────────▼──────┐ ┌──────────▼───────┐ ┌───────▼─────────┐
│ Fundamentals │ │ Technical │ │ News │
│ Agent │ │ Agent │ │ Agent │
│ (yfinance + │ │ (yfinance + │ │ (Tavily + │
│ LLM) │ │ LLM) │ │ LLM) │
└─────────┬──────┘ └──────────┬───────┘ └────────┬────────┘
└────────────────────▼───────────────────┘
│
┌──────────▼───────────┐
│ Synthesis Agent │
│ Bull/Bear Signals │
│ Consensus Scoring │
└──────────┬───────────┘
│
┌──────────▼───────────┐
│ Critic Agent │
│ Risk Assessment │
│ Confidence Audit │
└──────────┬───────────┘
│
┌────────────────────▼─────────────────────┐
│ Supabase │
│ Auto-save report payload per user │
│ Row Level Security — private per user │
└──────────────────────────────────────────┘
- Fundamentals Agent — P/E, P/B, revenue growth, margins, debt ratios, promoter holding via yfinance
- Technical Agent — RSI, MACD, moving averages, support/resistance, volume analysis
- News Agent — Real-time news via Tavily, sentiment scoring, event impact classification
- Synthesis Agent — Weighted signal aggregation, bull/bear case extraction, overall verdict
- Critic Agent — Assumption stress-testing, bear case deepening, gap identification, confidence scoring
| Layer | Technology |
|---|---|
| Orchestration | LangGraph (stateful multi-agent DAG) |
| Backend | FastAPI + Uvicorn |
| LLM Inference | Groq (Llama-3 / Mixtral) |
| Market Data | yfinance |
| News & Search | Tavily API |
| Auth & Database | Supabase (Auth + PostgreSQL + Row Level Security) |
| Validation | Pydantic v2 |
| Frontend | Vanilla HTML/CSS/JS (zero dependencies) |
StockMind uses Supabase Auth for secure, production-grade authentication. Two sign-in methods are supported out of the box.
User visits / → Hero landing page (public)
Clicks "Get started" → Auth modal opens (Login / Sign up)
Signs in → Supabase issues JWT access token
Token sent with /analyze → FastAPI verifies token server-side
Report auto-saved → Stored in Supabase, tied to user ID
User revisits /dashboard → Past reports load in the left sidebar
| Method | Notes |
|---|---|
| Email / Password | Standard signup with email confirmation |
| Google OAuth | One-click sign-in via Google account |
- JWT tokens verified server-side on every
/analyzecall viaapi/auth.py - Reports table protected by Row Level Security (RLS) — users can only access their own rows
- Supabase
service_rolekey stays strictly in.env— never sent to the browser - Supabase
anonkey used in HTML — safe for frontend, RLS enforces data isolation
| File | Purpose |
|---|---|
api/auth.py |
FastAPI Depends(get_current_user) — verifies Supabase JWT |
api/supabase_client.py |
Cached Supabase admin client (server-side only) |
api/models_auth.py |
Pydantic models for report list/detail endpoints |
templates/index.html |
Public hero/landing page with auth modal |
Every analysis run by an authenticated user is automatically persisted to Supabase after the pipeline completes. No manual saving required.
| Field | Description |
|---|---|
ticker |
Stock symbol (e.g. SBIN, ITC) |
company_name |
Resolved company name from fundamentals agent |
verdict |
Final critic-adjusted verdict (BUY / HOLD / SELL) |
elapsed_seconds |
Total pipeline runtime in seconds |
payload |
Complete JSON output of all 5 agents |
created_at |
UTC timestamp of the analysis |
- A collapsible left sidebar lists the 20 most recent reports for the logged-in user
- Click any report row to instantly reload the full analysis — no re-running the pipeline
- Reports are sorted newest-first, showing ticker, company name, verdict chip, and date
- The sidebar collapses via a toggle button (
◀ / ▶) to maximise dashboard workspace
- Python 3.10+
- Groq API key — free tier available
- Tavily API key — for the news agent
- Supabase project — free tier, Auth + PostgreSQL
- Google Cloud OAuth credentials — for Google sign-in (optional)
git clone https://github.com/CodeHub5199/Multi-Agent-Stock-Research-Analyst.git
cd Multi-Agent-Stock-Research-Analystpython -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the project root:
# LLM & Search
GROQ_API_KEY=gsk_...
TAVILY_API_KEY=tvly-...
GROQ_MODEL=openai/gpt-oss-120b # or llama3-70b-8192, mixtral-8x7b-32768
# Supabase — server-side only, never expose to frontend
SUPABASE_URL=https://xxxxxxxxxxxx.supabase.co
SUPABASE_SERVICE_KEY=eyJ...Model tip:
llama3-70b-8192works well on the free tier.openai/gpt-oss-120bgives the best output quality.
In both templates/index.html and templates/dashboard.html, replace the two placeholder values near the bottom of the <script> block:
const SUPABASE_URL = 'https://xxxxxxxxxxxx.supabase.co'; // Project URL
const SUPABASE_ANON = 'eyJ...'; // anon / public keyRun this SQL once in your Supabase → SQL Editor:
CREATE TABLE reports (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
ticker TEXT NOT NULL,
company_name TEXT,
verdict TEXT,
elapsed_seconds FLOAT,
payload JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT now()
);
-- Indexes for fast lookups
CREATE INDEX reports_user_id_idx ON reports(user_id);
CREATE INDEX reports_created_at_idx ON reports(created_at DESC);
-- Row Level Security
ALTER TABLE reports ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users see own reports"
ON reports FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "Users insert own reports"
ON reports FOR INSERT WITH CHECK (auth.uid() = user_id);
CREATE POLICY "Users delete own reports"
ON reports FOR DELETE USING (auth.uid() = user_id);- Create OAuth credentials in Google Cloud Console → APIs & Services → Credentials → OAuth 2.0 Client ID
- Add the Supabase callback URL as an authorised redirect URI:
https://xxxxxxxxxxxx.supabase.co/auth/v1/callback - In Supabase → Authentication → Providers → Google, paste your Client ID and Client Secret
uvicorn main:app --reload --port 8000| URL | Description |
|---|---|
http://localhost:8000/ |
Hero landing page (public) |
http://localhost:8000/dashboard |
Research dashboard (requires login) |
http://localhost:8000/docs |
Swagger UI — interactive API docs |
http://localhost:8000/redoc |
ReDoc API reference |
Run the full multi-agent pipeline. If a valid Bearer token is present the report is auto-saved to the database.
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <supabase_access_token>" \
-d '{"ticker": "SBIN"}'Response:
{
"ticker": "SBIN",
"elapsed_seconds": 34.2,
"fundamentals_output": { ... },
"technical_output": { ... },
"news_output": { ... },
"synthesis_output": { ... },
"critic_output": { ... }
}Returns the authenticated user's saved reports, most recent first.
curl http://localhost:8000/reports \
-H "Authorization: Bearer <supabase_access_token>"Returns the full payload of a specific saved report.
curl http://localhost:8000/reports/abc-123 \
-H "Authorization: Bearer <supabase_access_token>"Deletes a report. Ownership enforced — users can only delete their own reports.
Returns all NSE-listed tickers for autocomplete. No authentication required.
curl http://localhost:8000/stocks
# ["SBIN", "HDFCBANK", "RELIANCE", ...]Liveness probe for uptime monitoring.
curl http://localhost:8000/health
# {"status": "ok", "version": "1.0.0"}| Sector | Tickers |
|---|---|
| Banking | SBIN, HDFCBANK, ICICIBANK, KOTAKBANK |
| IT | INFY, TCS, WIPRO, HCLTECH |
| Auto | TATAMOTORS, MARUTI, BAJAJ-AUTO |
| Energy | RELIANCE, ONGC, POWERGRID |
| FMCG | HINDUNILVR, ITC, NESTLEIND |
| US Stocks | AAPL, MSFT, GOOGL |
multi-agent-stock-research/
├── agents/ # Core research agents (Pydantic outputs)
│ ├── fundamentals_research.py
│ ├── technical_research.py
│ ├── news_research.py
│ ├── synthesis_research.py
│ └── critic_research.py
├── api/ # FastAPI layer
│ ├── auth.py # JWT verification — Depends(get_current_user)
│ ├── supabase_client.py # Supabase admin client (server-side only)
│ ├── models.py # Core request/response Pydantic models
│ ├── config.py # Settings loaded from .env
│ └── pipeline.py # LangGraph pipeline runner
├── graph/
│ └── research_graph.py # LangGraph state machine definition
├── templates/
│ ├── index.html # Hero landing page + auth modal (public)
│ └── dashboard.html # Research dashboard (auth-gated)
├── static/ # Static assets
├── main.py # FastAPI entrypoint + all route definitions
├── requirements.txt
├── .env # Secret keys — never commit to git
└── README.md
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch —
git checkout -b feature/your-feature - Commit your changes —
git commit -m 'Add some feature' - Push to the branch —
git push origin feature/your-feature - Open a Pull Request
This tool is for research and educational purposes only. It is not financial advice. Always conduct your own due diligence and consult a SEBI-registered investment advisor before making any investment decisions. Past analysis does not guarantee future performance.
Built with ❤️ for the Indian retail investor
⭐ Star this repo if you find it useful!