Skip to content

About

ResearchForge is a smart AI platform designed like Perplexity that does complete research automatically whenever you ask a question.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ ResearchForge AI

Autonomous Deep Research & Multi-Agent Knowledge Engine

License: MIT Python 3.11+ FastAPI Next.js 14 TypeScript Tailwind CSS Docker

An open-source, production-grade autonomous research platform inspired by Perplexity Pro & OpenAI Deep Research.
Combines autonomous planning, live web scraping, vector memory synthesis, contradiction verification, and real-time SSE streaming into publication-ready intelligence reports.

Key Features β€’ Architecture β€’ Quick Start β€’ Configuration β€’ API Reference β€’ Security


🌟 Highlights

  • 🎯 Perplexity-Inspired Dark UI: Clean, distraction-free interface built with Next.js 14, Tailwind CSS, and Framer Motion.
  • πŸ€– Multi-Tier LLM Architecture: Gemini 1.5 Flash primary engine with local Ollama (qwen3:1.7b) and offline heuristic fallback.
  • 🌐 Deep Web Navigation: Live multi-source web intelligence via Tavily API and DuckDuckGo, enhanced with Playwright headless DOM parsing.
  • πŸ”¬ Rigorous Fact Verification: Automated cross-examination engine that flags conflicting claims, validates citations, and calculates confidence scores.
  • 🧠 Hybrid Vector Memory: Semantic retrieval powered by FAISS vector embeddings coupled with BM25 lexical search.
  • πŸ“‘ Real-Time Execution Telemetry: Server-Sent Events (SSE) stream agent thoughts, active web queries, and discovered sources in real time.

πŸš€ Key Features

1. Autonomous Planning & Recursive Inquiry

Breaks down high-level, complex prompts into targeted research vectors and hypotheses. The orchestrator iteratively searches the web, analyzes results, generates follow-up queries, and drills down until deep consensus is achieved.

2. Live Web Crawling & Headless Extraction

  • API Search: Tavily AI search for instant structured research results.
  • Organic Fallback: DuckDuckGo integration for zero-cost, unmetered web discovery.
  • Headless Browser: Playwright-powered DOM extraction renders JavaScript, bypasses simple barriers, and strips boilerplates to extract high-signal text.

3. Evidence, Citations & Contradiction Detection

  • Extracts granular claims with exact verbatim snippets and timestamps.
  • Automatically cross-checks multiple independent domains.
  • Detects discrepancies or contradictory evidence across sources and highlights them in the synthesized report.

4. Zero-Setup Fallback & Resilience

Designed to operate out-of-the-box. If external API quotas are exhausted or offline, the platform seamlessly degrades to local Ollama inference or the built-in deterministic heuristic synthesis engineβ€”ensuring research tasks never fail.


πŸ— System Architecture

flowchart TD
    User([User Prompt]) --> Frontend[Next.js 14 Perplexity-Style UI]
    Frontend -- HTTP / SSE Streaming --> API[FastAPI Backend Gateway]

    subgraph CoreEngine [ResearchForge Core Orchestrator]
        Planner[Recursive Query Planner]
        Searcher[Hybrid Search: Tavily / DuckDuckGo]
        Browser[Playwright Headless Scraper]
        EvidenceEngine[Evidence & Citation Extractor]
        ContradictionEngine[Contradiction & Fact Verifier]
        Synthesizer[Report Synthesis Engine]
    end

    API --> Planner
    Planner --> Searcher
    Searcher --> Browser
    Browser --> EvidenceEngine
    EvidenceEngine --> ContradictionEngine
    ContradictionEngine --> Synthesizer

    subgraph IntelligenceLayer [Intelligence & Memory]
        LLM[Gemini 1.5 Flash / Ollama Local]
        VectorStore[(FAISS Vector Index)]
        LexicalStore[(BM25 Lexical Index)]
        Database[(Async SQLite / PostgreSQL)]
    end

    Synthesizer <--> LLM
    EvidenceEngine <--> VectorStore
    EvidenceEngine <--> LexicalStore
    API <--> Database
    Synthesizer -- SSE Stream --> Frontend
Loading

πŸ’» Tech Stack

Layer Technology
Frontend Next.js 14 (App Router), TypeScript, Tailwind CSS, Framer Motion, Lucide Icons
Backend Python 3.11+, FastAPI, Pydantic v2, AsyncIO, Uvicorn
LLM & AI Google Gemini 1.5 Flash, Ollama (qwen3:1.7b), Heuristic Synthesizer
Web Retrieval Tavily AI Search, DuckDuckGo Search, Playwright Headless Browser
Memory & Storage FAISS (Vector Index), BM25 (Keyword Index), SQLite / PostgreSQL via SQLAlchemy
Containerization Docker, Docker Compose

⚑ Quick Start

Prerequisites

  • Python: Version 3.11 or 3.12 installed
  • Node.js: Version 18.0 or higher (npm or pnpm)
  • Git installed on your system
  • (Optional) Ollama for running local models (ollama run qwen3:1.7b)

Step 1: Clone the Repository

git clone https://github.com/raitulh/ResearchForge-AI-.git
cd ResearchForge-AI-

