One Engineer.
Six AI Agents.
90 Seconds.

AlphaLens compresses 8+ hours of professional equity research into 90 seconds. A LangGraph state machine replaces an entire research team — from junior analyst to publishing editor — at zero cost.

6
AI Agents
90s
Per Analysis
$0
API Cost
70
Tests Passing
4
Data Sources
See It In Action

Full 10-minute walkthrough — live pipeline run on AAPL, technical architecture deep-dive, prompt engineering strategies, and evaluation results.

10-minute demo · Live pipeline run · Technical architecture · Evaluation results · Open in Loom ↗
What Makes AlphaLens Different

Not a chatbot. Not a dashboard. A full AI research pipeline grounded in primary source documents.

📄
RAG over Real SEC Filings
Downloads actual 10-K/10-Q filings from EDGAR, parses sections, embeds with Gemini (3072-dim), and retrieves relevant passages via ChromaDB. Every narrative claim is cited to a specific section and page.
🔍
Verification Agent
Cross-references management's narrative claims against actual financial data. Flags divergences with evidence — e.g., when revenue guidance language doesn't match the numbers. No other free tool does this.
Parallel Execution
RAG Citation and Quant Analysis run simultaneously via LangGraph fan-out. A synchronization barrier waits for both before Verification begins. This is what keeps the total under 90 seconds.
🛡️
Structured Prompt Engineering
Each agent uses a purpose-built prompt strategy: structured JSON output, iterative section prompting, grounded evidence prompting, or two-stage LLM classification. Multi-layer JSON recovery handles truncated outputs.
📊
Quant Models + Live Charts
3-stage DCF (bear/base/bull), RSI(14), MACD(12/26/9), earnings surprise vs consensus — all computed from real market data and rendered as interactive Plotly charts with a custom dark theme.
💬
Grounded Follow-up Chat
Ask questions after the report is generated. Every answer is grounded in the pipeline's outputs — financial metrics, report sections, RAG chunks, and verification divergences — not the model's training data.
Six Agents. One Research Team.

Each agent has a narrow, well-defined role — exactly how a real equity research desk operates.

Agent 01
Data Fusion
Replaces: Junior Analyst
Fires concurrent API calls to SEC EDGAR, Alpha Vantage, yfinance, and FRED. Normalizes 25+ financial fields into a unified dict. Falls back gracefully — never crashes, always returns a sources_status dict.
Agent 02
RAG Citation
Replaces: Research Associate
Downloads 10-K HTML, parses named sections (MD&A, Risk Factors, Financial Statements), chunks at 500 tokens with 100-token overlap via tiktoken, embeds with Gemini, stores in ChromaDB, retrieves top-k per query dimension.
Agent 03
Quant Analysis
Replaces: Quantitative Analyst
3-stage DCF model (always reported at MEDIUM confidence to communicate model uncertainty), RSI(14), MACD(12/26/9) computed on 6 months of daily data, earnings surprise vs consensus EPS.
Agent 04
Risk Scanner
Replaces: Risk & Compliance Officer
Two-stage: fast keyword/regex pattern match across 9 risk categories (going concern, material weakness, customer concentration, etc.), then Gemini LLM severity classification. Cites specific filing passages.
Agent 05 · Crown Jewel
Verification
Replaces: Senior Analyst
Cross-references quantitative claims vs management narrative. Flags divergences with evidence. Assigns per-section confidence scores (HIGH/MEDIUM/LOW) that drive the overall report rating. Forces DCF to MEDIUM.
Agent 06
Report Synthesis
Replaces: Publishing Editor
Generates 5 report sections iteratively — one Gemini call per section — with inline citations and confidence badges. Overall confidence = min(section scores) adjusted by divergence count.
LangGraph State Machine

Parallel fan-out after Data Fusion. Synchronization barrier before Verification. One shared TypedDict flows through every node.

START
Data Fusion
parallel
RAG Citation → Risk Scanner
Quant Analysis
Verify
fan-in
Report Synthesis
END
add_edge([risk_scanner, quant_analysis], verify) — list syntax creates the barrier. Annotated[dict, _merge_metadata] prevents parallel write conflicts on shared state.
Orchestration
LangGraph StateGraph · AlphaLensState TypedDict · Annotated reducers for parallel-safe state merging
RAG Pipeline
tiktoken chunking · gemini-embedding-001 (3072-dim) · ChromaDB cosine similarity · multi-query retrieval
Prompt Engineering
Structured JSON output · iterative section prompting · grounded evidence · multi-stage JSON recovery
Reliability
Token bucket rate limiters · 24h TTL cache · @agent_error_boundary · graceful fallback chain
100% Free Tier. Zero Infrastructure Cost.

Every component runs locally or on free-tier APIs. No paid infrastructure required.

Orchestration & AI
LangGraph 0.2+
Gemini 2.5 Flash
gemini-embedding-001
LangChain
Free Data Sources
SEC EDGAR
Alpha Vantage
FRED API (Federal Reserve)
yfinance
Storage & Frontend
ChromaDB (local)
Streamlit
Plotly
Python 3.11+
Five Metrics. Golden Test Set.

Tested against AAPL, NVDA, and MSFT FY2024 public filings. Run python -m src.eval.runner locally to reproduce.

≥0.60
Precision@5
Fraction of top-5 retrieved chunks containing relevant keywords
≥0.80
Recall@5
Fraction of required sections (MD&A, Risk Factors) covered
≥0.90
Faithfulness
Monetary claims in report grounded in retrieved filing chunks
±15%
Numerical Accuracy
Revenue, EPS, margins within tolerance vs ground truth
1.00
Earnings Direction
Beat / miss direction always correct (binary check)
Everything You Need

Full technical documentation, architecture details, evaluation results, and setup instructions.

Run Locally in 3 Steps

Requires Python 3.11+ and three free API keys. No paid services needed.

# 1. Clone and install dependencies git clone https://github.com/RishiSehgal/AlphaLens.git cd AlphaLens pip install -r requirements.txt # 2. Add your free API keys to .env (copy from .env.example) GOOGLE_API_KEY=your_key_from_aistudio.google.com ALPHA_VANTAGE_API_KEY=your_key_from_alphavantage.co FRED_API_KEY=your_key_from_fred.stlouisfed.org # 3. Launch streamlit run app.py
Get Google API Key ↗ Get Alpha Vantage Key ↗ Get FRED Key ↗
Not Financial Advice. AlphaLens is an educational AI research tool built for a Generative AI capstone project. All analysis is AI-generated from public data sources and may contain errors or omissions. Do not make investment decisions based solely on this output.