Skip to content

Aman00240/Research-Assistant

Repository files navigation

Agentic Research Assistant

An autonomous, multi-agent research system designed to compile professional, data-driven intelligence briefs. Built with LangGraph, FastAPI, and Streamlit, the system utilizes a "Plan-and-Solve" architecture to iteratively research a topic, evaluate its own findings, and generate a concise, source-grounded executive summary.

Live Demo

System Architecture

The project leverages a multi-node state graph to separate concerns, ensuring high reliability and mitigating hallucinations. The workflow consists of three primary agents:

  • Planner Node: Acts as the research architect. It takes the user's prompt and breaks it down into 3-5 highly targeted, actionable research steps, focusing on depth and logical progression.
  • Worker Node: The execution engine. It processes the plan sequentially by querying search engines, scraping target URLs, and executing an ephemeral Retrieval-Augmented Generation (RAG) pipeline to extract relevant facts. It maintains strict context grounding via metadata injection.
  • Critic Node: The quality control layer. Before the user sees the final output, the Critic evaluates the draft against strict constraints (e.g., word count, conversational filler, and accurate sequential citation mapping). If the draft fails, it generates a correction directive and routes the state back to the Worker.
---
config:
  flowchart:
    curve: linear
---
graph LR
    %% Node Styles
    classDef process fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
    classDef decision fill:#fff9c4,stroke:#fbc02d,stroke-width:2px;
    classDef terminal fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;

    Start((Start)) --> Planner[Research Planner]
    Planner --> Worker[Worker Agent]

    subgraph Loop [Execution Loop]
        Worker --> Tools[Search & Read Tools]
        Tools --> Worker
    end

    Worker --> Critic{Quality Control}

    Critic -- FAILED --> Worker
    Critic -- APPROVED --> End((End))

    %% Apply Styles
    class Planner,Worker,Tools process;
    class Critic decision;
    class Start,End terminal;
Loading

Tech Stack

Category Technology
Orchestration LangGraph, LangChain
LLM Provider Groq (Llama models)
Backend FastAPI
Frontend Streamlit
Search Tools Tavily API, Jina Reader API
Vector Processing FAISS, FastEmbed (BAAI/bge-small-en-v1.5)
Environment Docker, Docker Compose, uv

Key Features

  • Asynchronous Processing: The LLM graph execution takes 30-60+ seconds. The backend handles this gracefully without blocking the main thread, allowing the frontend client to poll for status updates continuously.
  • Structured Outputs: Strict enforcement of Pydantic schemas ensures the LLM outputs parseable JSON for intermediate states (e.g., verified source lists and execution plans).
  • Ephemeral Vector Stores: To manage token limits during web scraping, the system chunks HTML/Markdown payloads on the fly, embeds them, and runs a similarity search against the current sub-task before passing the data to the synthesis layer.
  • Zero-Hallucination Citations: Incorporates source-grounding metadata directly into the context window, forcing the model to bind facts strictly to retrieved URLs.

Project Structure

research-assistant/
├── backend/
│   ├── agent/
│   │   ├── nodes/
│   │   │   ├── critic.py
│   │   │   ├── planner.py
│   │   │   └── worker.py
│   │   ├── tools/
│   │   │   ├── read.py
│   │   │   └── search.py
│   │   ├── graph.py
│   │   ├── state.py
│   │   └── utils.py
│   ├── routers/
│   │   └── research.py
│   ├── config.py
│   └── main.py
├── frontend/
│   └── app.py
├── docker-compose.yml
├── Dockerfile
├── Dockerfile.frontend
├── pyproject.toml
├── uv.lock
└── .env
└── .dockerignore

Setup & Configuration

1. Clone the repository

git clone https://github.com/Aman00240/Research-Assistant
cd research-assistant

2. Configure Environment Variables

Create a .env file in the root directory and add your required API keys:

GROQ_KEY=your_groq_api_key
TAVILY_KEY=your_tavily_api_key
LLAMA_SCOUT=meta-llama/llama-4-scout-17b-16e-instruct
LLAMA_VERSATILE=llama-3.3-70b-versatile

Usage (Docker)

The project is fully containerized. The recommended way to run the application is using Docker Compose, which will automatically orchestrate both the FastAPI backend and the Streamlit frontend.

1. Build and start the containers

docker compose up --build

2. Access the Application

Frontend UI: Open your browser and navigate to http://localhost:8501 to use the Research Assistant.

Backend API: The FastAPI backend runs on http://localhost:8000. You can access the interactive API documentation at http://localhost:8000/docs.

Local Development

If you prefer to run the application locally without Docker, this project uses uv for fast dependency management.

uv sync --all-groups

uv run uvicorn backend.main:app --host 0.0.0.0 --port 8000 --reload

uv run streamlit run frontend/app.py

About

An AI-powered research assistant that automates deep-dive information gathering. Orchestrates Planner, Worker, and Critic agents to produce data-driven, fully cited executive briefs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors