# sagnik2503/ipm architecture

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

- Interactive diagram: https://gitdiagram.com/sagnik2503/ipm
- Repository: https://github.com/sagnik2503/ipm

## Overview

##### Project Type and Purpose
- This project is a multi-agent AI application designed to orchestrate several AI agents that collaborate to execute tasks. It makes use of the crewAI framework to enable a dynamic and customizable agent-based system.
- The README clearly explains that agents, defined in configuration files, are used to perform complex tasks such as generating reports. The focus is on modularity – agents have distinct roles, and the system is customizable via various configuration and code files.

##### File Structure
- Top-level files and directories indicate several key components:
- The configuration files in src/ipm/config (agents.yaml and tasks.yaml) contain the definitions for AI agents and their associated tasks.
- The main logic resides in src/ipm/main.py and src/ipm/crew.py, which serve as the entry points for initializing and managing the multi-agent system.
- The src/ipm/tools directory houses additional modules (custom_tool.py, fin.py, serper2.py, serper_news.py) that likely serve as utility or domain-specific tools that agents can use.
- Other files like market_analysis.json and the PDF in the knowledge directory provide supplementary context/information (for instance, market research or project planning).
- The presence of pyproject.toml and uv.lock indicate that the project leverages modern dependency management (UV) and version control for dependencies.

##### Components and Their Relationships
- Main Components:
- Agent Manager / Crew Controller (src/ipm/crew.py, src/ipm/main.py): This encompasses the orchestration code that initializes the system, reads configurations, and manages agent interactions.
- Configuration Layer (src/ipm/config): YAML files that define agent properties and tasks.
- Tool Modules (src/ipm/tools): Library of tools that augment agent capabilities (e.g., custom_tool.py, fin.py, etc.). They can be seen as service modules accessible by agents.
- Support Services: External dependencies and framework support provided by crewAI and UV. These manage package handling and runtime execution.
- Relationships:
- The Crew Controller reads data/settings from the configuration layer to instantiate multiple agents.
- Agents then use functions and utilities from the tool modules to execute their designated tasks.
- The agents interact among themselves (or via the controller) to collaboratively address complex tasks.
- The data flow starts from configuration setups, passes through agent instantiation, and finally ends with output generation (e.g., the report.md file).

##### Important Architectural Patterns and Design Principles
- Modularity: Separation of concerns by splitting the configuration, orchestration logic, and tools.
- Extensibility: Clearly defined configuration files and tool modules allow new agents or capabilities to be added with minimal friction.
- Dependency Management: Use of UV for dependency handling ensures that external libraries and frameworks are managed cleanly.
- Collaborative Workflow: The multi-agent system design implies a pattern where multiple independent components (agents) work together to achieve a common goal.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration Manager
    subgraph "Configuration Manager"
        agents["agents.yaml"]:::config
        tasks["tasks.yaml"]:::config
    end

    %% Crew Controller
    subgraph "Crew Controller"
        crew1["crew.py"]:::controller
        main1["main.py"]:::controller
    end

    %% Tools Module
    subgraph "Tools Module"
        custom["custom_tool.py"]:::tools
        fin["fin.py"]:::tools
        serper2["serper2.py"]:::tools
        serper_news["serper_news.py"]:::tools
    end

    %% Dependency Management
    dep["uv.lock"]:::dependency

    %% Relationships
    agents -->|"feeds"| crew1
    tasks -->|"feeds"| main1

    crew1 -->|"utilizes"| custom
    crew1 -->|"utilizes"| serper2
    main1 -->|"utilizes"| fin
    main1 -->|"utilizes"| serper_news

    dep -->|"manages"| crew1
    dep -->|"manages"| main1
    dep -->|"manages"| custom
    dep -->|"manages"| fin
    dep -->|"manages"| serper2
    dep -->|"manages"| serper_news

    %% Click Events
    click agents "https://github.com/sagnik2503/ipm/blob/main/src/ipm/config/agents.yaml"
    click tasks "https://github.com/sagnik2503/ipm/blob/main/src/ipm/config/tasks.yaml"
    click crew1 "https://github.com/sagnik2503/ipm/blob/main/src/ipm/crew.py"
    click main1 "https://github.com/sagnik2503/ipm/blob/main/src/ipm/main.py"
    click custom "https://github.com/sagnik2503/ipm/blob/main/src/ipm/tools/custom_tool.py"
    click fin "https://github.com/sagnik2503/ipm/blob/main/src/ipm/tools/fin.py"
    click serper2 "https://github.com/sagnik2503/ipm/blob/main/src/ipm/tools/serper2.py"
    click serper_news "https://github.com/sagnik2503/ipm/blob/main/src/ipm/tools/serper_news.py"
    click dep "https://github.com/sagnik2503/ipm/blob/main/uv.lock"

    %% Styles
    classDef config fill:#f9c,stroke:#333,stroke-width:2px;
    classDef controller fill:#bbf,stroke:#333,stroke-width:2px;
    classDef tools fill:#cfc,stroke:#333,stroke-width:2px;
    classDef dependency fill:#fcc,stroke:#333,stroke-width:2px;
```