Step 2: Backend Setup

  1. Navigate to the backend directory and set up a virtual environment:

    cd backend
    python -m venv venv
    
    # On Windows:
    .\venv\Scripts\activate
    # On macOS/Linux:
    source venv/bin/activate
  2. Install dependencies:

    pip install -r requirements.txt
    playwright install chromium
  3. Configure Environment Variables: Copy the example environment configuration:

    cp .env.example .env

    (Edit .env to add your optional API keys such as GEMINI_API_KEY or TAVILY_API_KEY. The system also runs locally without any API keys).

  4. Start the FastAPI Backend:

    uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload

    The backend API will be live at http://127.0.0.1:8000
    Interactive API Docs (Swagger): http://127.0.0.1:8000/docs


Step 3: Frontend Setup

  1. In a new terminal window, navigate to the frontend directory:

    cd frontend
    npm install
  2. Configure Environment Variables:

    cp .env.example .env.local
  3. Start the Development Server:

    npm run dev

    Open http://localhost:3000 in your browser to start researching!


🐳 Run with Docker Compose

To spin up the entire platform (Frontend, Backend, and Database) with a single command:

docker-compose up --build

βš™οΈ Environment Variables

ResearchForge is designed with security first. Never commit your .env or .env.local files to source control.

Backend (backend/.env)

Variable Type Default Description
GEMINI_API_KEY String Optional Google Gemini API Key for deep reasoning
TAVILY_API_KEY String Optional Tavily Search API key for high-speed research queries
GEMINI_MODEL String gemini-1.5-flash Gemini model variant
OLLAMA_BASE_URL String http://localhost:11434 Ollama service endpoint for local offline inference
OLLAMA_MODEL String qwen3:1.7b Local model tag for Ollama
DATABASE_URL String sqlite+aiosqlite:///./research.db SQLAlchemy async database connection string
FAISS_INDEX_PATH String ./faiss_index Storage directory for vector embeddings
PLAYWRIGHT_HEADLESS Boolean true Run web scrapers headlessly
PLAYWRIGHT_TIMEOUT Integer 30000 Browser timeout in milliseconds

Frontend (frontend/.env.local)

Variable Type Default Description
NEXT_PUBLIC_API_URL String http://localhost:8000 Backend API base URL

πŸ”Œ API Reference

Method Endpoint Description
POST /api/research Initialize a new autonomous research task
GET /api/research/{id} Retrieve research task status, metrics, and summary
GET /api/research/{id}/events Real-time Server-Sent Events (SSE) telemetry stream
GET /api/research/{id}/report Fetch full publication-grade research report
GET /api/research/{id}/sources Inspect all crawled web sources, domains, and trust scores
GET /api/research/{id}/evidence Retrieve extracted claims, facts, and evidence items
POST /api/research/{id}/continue Trigger follow-up recursive exploration rounds
POST /api/research/{id}/verify Run dedicated contradiction detection & verification
GET /health Service health status and readiness check

Example: Start Research via cURL

curl -X POST "http://127.0.0.1:8000/api/research" \
     -H "Content-Type: application/json" \
     -d '{"query": "Quantum Computing breakthroughs in Post-Quantum Cryptography in 2026"}'

πŸ”’ Security & Privacy

  • Zero Credential Leaking: All .env, .env.local, .pytest_cache, databases (*.db), vector indexes, and session files are strictly excluded via .gitignore.
  • Local Privacy Mode: You can run ResearchForge completely air-gapped using local Ollama models (qwen3, llama3, mistral) and DuckDuckGo search without sending data to any external proprietary AI provider.
  • Sanitized Headless Browsing: Playwright browser instances operate within sandboxed contexts and automatically clean up cache directories post-execution.

πŸ“‚ Project Structure

ResearchForge-AI/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/             # FastAPI REST & SSE endpoints (research, memory, sources)
β”‚   β”‚   β”œβ”€β”€ core/            # Autonomous research orchestrator & pipeline
β”‚   β”‚   β”œβ”€β”€ db/              # SQLAlchemy models, SQLite/PostgreSQL connectors
β”‚   β”‚   β”œβ”€β”€ engine/          # Evidence, citation, and contradiction engines
β”‚   β”‚   β”œβ”€β”€ llm/             # Gemini, Ollama & heuristic fallback providers
β”‚   β”‚   β”œβ”€β”€ memory/          # Hybrid FAISS vector store & BM25 index
β”‚   β”‚   β”œβ”€β”€ scrapers/        # Playwright headless browser scraper
β”‚   β”‚   └── search/          # Tavily API and DuckDuckGo search providers
β”‚   β”œβ”€β”€ requirements.txt     # Python backend dependencies
β”‚   β”œβ”€β”€ Dockerfile           # Backend container specification
β”‚   └── .env.example         # Template configuration for backend
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ app/                 # Next.js 14 App Router pages (Home, Research, History, Memory)
β”‚   β”œβ”€β”€ components/          # Perplexity-style UI components & visualizations
β”‚   β”œβ”€β”€ lib/                 # API client & utilities
β”‚   β”œβ”€β”€ types/               # TypeScript interfaces & types
β”‚   β”œβ”€β”€ package.json         # Frontend package configuration
β”‚   └── .env.example         # Template configuration for frontend
β”œβ”€β”€ docker/                  # Docker build files and deployment scripts
β”œβ”€β”€ docker-compose.yml       # Multi-container orchestration config
β”œβ”€β”€ .gitignore               # Strict security exclusions for keys & artifacts
└── README.md                # Comprehensive documentation

🀝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.

Built with ❀️ by raitulh and the open-source AI community.

About

ResearchForge is a smart AI platform designed like Perplexity that does complete research automatically whenever you ask a question.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages