# thytu/agentarium architecture

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

- Interactive diagram: https://gitdiagram.com/thytu/agentarium
- Repository: https://github.com/thytu/agentarium

## Overview

##### Main Components Identification

a) Core Components:
- Agent System
- Interaction Management
- Checkpoint System
- Environment Configuration
- Utils/Helper System

##### Component Relationships

a) Central Layer (Core):
- It directly to AgentInteractionManager
- Bidirectional communication between agents

b) Supporting Systems (Outer Layer):
- Environment Configuration System
- Checkpoint Management System
- Utility Services

##### Specific Implementation Details

Use these visual elements:

- Rectangles: Core classes (Agent, Environment)
- Hexagons: Managers (AgentInteractionManager, CheckpointManager)
- Rounded rectangles: Configuration components

- Blue: Core agent components
- Green: Environment-related components
- Orange: Interaction management
- Purple: Checkpoint/storage components
- Gray: Utility services

##### Flow Representation

Key flows:

a) Agent Interactions:
- Direct agent-to-agent communication (talk_to method)
- Agent autonomous actions (act method)

b) State Management:
- Checkpoint saving/loading flows
- Environment configuration loading

##### Detailed Component Breakdown

a) Agent Component:
- Properties (name, state)
- Core methods (talk_to, act)
- Integration points with other components

b) Environment Component:
- Configuration handling
- LLM provider integration
- External service connections

c) Interaction Management:
- Communication protocols
- Message routing
- Action handling

d) Checkpoint System:
- State persistence
- Recovery mechanisms
- Interaction history

##### External Integrations

Include:
- LLM Provider connection (OpenAI)
- External API interactions
- Configuration file handling (YAML)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core
        Agent["Agent System"]
        InteractionMgr["Interaction Manager"]
        InteractionCore["Interaction Core"]
    end

    subgraph Support
        EnvConfig["Environment Config"]
        Config["Configuration"]
        CheckpointMgr["Checkpoint Manager"]
        Utils["Utilities"]
    end

    subgraph External
        LLM["LLM Provider (OpenAI)"]
        YAML["YAML Config Files"]
        CustomActions["Custom Actions"]
        StateExample["State Management"]
        BasicExample["Basic Implementation"]
    end

    %% Core Relationships
    Agent <--> InteractionMgr
    InteractionMgr <--> InteractionCore
    Agent <--> Agent

    %% Support Relationships
    EnvConfig --> Agent
    Config --> EnvConfig
    CheckpointMgr --> Agent
    Utils --> Agent
    Utils --> InteractionMgr
    Utils --> CheckpointMgr

    %% External Relationships
    LLM --> Agent
    YAML --> Config
    CustomActions --> Agent
    StateExample --> CheckpointMgr
    BasicExample --> Agent

    %% Styling
    classDef core fill:#2374ab
    classDef support fill:#48a9a6
    classDef external fill:#e4dfda
    classDef storage fill:#d4b483
    
    class Agent,InteractionMgr,InteractionCore core
    class EnvConfig,Config,CheckpointMgr,Utils support
    class LLM,YAML,CustomActions,StateExample,BasicExample external

    %% Click Events
    click Agent "https://github.com/Thytu/Agentarium/blob/main/agentarium/Agent.py"
    click InteractionMgr "https://github.com/Thytu/Agentarium/blob/main/agentarium/AgentInteractionManager.py"
    click InteractionCore "https://github.com/Thytu/Agentarium/blob/main/agentarium/Interaction.py"
    click EnvConfig "https://github.com/Thytu/Agentarium/blob/main/agentarium/Environment.py"
    click Config "https://github.com/Thytu/Agentarium/blob/main/agentarium/Config.py"
    click CheckpointMgr "https://github.com/Thytu/Agentarium/blob/main/agentarium/CheckpointManager.py"
    click Utils "https://github.com/Thytu/Agentarium/blob/main/agentarium/utils.py"
    click YAML "https://github.com/Thytu/Agentarium/blob/main/examples/1_basic_chat/config.yaml"
    click CustomActions "https://github.com/Thytu/Agentarium/blob/main/examples/3_adding_a_custom_action/demo.py"
    click StateExample "https://github.com/Thytu/Agentarium/blob/main/examples/2_checkpointing/demo.py"
    click BasicExample "https://github.com/Thytu/Agentarium/blob/main/examples/1_basic_chat/demo.py"
```
