Skip to content

nranjan21/CompAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CompAI - AI-Powered Company Research Platform πŸš€

An advanced multi-agent research system with a modern web interface that autonomously gathers, validates, and synthesizes public data (Financials, News, Social, Competitive) into professional investment reports. Powered by LangGraph for resilient, reasoning-aware research workflows and React + Vite for a premium user experience.


πŸ—οΈ Architecture: Full-Stack AI Research Platform

Backend: LangGraph-Based Agent System

The system utilizes a state-driven LangGraph orchestrator to manage specialized research nodes. This allows for parallel execution, structured reasoning, and graceful fallbacks across multiple LLM providers.

graph TD
    Start((Start)) --> Orchestrator{Orchestrator}
    Orchestrator --> Profile[Company Profile]
    Orchestrator --> Financial[Financial Research]
    Orchestrator --> News[News Intelligence]
    Orchestrator --> Sentiment[Sentiment Analysis]
    Orchestrator --> Competitive[Competitive Intel]
    
    Profile --> Aggregator[State Aggregator]
    Financial --> Aggregator
    News --> Aggregator
    Sentiment --> Aggregator
    Competitive --> Aggregator
    
    Aggregator --> Synthesis[Insight Synthesis]
    Synthesis --> Report[Report Generator]
    Report --> End((Finished))
Loading

Frontend: Modern React Application

  • Framework: React 19 with TypeScript
  • Build Tool: Vite for fast development and optimized builds
  • Routing: React Router DOM for seamless navigation
  • Animations: Framer Motion for smooth UI transitions
  • Styling: Custom CSS with modern design patterns
  • API Communication: Axios for backend integration

🧠 Specialized Research Agents

  1. Company Profile Agent: Validates company identity and extracts Wikipedia-based historical context.
  2. Financial Research Agent: Parses SEC filings with automated anomaly detection (flagging unusual growth/margins).
  3. News Intelligence Agent: Uses ScrapingBee (Main) or SerpAPI (Fallback) to build chronological event timelines from real news.
  4. Sentiment Analysis Agent: Implements multi-stage fallback (Social/Reddit/Reviews) when news data is sparse.
  5. Competitive Intelligence Agent: Maps competitors, SWOT, and market positioning.
  6. Synthesis Engine: Performs reasoning-aware data aggregation to resolve contradictions and surface "non-obvious" insights.

✨ Key Features

1. Modern Web Interface 🎨

  • Premium Design: Sleek, professional UI with smooth animations and transitions
  • Real-time Progress: Live updates on research progress with detailed agent status
  • Interactive Reports: Sidebar navigation with downloadable PDF reports
  • Responsive Layout: Works seamlessly across desktop and mobile devices
  • Dark Mode Support: Eye-friendly interface for extended research sessions

2. Robust Data Sourcing πŸ“°

  • ScrapingBee & SerpAPI Integration: Multi-layered news and search sourcing with JS-rendering support
  • Wikipedia History Extraction: Automatically parses founding, IPO, and M&A history
  • SEC EDGAR Parsing: Direct extraction of income statements and balance sheets from official filings

3. Financial Anomaly Detection πŸ“Š

  • Automated logic to flag data points requiring human review:
    • Unusual revenue/earnings growth (>100% YoY)
    • Significant negative margins
    • Conflicts between different financial data points

4. Resilient LLM Fallback Chain πŸ›‘οΈ

Supports automatic provider-switching to maintain 100% uptime using free-tier APIs:

  • OpenAI GPT 4o-mini (Primary)
  • Groq (Llama 3.3 70B - High speed)
  • Google Gemini 2.0 Flash / Cohere / Together AI / Hugging Face

πŸ“¦ Installation & Setup

Prerequisites

Before setting up CompAI, ensure you have the following installed:

  • Python 3.9+ - For the backend research agents
  • Node.js 18+ and npm - For the frontend application
  • Git - For cloning the repository

1. Clone the Repository

git clone https://github.com/your-repo/CompAI.git
cd CompAI

2. Backend Setup

Install Python Dependencies

