# nahidbrur/multi-agent-competitor-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/nahidbrur/multi-agent-competitor-analysis
- Repository: https://github.com/nahidbrur/multi-agent-competitor-analysis

## Overview

##### Project type and purpose
- This is a full-stack Python application for multi-agent competitor analysis.
- It coordinates multiple “agents” (via Crewai), calls a local LLM (Ollama/Llama 3.1 8B), and external search APIs (SerperDevTool) to fetch, analyze, and present insights.
- It exposes both a CLI (test.py) and a Streamlit-based web UI (app.py).

##### File structure
- Top-level
- requirements.txt – Python dependencies
- README.md – project overview, setup, and architecture notes
- src/
- app.py – Streamlit frontend and request handler
- crew.py – agent orchestration layer using Crewai
- test.py – CLI entry point for quick queries
- config/
– agents.yaml – agent role definitions and parameters
– tasks.yaml – workflows and task sequences
- .env (not shown) – environment variables (SERPER_API_KEY, OpenAI credentials)

##### README for additional insights
- Multi-agent orchestration via Crewai
- LLM integration (Ollama or OpenAI)
- External web search tool (SerperDevTool) for data aggregation
- CLI and Streamlit interfaces

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interfaces
    subgraph "User Interfaces"
        UI1["Streamlit Web App"]:::ui
        UI2["CLI Tool"]:::ui
    end

    %% Orchestration Layer
    subgraph "Orchestration Layer"
        Orchestrator["Crewai Orchestrator"]:::orchestration
    end

    %% Configuration Store
    subgraph "Configuration Store"
        Agents["agents.yaml"]:::config
        Tasks["tasks.yaml"]:::config
    end

    %% Environment Variables
    Env[".env (Env Vars)"]:::config

    %% External & LLM Services
    subgraph "Services"
        LLM["Ollama LLM Service"]:::external
        API["SerperDevTool API"]:::external
    end

    %% Data Flows
    UI1 -->|submits query| Orchestrator
    UI2 -->|submits query| Orchestrator

    Agents -->|loaded by| Orchestrator
    Tasks -->|loaded by| Orchestrator
    Env -->|provides creds| Orchestrator
    Env -->|provides creds| LLM
    Env -->|provides creds| API

    Orchestrator -->|calls| LLM
    Orchestrator -->|calls| API
    LLM -->|returns results| Orchestrator
    API -->|returns results| Orchestrator

    Orchestrator -->|aggregates and returns output| UI1
    Orchestrator -->|aggregates and returns output| UI2

    %% Documentation & Dependencies
    Docs["README.md"]:::docs
    Req["requirements.txt"]:::docs

    %% Legend
    subgraph Legend
        direction TB
        U["UI Components"]:::ui
        O["Orchestration"]:::orchestration
        E["External Services"]:::external
        C["Config Files"]:::config
        D["Docs & Deps"]:::docs
    end

    %% Click Events
    click UI1 "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/src/app.py"
    click UI2 "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/src/test.py"
    click Orchestrator "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/src/crew.py"
    click Agents "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/src/config/agents.yaml"
    click Tasks "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/src/config/tasks.yaml"
    click Docs "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/README.md"
    click Req "https://github.com/nahidbrur/multi-agent-competitor-analysis/blob/main/requirements.txt"

    %% Styles
    classDef ui fill:#D0E7FF,stroke:#08519c,color:#08519c
    classDef orchestration fill:#C6F5C1,stroke:#238b45,color:#238b45
    classDef external fill:#FFD2A6,stroke:#d94801,color:#d94801
    classDef config fill:#FFF7A6,stroke:#b58900,color:#b58900
    classDef docs fill:#EAEAEA,stroke:#6a737d,color:#6a737d
```
