Skip to content

manan-tech/DeepResearch

Repository files navigation

Deep Finance - AI-Powered Investment Research Platform

A multi-agent AI system that generates institutional-grade investment memos using LangGraph, AutoGen, and advanced LLMs.

Deep Finance simulates a virtual buy-side analyst team that researches investment opportunities, debates findings through consensus mechanisms, and produces comprehensive reports with quantitative risk analysis, network modeling, and AI-generated cover art.


🎯 Description

AI-powered investment research platform using multi-agent LLMs (LangGraph + AutoGen) to generate institutional-grade memos with risk scoring, network analysis & consensus voting.


✨ Features

Multi-Agent Research Pipeline

  • Investment Committee Planner: Breaks down research topics into MECE (Mutually Exclusive, Collectively Exhaustive) sections
  • 4-Model Gladiator Arena: Parallel drafting using Llama 3.3 70B, Qwen 3 32B, GPT-OSS 120B, and Kimi K2
  • Consensus Voting System: AI judge evaluates competing drafts and selects the best version
  • Real-time WebSocket Updates: Live progress tracking with status updates for each research phase

Advanced Analysis Modules

  • Graph Neural Network (GNN) Risk Analyzer: Simulates network dependencies and contagion risks
  • Quantitative Risk Scoring: XGBoost-style risk model with 0-100 scoring
  • Valuation Specialist: Stress-tests market-implied assumptions against historical data
  • Portfolio Manager Review: Binary capital allocation decisions with conviction ratings

Professional Output

  • Institutional-Grade Reports: Structured memos with executive summaries, scenario analysis, and monitoring checklists
  • LaTeX Math Rendering: Proper mathematical notation using KaTeX
  • AI-Generated Cover Art: Google Gemini 2.5 Flash creates symbolic investment thesis visualizations
  • PDF Export: One-click download of formatted research reports
  • Interactive Network Graphs: Vis.js visualization of supply chain and dependency risks

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Frontend (Flask)                        β”‚
β”‚  Dashboard UI β€’ WebSocket Client β€’ Real-time Visualization   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ HTTP/WebSocket
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Backend (FastAPI)                         β”‚
β”‚  WebSocket Manager β€’ Research Orchestration β€’ API Endpoints  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  LangGraph Workflow                          β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ Planner  │───▢│ Worker Graph │───▢│ Compiler β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚                   (Parallel Tasks)          β”‚               β”‚
β”‚                                             β–Ό               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚   GNN    │───▢│   Risk   │───▢│  Valuation   β”‚          β”‚
β”‚  β”‚ Analyzer β”‚    β”‚  Scorer  β”‚    β”‚  Specialist  β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚                                             β”‚               β”‚
β”‚                                             β–Ό               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ Designer │───▢│ Reviewer │───▢│   Curator    β”‚          β”‚
β”‚  β”‚ (Gemini) β”‚    β”‚   (PM)   β”‚    β”‚  (GLM-4.7)   β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Worker Subgraph (Per Research Section)

Research β†’ Draft (4 Models) β†’ Consensus Vote β†’ Section Complete

πŸš€ Getting Started

Prerequisites

  • Python 3.9+
  • API Keys:
    • Groq API (for Llama, Qwen, GPT-OSS models)
    • Cerebras API (for GPT-OSS 120B and GLM-4.7)
    • Google AI Studio (for Gemini image generation)

Installation

  1. Clone the repository
git clone https://github.com/manan-tech/DeepResearch/
cd deep-finance
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
pip install -r backend/requirements.txt
pip install -r frontend/requirements.txt
  1. Configure environment variables

Create backend/.env:

GROQ_API_KEY=your_groq_api_key_here
CEREBRAS_API_KEY=your_cerebras_api_key_here
GOOGLE_API_KEY=your_google_ai_studio_key_here

Running the Application

Option 1: Using the start script

chmod +x start.sh
./start.sh

Option 2: Manual startup

# Terminal 1 - Backend
uvicorn backend.main:app --reload --port 8000

# Terminal 2 - Frontend
python frontend/app.py

Access the application:


πŸ“– Usage

  1. Enter Research Topic

    • Single stock: "AAPL", "Long Thesis on NVDA"
    • Sector analysis: "Semiconductors", "AI Infrastructure"
    • Macro themes: "Inflation Impact on Tech", "Fed Rate Cuts"
  2. Optional Sources

    • Add comma-separated URLs for specific documents to include
  3. Monitor Progress

    • Research Plan: View breakdown of research sections
    • Consensus Engine: Watch live model debates and voting
    • Live Report: See the report build in real-time
  4. Explore Results

    • Click draft cards to view full model outputs
    • Open network graph to visualize dependencies
    • Download PDF or copy markdown

πŸ› οΈ Technology Stack

Backend

  • FastAPI: High-performance async API framework
  • LangGraph: Stateful multi-agent workflow orchestration
  • LangChain: LLM integration and tooling
  • WebSockets: Real-time bidirectional communication

LLM Providers

  • Groq: Ultra-fast inference for Llama 3.3 70B, Qwen 3 32B
  • OpenRouter: Access to GPT-OSS 120B, Kimi K2 Instruct
  • Cerebras: High-performance GPT-OSS 120B and GLM-4.7
  • Google AI: Gemini 2.5 Flash for image generation

Frontend

  • Flask: Lightweight web framework
  • Marked.js: Markdown parsing with KaTeX extension
  • Vis.js: Network graph visualization
  • html2pdf.js: Client-side PDF generation

Research Tools

  • DuckDuckGo Search: Web search for research data
  • BeautifulSoup4: HTML parsing and content extraction

πŸ“ Project Structure

deep-finance/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py              # FastAPI app & WebSocket manager
β”‚   β”œβ”€β”€ agents.py            # LangGraph workflow & agent logic
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── .env                 # API keys (not in repo)
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ app.py               # Flask server
β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   └── dashboard.html   # Main UI
β”‚   └── static/
β”‚       β”œβ”€β”€ css/
β”‚       β”‚   └── style.css    # Glassmorphism design
β”‚       └── js/
β”‚           └── main.js      # WebSocket client & UI logic
β”œβ”€β”€ requirements.txt         # Root dependencies
β”œβ”€β”€ start.sh                 # Startup script
└── README.md

🎨 Key Components

Agent Roles

Agent Model Purpose
Planner Llama 3.3 70B Breaks topic into research sections
Researcher DuckDuckGo Gathers web data for each section
Drafters (A-D) 4 Different LLMs Generate competing section drafts
Judge Llama 3.3 70B Evaluates drafts and selects winner
Compiler GPT-OSS 20B Synthesizes sections into unified report
GNN Analyzer Llama 3.3 70B Network risk and dependency analysis
Risk Scorer Llama 3.3 70B Quantitative risk scoring (0-100)
Valuation Specialist GPT-OSS 20B Stress-tests market assumptions
Designer Gemini 2.5 Flash Generates symbolic cover art
Reviewer (PM) GPT-OSS 120B Makes capital allocation decision
Curator GLM-4.7 Final polish and formatting

Workflow Stages

  1. Planning: Investment committee breaks down research scope
  2. Parallel Research: Workers gather data for each section
  3. Gladiator Drafting: 4 models compete to write each section
  4. Consensus Voting: Judge selects best draft per section
  5. Compilation: Sections synthesized into unified report
  6. Risk Analysis: GNN network modeling + quantitative scoring
  7. Valuation Check: Stress-test market-implied assumptions
  8. Art Generation: AI creates symbolic thesis visualization
  9. PM Review: Portfolio manager makes allocation decision
  10. Final Curation: Professional formatting and polish

πŸ”§ Configuration

Model Selection

Edit backend/agents.py to customize models:

self.models = {
    "A": "llama-3.3-70b-versatile",
    "B": "qwen/qwen3-32b",
    "C": "openai/gpt-oss-120b",
    "D": "moonshotai/kimi-k2-instruct-0905"
}

API Endpoints

  • POST /api/research: Start research job
    {
      "topic": "Long Thesis on NVDA",
      "sources": ["https://example.com/doc"]
    }
  • WebSocket /ws: Real-time updates

🀝 Contributing

Contributions welcome! Areas for improvement:

  • Additional LLM provider integrations
  • Enhanced risk modeling algorithms
  • Custom data source connectors
  • Advanced visualization options
  • Multi-language support

πŸ“„ License

This project is provided as-is for educational and research purposes.


πŸ™ Acknowledgments

  • LangGraph for stateful agent orchestration
  • Groq for lightning-fast LLM inference
  • Cerebras for high-performance model serving
  • Google AI for generative image capabilities
  • Open-source community for foundational tools

πŸ“ž Support

For issues, questions, or feature requests, please open an issue on GitHub.


Built with ❀️ for the AI x Finance community

About

AI-powered investment research platform using multi-agent LLMs (LangGraph + AutoGen) to generate institutional-grade memos with risk scoring, network analysis & consensus voting.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors