# integuru-ai/integuru architecture

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

- Interactive diagram: https://gitdiagram.com/integuru-ai/integuru
- Repository: https://github.com/integuru-ai/integuru

## Overview

##### Main Components

a) Input Processing Layer:
- create_har.py (Browser Network Request Capture)
- Cookie Storage
- User Prompt Interface

b) Core Processing Components:
- Graph Builder Module
- LLM Integration Layer
- DAG Management System
- Agent System

c) Code Generation Layer:
- Integration Code Generator
- Output Handler

##### Component Relationships and Data Flow

**[Input Layer]**
- ↓
**[Processing Layer]**
- ↓
**[Output Layer]**

##### Specific Component Details

a) Input Components (Rectangle, Blue):
- HAR File Processor
- Cookie File Processor
- Prompt Handler

b) Core Processing (Hexagon, Green):
- Graph Builder
- DAG Manager
- Agent State Manager

- OpenAI LLM Integration

d) Output Components (Rectangle, Orange):
- Python Code Generator
- Integration Code Output

##### Key Interactions to Highlight

- Data flow from HAR file to Graph Builder
- Graph Builder to DAG Manager interaction
- LLM consultation flow
- Agent state transitions
- Code generation pipeline

##### Technical Details

Annotations for:
- File formats (.har, .json)
- LLM models used (GPT-4o, o1-preview)
- Python dependencies
- Authentication flow

##### Specific Implementation Notes

- The modular structure reflected in the /integuru directory
- The separation between util functions and core processing
- The model management system
- Testing infrastructure

**[Browser Capture] → [HAR File] → [Cookie Storage]**
- ↓
**[Input Processing Layer]**
- ↓
**[Graph Builder] ←→ [LLM Service]**
- ↓
**[DAG Manager] ←→ [Agent State]**
- ↓
**[Code Generator]**
- ↓
**[Python Integration Code]**

##### Additional Elements

- Component types
- File formats
- External service integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input ["🖥️ Input Interface"]
        BC["🌐 Browser Capture"]
        HAR["📁 HAR File"]
        CS["🔑 Cookie Storage"]
        UI["👤 User Interface"]:::clickable
        BC --> HAR
        HAR --> CS
        UI --> HAR
    end

    subgraph Processing ["⚙️ Processing"]
        HP["📊 HAR Processing"]
        GB["🔄 Graph Builder"]
        DAG["📈 DAG Management"]
        AS["🤖 Agent System"]
        ASM["💾 State Manager"]
        RM["📝 Request Model"]
        LLM["🧠 LLM Integration"]
        
        HP --> GB
        GB <--> DAG
        DAG <--> AS
        AS <--> ASM
        AS <--> RM
        GB <--> LLM
        AS <--> LLM
    end

    subgraph Output ["📤 Output"]
        CG["💻 Code Generator"]
        OF["✨ Output Formatting"]
        IC["📦 Integration Code"]
        
        CG --> OF
        OF --> IC
    end

    subgraph Core ["🎯 Core"]
        MA["⚡ Main Flow"]
        CLI["🖲️ Command Line"]
        
        MA --> CLI
    end

    Input --> Processing
    Processing --> Output
    Core --> Input
    Core --> Processing
    Core --> Output

    click BC "https://github.com/Integuru-AI/Integuru/blob/main/create_har.py"
    click HP "https://github.com/Integuru-AI/Integuru/blob/main/integuru/util/har_processing.py"
    click GB "https://github.com/Integuru-AI/Integuru/blob/main/integuru/graph_builder.py"
    click DAG "https://github.com/Integuru-AI/Integuru/blob/main/integuru/models/DAGManager.py"
    click AS "https://github.com/Integuru-AI/Integuru/blob/main/integuru/agent.py"
    click LLM "https://github.com/Integuru-AI/Integuru/blob/main/integuru/util/LLM.py"
    click ASM "https://github.com/Integuru-AI/Integuru/blob/main/integuru/models/agent_state.py"
    click RM "https://github.com/Integuru-AI/Integuru/blob/main/integuru/models/request.py"
    click MA "https://github.com/Integuru-AI/Integuru/blob/main/integuru/main.py"
    click CLI "https://github.com/Integuru-AI/Integuru/blob/main/integuru/__main__.py"
    click OF "https://github.com/Integuru-AI/Integuru/blob/main/integuru/util/print.py"

    classDef input fill:#a8d1ff,stroke:#333,stroke-width:2px,rx:10
    classDef processing fill:#90EE90,stroke:#333,stroke-width:2px,rx:10
    classDef output fill:#FFB347,stroke:#333,stroke-width:2px,rx:10
    classDef core fill:#DDA0DD,stroke:#333,stroke-width:2px,rx:10
    classDef clickable cursor:pointer
    
    class BC,HAR,CS,UI input
    class HP,GB,DAG,AS,ASM,RM,LLM processing
    class CG,OF,IC output
    class MA,CLI core

    subgraph Legend ["🎨 Legend"]
        L1["🖥️ Input"]:::input
        L2["⚙️ Processing"]:::processing
        L3["📤 Output"]:::output
        L4["🎯 Core"]:::core
    end
```
