# hrithikkoduri/webrover architecture

> Architecture diagram of the GitHub repository hrithikkoduri/webrover, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hrithikkoduri/webrover
- Repository: https://github.com/hrithikkoduri/webrover

## Overview

##### Project type and purpose
- This is a full-stack AI-powered web automation and research tool called WebRover.
- Purpose: Provide users with a chat-style interface (Next.js frontend) to interact with three specialized agents (Task, Research, Deep Research) hosted in a FastAPI backend. Agents orchestrate browser automation (via Playwright) and LLM-driven workflows (via LangChain, OpenAI, Anthropic, etc.), producing task results, research summaries, or academic-style reports.

##### File structure
- Top level:
- backend/ – Python FastAPI service, agent orchestrator, browser manager, research modules, marking scripts.
- frontend/ – Next.js + TypeScript UI, styling (Tailwind), components, pages for rover and testing.
- assets/ – media and demo videos.
- Patterns:
- MVC-ish separation: frontend (view+client logic) ↔ backend (controller+model logic).
- Modular agent implementations under backend/app (browser_manager.py, task_agent.py, research_agent.py, deep_research_agent.py).
- LangGraph.json in backend root for state-graph config.
- Config & deployment:
- backend/pyproject.toml, .env expectations, uvicorn launch in main.py.
- frontend/package.json, Next.js config, Tailwind, ESLint, nodemon for local dev.

##### README for additional insights
- Architecture section highlights four pillars: State Management (LangGraph), Browser Automation (Playwright), Content Processing (RAG + vector store), AI Decision Making (LLMs).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User["User"]:::external

    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        UI["User Interface (Next.js)"]:::frontend
        RoverPage["UI Rover Page"]:::frontend
        TestPage["Test Page"]:::frontend
        Layout["Global Layout & Styles"]:::frontend
        QueryInput["Rover Query Input Component"]:::frontend
        ResponseDisplay["Rover Response Display Component"]:::frontend
        ResponseActions["Rover Response Actions Component"]:::frontend
        UIComponents["Common UI Components"]:::frontend
        Utils["Utility Functions"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        API["API Layer (FastAPI)"]:::backend
        Orchestrator["Agent Orchestrator / Controller"]:::backend
        TaskAgent["Task Agent Implementation"]:::backend
        ResearchAgent["Research Agent Implementation"]:::backend
        DeepAgent["Deep Research Agent Implementation"]:::backend
        BrowserEngine["Browser Automation Engine"]:::backend
        StateManager["State Manager (LangGraph)"]:::datastore
        VectorStore["Vector Store (RAG Pipeline)"]:::datastore
        ExportModule["Export Module (PDF & Google Docs)"]:::backend
        EnvConfig["Backend Dependency Config"]:::backend
        MarkingScripts["Backend Marking Scripts"]:::backend
    end

    %% External Services
    subgraph "External Services"
        direction TB
        LLM["LLM Providers (OpenAI, Anthropic, Claude)"]:::external
        GoogleDocs["Google Docs API"]:::external
    end

    %% Flows
    User -->|"interacts via HTTP/WebSocket"| UI
    UI -->|"renders Rover Page"| RoverPage
    UI -->|"renders Test Page"| TestPage
    RoverPage -->|"uses"| QueryInput
    RoverPage -->|"uses"| ResponseDisplay
    RoverPage -->|"uses"| ResponseActions
    UI -->|"uses"| UIComponents
    UI -->|"uses"| Utils

    RoverPage -->|"calls REST/WebSocket"| API
    TestPage -->|"calls REST/WebSocket"| API

    API -->|"internal calls"| Orchestrator

    Orchestrator -->|"controls"| BrowserEngine
    BrowserEngine -->|"feedback"| Orchestrator

    Orchestrator -->|"queries"| StateManager
    Orchestrator -->|"stores/retrieves"| VectorStore

    Orchestrator -->|"calls"| TaskAgent
    Orchestrator -->|"calls"| ResearchAgent
    Orchestrator -->|"calls"| DeepAgent

    VectorStore -->|"provides context"| LLM
    StateManager -->|"provides workflow state"| Orchestrator
    LLM -->|"streams responses"| Orchestrator

    Orchestrator -->|"formats output"| ExportModule
    ExportModule -->|"exports to"| GoogleDocs

    Orchestrator -->|"responds to API"| API
    API -->|"returns data"| UI

    %% Config & Utility
    EnvConfig -.-> API
    MarkingScripts -.-> Orchestrator

    %% Click Events
    click UI "https://github.com/hrithikkoduri/webrover/tree/main/frontend/src/app"
    click RoverPage "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/app/rover/page.tsx"
    click TestPage "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/app/test/page.tsx"
    click Layout "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/app/layout.tsx"
    click Layout "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/app/globals.css"
    click QueryInput "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/components/rover/QueryInput.tsx"
    click ResponseDisplay "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/components/rover/ResponseDisplay.tsx"
    click ResponseActions "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/components/rover/ResponseActions.tsx"
    click UIComponents "https://github.com/hrithikkoduri/webrover/tree/main/frontend/src/components/ui"
    click Utils "https://github.com/hrithikkoduri/webrover/blob/main/frontend/src/lib/utils.ts"
    click API "https://github.com/hrithikkoduri/webrover/blob/main/backend/app/main.py"
    click Orchestrator "https://github.com/hrithikkoduri/webrover/blob/main/backend/app/browser_manager.py"
    click TaskAgent "https://github.com/hrithikkoduri/webrover/blob/main/backend/app/task_agent.py"
    click ResearchAgent "https://github.com/hrithikkoduri/webrover/blob/main/backend/app/research_agent.py"
    click DeepAgent "https://github.com/hrithikkoduri/webrover/blob/main/backend/app/deep_research_agent.py"
    click BrowserEngine "https://github.com/hrithikkoduri/webrover/blob/main/backend/Browser/webrover_browser.py"
    click StateManager "https://github.com/hrithikkoduri/webrover/blob/main/backend/langgraph.json"
    click EnvConfig "https://github.com/hrithikkoduri/webrover/blob/main/backend/pyproject.toml"
    click MarkingScripts "https://github.com/hrithikkoduri/webrover/tree/main/backend/marking_scripts"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#084298,color:#084298;
    classDef backend fill:#D1E8D1,stroke:#0F5132,color:#0F5132;
    classDef external fill:#FFF3CD,stroke:#664D03,color:#664D03;
    classDef datastore fill:#E2D5F1,stroke:#5A189A,color:#5A189A;
```
