# john-adeojo/graph_websearch_agent architecture

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

- Interactive diagram: https://gitdiagram.com/john-adeojo/graph_websearch_agent
- Repository: https://github.com/john-adeojo/graph_websearch_agent

## Overview

##### Project type and purpose
- This is a Python-based, full-stack agent framework that provides a chat UI (via Chainlit) for interactive web searches.
- It implements a graph-based reasoning engine (“LangGraph”) (`agent_graph/graph.py`) that orchestrates multiple LLM models, tools, and states to fulfill user queries.

##### File structure
- Top-level components:
- `.chainlit/` and `app/` – Chainlit UI configuration and entrypoint (`app/app.py`, `app/chat.py`).
- `agent_graph/` – Core graph logic to assemble and traverse reasoning steps.
- `agents/` – Agent definitions and orchestration (`agents/agents.py`).
- `models/` – Wrappers for different LLM providers (OpenAI, Gemini, Claude, Groq, VLLM, Ollama).
- `tools/` – External utilities (web scraper, Google Serper).
- `states/` – State machine for tracking the agent’s reasoning state.
- `prompts/` – Prompt templates for LLM calls.
- `config/` – Configuration (`config.yaml`) for API keys and settings.
- `utils/` – Helper functions and tests.
- Deployment scripts: `run_linux.sh`, `run_windows.ps1`.
- Documentation and schema: `schema_diagram/LanGraph.png`, `chainlit.md`.

##### README for additional insights
- The system relies on external LLM APIs and a local Ollama server (optional).

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::user

    subgraph "Frontend (Chainlit UI)"
        CConfig[".chainlit/config.toml"]:::config
        CTrans[".chainlit/translations/en-US.json"]:::config
        App["app/app.py"]:::frontend
        Chat["app/chat.py"]:::frontend
    end

    subgraph "Backend Engine"
        Orch["agents/agents.py"]:::core
        Graph["agent_graph/graph.py"]:::core
        State["states/state.py"]:::core
        Prompt["prompts/prompts.py"]:::core
    end

    subgraph "Adapters"
        subgraph "Model Adapters"
            OpenAI["models/openai_models.py"]:::adapter
            Gemini["models/gemini_models.py"]:::adapter
            Claude["models/claude_models.py"]:::adapter
            Groq["models/groq_models.py"]:::adapter
            VLLM["models/vllm_models.py"]:::adapter
            Ollama["models/ollama_models.py"]:::adapter
        end
        subgraph "Tool Adapters"
            Scraper["tools/basic_scraper.py"]:::adapter
            Serper["tools/google_serper.py"]:::adapter
        end
    end

    subgraph "Utilities & Config"
        Config["config/config.yaml"]:::config
        Utils["utils/helper_functions.py"]:::utils
        Tests["utils/test.py"]:::utils
    end

    subgraph "External Services"
        subgraph "LLM APIs"
            EOpenAI["OpenAI API"]:::external
            EGemini["Gemini API"]:::external
            EClaude["Claude API"]:::external
            EGroq["Groq API"]:::external
        end
        OllamaServer["Ollama Server"]:::externalDashed
        subgraph "Web Search"
            WebSerper["Serper.dev API"]:::external
        end
    end

    User -->|inputs| App
    App --> Chat
    Chat --> Orch
    Orch --> Graph
    Graph --> State
    State --> Graph
    Graph --> Prompt
    Prompt --> OpenAI
    Prompt --> Gemini
    Prompt --> Claude
    Prompt --> Groq
    Prompt --> VLLM
    Prompt --> Ollama
    Graph --> Scraper
    Graph --> Serper
    Orch --> Config
    Graph --> Config
    Prompt --> Config
    OpenAI --> Config
    Utils --- Orch
    Utils --- Graph
    Utils --- Prompt

    OpenAI -->|API call| EOpenAI
    Gemini -->|API call| EGemini
    Claude -->|API call| EClaude
    Groq -->|API call| EGroq
    VLLM -.->|local| OllamaServer
    Ollama -->|local| OllamaServer
    Serper -->|HTTP request| WebSerper
    Scraper -->|HTTP scrape| WebSerper

    EOpenAI --> Graph
    EGemini --> Graph
    EClaude --> Graph
    EGroq --> Graph
    WebSerper --> Graph

    Graph --> Chat
    Chat -->|output| User

    click CConfig "https://github.com/john-adeojo/graph_websearch_agent/blob/main/.chainlit/config.toml"
    click CTrans "https://github.com/john-adeojo/graph_websearch_agent/blob/main/.chainlit/translations/en-US.json"
    click App "https://github.com/john-adeojo/graph_websearch_agent/blob/main/app/app.py"
    click Chat "https://github.com/john-adeojo/graph_websearch_agent/blob/main/app/chat.py"
    click Orch "https://github.com/john-adeojo/graph_websearch_agent/blob/main/agents/agents.py"
    click Graph "https://github.com/john-adeojo/graph_websearch_agent/blob/main/agent_graph/graph.py"
    click State "https://github.com/john-adeojo/graph_websearch_agent/blob/main/states/state.py"
    click Prompt "https://github.com/john-adeojo/graph_websearch_agent/blob/main/prompts/prompts.py"
    click OpenAI "https://github.com/john-adeojo/graph_websearch_agent/blob/main/models/openai_models.py"
    click Gemini "https://github.com/john-adeojo/graph_websearch_agent/blob/main/models/gemini_models.py"
    click Claude "https://github.com/john-adeojo/graph_websearch_agent/blob/main/models/claude_models.py"
    click Groq "https://github.com/john-adeojo/graph_websearch_agent/blob/main/models/groq_models.py"
    click VLLM "https://github.com/john-adeojo/graph_websearch_agent/blob/main/models/vllm_models.py"
    click Ollama "https://github.com/john-adeojo/graph_websearch_agent/blob/main/models/ollama_models.py"
    click Scraper "https://github.com/john-adeojo/graph_websearch_agent/blob/main/tools/basic_scraper.py"
    click Serper "https://github.com/john-adeojo/graph_websearch_agent/blob/main/tools/google_serper.py"
    click Config "https://github.com/john-adeojo/graph_websearch_agent/blob/main/config/config.yaml"
    click Utils "https://github.com/john-adeojo/graph_websearch_agent/blob/main/utils/helper_functions.py"
    click Tests "https://github.com/john-adeojo/graph_websearch_agent/blob/main/utils/test.py"

    classDef frontend fill:#D0E6FF,stroke:#0366d6,color:#0366d6
    classDef user fill:#E0F7FA,stroke:#006064,color:#006064
    classDef core fill:#E6F4EA,stroke:#037F23,color:#037F23
    classDef adapter fill:#FFF9C4,stroke:#F9A825,color:#F9A825
    classDef config fill:#F5F5F5,stroke:#9E9E9E,color:#616161
    classDef utils fill:#F5F5F5,stroke:#9E9E9E,color:#616161
    classDef external fill:#FFCDD2,stroke:#C62828,color:#C62828
    classDef externalDashed fill:#FFEBEE,stroke:#C62828,color:#C62828,stroke-dasharray: 5 5
```
