# h9-tec/crewai-deep-researcher architecture

> Architecture diagram of the GitHub repository h9-tec/crewai-deep-researcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/h9-tec/crewai-deep-researcher
- Repository: https://github.com/h9-tec/crewai-deep-researcher

## Overview

##### Main Components
- User Interface: Represent the Gradio interface (visualizer.py) which accepts research queries and displays real-time information.
- Agents Module: Capture the multi-agent system implemented in agents.py. This includes:
– Web Research Specialist
– Content Analyzer
– Fact Checker
- Task Management: Show the tasks module (tasks.py) that defines research procedures and execution logic.
- Event System: Display the event_system.py component which is likely responsible for managing communication, synchronization, and event propagation between agents and tasks.
- Tools: Note the tools directory (e.g., browser_tool.py) which might assist agents with fetching and interacting with web content.
- AI Inference Service: Clearly mark the integration with Ollama, which handles local model inference (as configured by environment variables and referenced in agents.py).

##### Relationships and Interactions
- From the UI, the system triggers tasks that coordinate various agents.
- The agents interact with the tools (like browser_tool) for data gathering.
- An event system oversees and routes events or messages among agents and tasks for proper synchronization.
- The agent components, when needed, communicate with the local Ollama inference service, using configuration from .env.

##### Architectural Patterns or Design Principles
- Modularity: The separation of concerns is evident as each module (agents, tasks, events, tools, visualizer) has a focused responsibility.
- Multi-Agent System Pattern: Emphasize that specialized agents are working in parallel or cooperation to perform distinct parts of the research workflow.
- Event-Driven Architecture: The event_system.py implies loosely coupled interactions by watching for and triggering events.
- Localized AI Processing: The design uses local inference (Ollama) which supports privacy and configurable resource management.

##### Relevant Technologies, Frameworks, and Libraries
- Python (primary programming language)
- Gradio for the interactive research visualization interface
- Ollama for local AI model inference configured via .env
- Possibly additional dependencies specified in requirements.txt that may include standard libraries or additional packages for networking, data handling, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "User Interface Layer"
        GI["Gradio Interface"]:::uiStyle
    end

    %% Core Processing Layer
    subgraph "Core Processing"
        TM["Task Manager"]:::coreStyle
        subgraph "Agents Module"
            WR["Web Research Specialist"]:::agentStyle
            CA["Content Analyzer"]:::agentStyle
            FC["Fact Checker"]:::agentStyle
        end
        ES["Event System"]:::coreStyle
    end

    %% Utility & External Services
    subgraph "Utility & External Services"
        TT["Tools Module"]:::utilStyle
        AI["Ollama Inference Service"]:::utilStyle
    end

    %% Infrastructure and Configuration
    INF["Infrastructure/Configuration"]:::infraStyle

    %% Connections
    GI -->|"triggers"| TM
    TM -->|"orchestrates"| WR
    TM -->|"orchestrates"| CA
    TM -->|"orchestrates"| FC
    WR -->|"notifies"| ES
    CA -->|"notifies"| ES
    FC -->|"notifies"| ES
    ES -->|"syncs"| TM
    WR -->|"utilizes"| TT
    CA -->|"utilizes"| TT
    FC -->|"utilizes"| TT
    WR -->|"invokes"| AI
    CA -->|"invokes"| AI
    FC -->|"invokes"| AI
    TM -->|"returns results"| GI
    INF -->|"configures"| AI
    INF -->|"configures"| GI

    %% Click Events
    click GI "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/visualizer.py"
    click WR "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/agents.py"
    click CA "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/agents.py"
    click FC "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/agents.py"
    click TM "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/tasks.py"
    click ES "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/event_system.py"
    click TT "https://github.com/h9-tec/crewai-deep-researcher/blob/main/src/tools/browser_tool.py"
    click INF "https://github.com/h9-tec/crewai-deep-researcher/blob/main/requirements.txt"

    %% Styles
    classDef uiStyle fill:#9fdf9f,stroke:#333,stroke-width:2px;
    classDef coreStyle fill:#a6cee3,stroke:#333,stroke-width:2px;
    classDef agentStyle fill:#f7b6d2,stroke:#333,stroke-width:2px;
    classDef utilStyle fill:#ffcc80,stroke:#333,stroke-width:2px;
    classDef infraStyle fill:#d9d9d9,stroke:#333,stroke-width:2px;
```