# Create virtual environment
python -m venv .venv

# Activate virtual environment
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

# Install dependencies
pip install -r backend/requirements.txt

Configure API Keys

Create a .env file in the backend/ directory:

# LLM Providers (At least one required)
GOOGLE_API_KEY=your_google_api_key_here
GROQ_API_KEY=your_groq_api_key_here
COHERE_API_KEY=your_cohere_api_key_here

# Scraping / Data Sources
SCRAPINGBEE_API_KEY=your_scrapingbee_key_here  # Primary Scraper & Search
SERPAPI_API_KEY=your_serpapi_key_here          # Fallback for Rich News & Search

Important

You need at least one LLM provider API key and one scraping API key for the system to function properly.

Start the Backend Server

cd backend
python -m uvicorn app.main:app --reload --port 8000

The backend API will be available at http://localhost:8000

3. Frontend Setup

Install Node Dependencies

cd frontend
npm install

Configure Frontend Environment (Optional)

Create a .env file in the frontend/ directory if you need to customize the API endpoint:

VITE_API_URL=http://localhost:8000

Start the Development Server

npm run dev

The frontend will be available at http://localhost:5173

4. Verify Installation

  1. Open your browser and navigate to http://localhost:5173
  2. Enter a company name (e.g., "Apple Inc", "Tesla", "Microsoft")
  3. Watch the real-time progress as agents gather and analyze data
  4. Review the comprehensive report generated

πŸ’» Usage

Web Interface (Recommended)

  1. Start both backend and frontend servers (see setup instructions above)
  2. Navigate to http://localhost:5173 in your browser
  3. Enter a company name in the search field
  4. Monitor progress as the AI agents research the company
  5. Review the report with interactive navigation
  6. Download PDF for offline access

CLI Interface (Advanced)

For programmatic access or automation:

cd backend
python run_cli.py --company "NVIDIA" --ticker NVDA

CLI Options:

  • --company: Full name of the company (required)
  • --ticker: Stock symbol for faster financial discovery (optional)
  • --no-parallel: Run agents sequentially for debugging (optional)

πŸ—‚οΈ Project Structure

CompAI/
β”œβ”€β”€ backend/                    # Python backend with LangGraph agents
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ agents/            # Research agent implementations
β”‚   β”‚   β”‚   β”œβ”€β”€ company_profile_agent.py
β”‚   β”‚   β”‚   β”œβ”€β”€ financial_research_agent.py
β”‚   β”‚   β”‚   β”œβ”€β”€ news_intelligence_agent.py
β”‚   β”‚   β”‚   β”œβ”€β”€ sentiment_analysis_agent.py
β”‚   β”‚   β”‚   β”œβ”€β”€ competitive_intelligence_agent.py
β”‚   β”‚   β”‚   └── orchestrator.py
β”‚   β”‚   β”œβ”€β”€ api/               # FastAPI routes
β”‚   β”‚   β”‚   └── routes.py
β”‚   β”‚   β”œβ”€β”€ core/              # Core configuration and state
β”‚   β”‚   β”‚   β”œβ”€β”€ config.py
β”‚   β”‚   β”‚   β”œβ”€β”€ llm_manager.py
β”‚   β”‚   β”‚   └── state.py
β”‚   β”‚   β”œβ”€β”€ synthesis/         # Insight synthesis engine
β”‚   β”‚   β”‚   └── synthesizer.py
β”‚   β”‚   β”œβ”€β”€ reporting/         # Report generation
β”‚   β”‚   β”‚   └── report_generator.py
β”‚   β”‚   β”œβ”€β”€ utils/             # Utilities (scrapers, parsers)
β”‚   β”‚   β”œβ”€β”€ schemas/           # Pydantic models
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic services
β”‚   β”‚   └── main.py            # FastAPI application entry point
β”‚   β”œβ”€β”€ reports/               # Generated research reports
β”‚   β”œβ”€β”€ annual_reports/        # Downloaded SEC filings
β”‚   β”œβ”€β”€ cache/                 # Agent response cache
β”‚   β”œβ”€β”€ requirements.txt       # Python dependencies
β”‚   β”œβ”€β”€ .env.example          # Example environment variables
β”‚   └── run_cli.py            # CLI entry point
β”‚
β”œβ”€β”€ frontend/                  # React + TypeScript frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/       # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/            # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.tsx      # Landing page
β”‚   β”‚   β”‚   β”œβ”€β”€ Research.tsx  # Research progress page
β”‚   β”‚   β”‚   β”œβ”€β”€ Report.tsx    # Report display page
β”‚   β”‚   β”‚   └── History.tsx   # Research history
β”‚   β”‚   β”œβ”€β”€ styles/           # CSS stylesheets
β”‚   β”‚   β”œβ”€β”€ types/            # TypeScript type definitions
β”‚   β”‚   β”œβ”€β”€ utils/            # Frontend utilities
β”‚   β”‚   β”œβ”€β”€ App.tsx           # Main application component
β”‚   β”‚   └── main.tsx          # Application entry point
β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   β”œβ”€β”€ package.json          # Node dependencies
β”‚   β”œβ”€β”€ tsconfig.json         # TypeScript configuration
β”‚   β”œβ”€β”€ vite.config.ts        # Vite configuration
β”‚   └── .env.example          # Example frontend environment
β”‚
└── README.md                 # This file

