# blorm-network/zerepy architecture

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

- Interactive diagram: https://gitdiagram.com/blorm-network/zerepy
- Repository: https://github.com/blorm-network/zerepy

## Overview

##### Main Components

a) Core System Components:
- Agent Manager (src/agent.py)
- Connection Manager (src/connection_manager.py)
- CLI Interface (src/cli.py)

b) Connection Providers:
- Social Media Connections (Twitter/Farcaster)
- LLM Providers (OpenAI/Anthropic/EternalAI)
- Echo Chambers Connection

c) Configuration Layer:
- Agent Configurations (agents/*.json)
- Connection Configurations

**[User Interface Layer]**
- ↓
**[Core System Layer]**
- ↓
**[Connection Layer]**
- ↓
**[External Services Layer]**

##### Specific Component Representations

Use the following visual elements:
- Hexagons for external services
- Rounded rectangles for configuration elements

- Blue: Core system components
- Green: External service connections
- Orange: Configuration elements
- Purple: User interface elements

##### Component Relationships

**CLI Interface → Agent Manager → Connection Manager → External Services**
- ↑                    ↑

- Agent Config Files    Connection Configs

##### Detailed Component Breakdown

a) Core Layer:
- Agent Manager as the central component
- It to the Connection Manager
- CLI interface feeding commands to both

b) Connection Layer:
- Social media connections (Twitter, Farcaster)
- LLM providers (OpenAI, Anthropic, EternalAI)
- Base connection class relationship

c) Configuration Layer:
- Agent configuration files
- Connection configuration flow

##### Important Elements to Highlight

- The modular connection system (emphasize extensibility)
- The agent configuration flow
- Task execution pipeline
- Authentication and API key management

##### Additional Notes

- Different component types
- Configuration file formats

##### Implementation Details

- The event loop system (loop_delay from agent configs)
- Task weighting system
- Multiple LLM provider support
- Social media integration points

##### Scale and Detail Level

- Major components and their interactions
- Configuration flow
- External service integration points
- Core functionality paths

This system design should clearly communicate ZerePy's architecture as a modular, extensible framework for deploying AI agents on social media platforms, with emphasis on its flexible connection system and configuration-driven approach.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        CLI["CLI Interface"]:::ui
    end

    subgraph Core
        AM["Agent Manager"]:::core
        CM["Connection Manager"]:::core
    end

    subgraph Configuration
        AC["Agent Configurations"]:::config
        CC["Connection Configurations"]:::config
        EX["Example Config"]:::config
        EA["EternalAI Example"]:::config
        GC["General Config"]:::config
    end

    subgraph "Connection Layer"
        BC["Base Connection"]:::connection
        
        subgraph "Social Media"
            TC["Twitter Connection"]:::social
            FC["Farcaster Connection"]:::social
            EC["Echo Chambers"]:::social
        end

        subgraph "LLM Providers"
            OAI["OpenAI Provider"]:::llm
            ANT["Anthropic Provider"]:::llm
            EAI["EternalAI Provider"]:::llm
        end
    end

    subgraph "External Services"
        TW["Twitter API"]:::external
        FAR["Farcaster Network"]:::external
        ECHO["Echo Chambers API"]:::external
        OAIS["OpenAI Services"]:::external
        ANTS["Anthropic Services"]:::external
        EAIS["EternalAI Services"]:::external
    end

    CLI --> AM
    CLI --> CM
    
    AM --> CM
    AM --> AC
    
    CM --> BC
    
    BC --> TC
    BC --> FC
    BC --> EC
    BC --> OAI
    BC --> ANT
    BC --> EAI
    
    TC --> TW
    FC --> FAR
    EC --> ECHO
    OAI --> OAIS
    ANT --> ANTS
    EAI --> EAIS
    
    AC --> EX
    AC --> EA
    AC --> GC
    
    %% Click Events
    click CLI "https://github.com/blorm-network/ZerePy/blob/main/src/cli.py"
    click AM "https://github.com/blorm-network/ZerePy/blob/main/src/agent.py"
    click CM "https://github.com/blorm-network/ZerePy/blob/main/src/connection_manager.py"
    click BC "https://github.com/blorm-network/ZerePy/blob/main/src/connections/base_connection.py"
    click TC "https://github.com/blorm-network/ZerePy/blob/main/src/connections/twitter_connection.py"
    click FC "https://github.com/blorm-network/ZerePy/blob/main/src/connections/farcaster_connection.py"
    click EC "https://github.com/blorm-network/ZerePy/blob/main/src/connections/echochambers_connection.py"
    click OAI "https://github.com/blorm-network/ZerePy/blob/main/src/connections/openai_connection.py"
    click ANT "https://github.com/blorm-network/ZerePy/blob/main/src/connections/anthropic_connection.py"
    click EAI "https://github.com/blorm-network/ZerePy/blob/main/src/connections/eternalai_connection.py"
    click AC "https://github.com/blorm-network/ZerePy/blob/main/agents/*.json"
    click EX "https://github.com/blorm-network/ZerePy/blob/main/agents/example.json"
    click EA "https://github.com/blorm-network/ZerePy/blob/main/agents/eternalai-example.json"
    click GC "https://github.com/blorm-network/ZerePy/blob/main/agents/general.json"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef ui fill:#9b59b6,stroke:#8e44ad,color:white
    classDef config fill:#e67e22,stroke:#d35400,color:white
    classDef connection fill:#2ecc71,stroke:#27ae60,color:white
    classDef social fill:#1abc9c,stroke:#16a085,color:white
    classDef llm fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["User Interface"]:::ui
        L3["Configuration"]:::config
        L4["Connections"]:::connection
        L5["Social Media"]:::social
        L6["LLM Services"]:::llm
        L7["External APIs"]:::external
    end
```