πŸ“ Example Report Output

The agent produces comprehensive, structured reports containing:

  • Executive Summary - High-level overview with key insights
  • Company Overview - Historical context from Wikipedia and validated company information
  • Financial Highlights - Key metrics with anomaly warnings and trend analysis
  • Business & Industry Analysis - Market positioning and competitive dynamics
  • Recent News & Key Events - Categorized timeline of significant developments
  • Public & Social Sentiment - Trust-weighted sentiment analysis from multiple sources
  • Opportunities & Risks - AI-synthesized insights on potential upsides and concerns
  • Key Observations - Non-obvious patterns and contradictions surfaced by the synthesis engine
  • Data Sources & Trust Scores - Complete transparency on data provenance and reliability
  • Research Metadata - Provider usage, reasoning steps, and execution details

πŸš€ Production Deployment

Backend Deployment

# Build production environment
pip install -r backend/requirements.txt

# Run with production ASGI server
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4

Frontend Deployment

# Build optimized production bundle
cd frontend
npm run build

# The dist/ folder contains the production-ready static files
# Deploy to any static hosting service (Vercel, Netlify, AWS S3, etc.)

πŸ› οΈ Technology Stack

Backend

  • Python 3.9+ - Core language
  • FastAPI - Modern web framework
  • LangGraph - Agent orchestration
  • Pydantic - Data validation
  • Uvicorn - ASGI server
  • ScrapingBee / SerpAPI - Web scraping
  • Multiple LLM Providers - OpenAI, Gemini, Groq, Cohere, Huggingface

Frontend

  • React 19 - UI framework
  • TypeScript - Type safety
  • Vite - Build tool and dev server
  • React Router DOM - Client-side routing
  • Framer Motion - Animations
  • Axios - HTTP client

πŸ›‘οΈ License & Principles

  • Synthesis Over Collection: Focus on "Why" and "So What?", not just "What"
  • Source Transparency: Every data point includes a trust score (0-1.0) and source link
  • Privacy First: Research is performed on public endpoints only
  • User-Centric Design: Premium, intuitive interface for professional researchers

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Built with: LangGraph, FastAPI, React, Vite, ScrapingBee, SerpAPI, and Multiple LLM Providers

πŸ“Έ Screenshots

Home Page

CompAI Home Page

  • Clean, modern interface for entering company names to begin research*

Features-Overview

CompAI Features Overview

  • Overview of the features of the application*

Research Progress

Research Progress Tracking

  • Real-time progress tracking with detailed agent status and estimated time remaining*

Report View

Comprehensive Report

  • Interactive report with sidebar navigation and comprehensive company analysis*

About

Design and build a Deep Research Agent that autonomously gathers, analyzes, and synthesizes publicly available information about a company to generate company research report.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors