# strnad/crewai-studio architecture

> Architecture diagram of the GitHub repository strnad/crewai-studio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/strnad/crewai-studio
- Repository: https://github.com/strnad/crewai-studio

## Overview

##### Main Components

a) Frontend Layer:
- Streamlit Interface (app.py as the entry point)
- User Interface Components for:
- Crew Management
- Agent Configuration
- Task Management
- Tool Integration

b) Core Application Layer:
- Agent Management System (my_agent.py)
- Crew Management System (my_crew.py)
- Task Management System (my_task.py)
- Tool Management System (my_tools.py, custom_tools.py)

c) Database Layer:
- PostgreSQL Integration (db_utils.py)
- Data Models for:
- Agents (pg_agents.py)
- Crews (pg_crews.py)
- Tasks (pg_tasks.py)
- Tools (pg_tools.py)

d) External Services:
- LLM Providers (llms.py):
- OpenAI
- Groq
- Anthropic
- LM Studio

##### Connection and Data Flow

- User interactions → Streamlit Interface
- Streamlit → Core Application Layer
- Core Application ↔ Database Layer
- Core Application ↔ External LLM Services
- Tool Integration paths

##### Additional Elements

- A version indicator
- Configuration dependencies (.env)
- Deployment options (local/RepoCloud)
- Threading capabilities

##### The database integration for persistence

Keep the abstraction level high enough to show the overall architecture while including enough detail to understand the system's core functionality and interactions.

Remember to indicate the asynchronous nature of crew operations and the ability to export crews as standalone applications, as these are key features of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI["Streamlit Interface"]:::frontend
        UI_Crew["Crew Management"]:::frontend
        UI_Agent["Agent Configuration"]:::frontend
        UI_Task["Task Management"]:::frontend
        
        UI --> UI_Crew
        UI --> UI_Agent
        UI --> UI_Task
    end

    subgraph Core
        Agent["Agent Management"]:::core
        Crew["Crew Management"]:::core
        Task["Task Management"]:::core
        Tool["Tools"]:::core
        
        Crew --> Agent
        Crew --> Task
        Task --> Tool
    end

    subgraph Database
        DB[("PostgreSQL")]:::db
        DB_Agents["Agents"]:::db
        DB_Crews["Crews"]:::db
        DB_Tasks["Tasks"]:::db
        
        DB --> DB_Agents
        DB --> DB_Crews
        DB --> DB_Tasks
    end

    subgraph External
        LLM["LLM Provider"]:::external
        OpenAI["OpenAI"]:::external
        Groq["Groq"]:::external
        
        LLM --> OpenAI
        LLM --> Groq
    end

    UI --> Crew
    UI_Crew --> Crew
    UI_Agent --> Agent
    UI_Task --> Task

    Crew --> DB_Crews
    Agent --> DB_Agents
    Task --> DB_Tasks

    Agent --> LLM
    Crew --> LLM

    click UI "https://github.com/strnad/CrewAI-Studio/blob/main/app/app.py"
    click Agent "https://github.com/strnad/CrewAI-Studio/blob/main/app/my_agent.py"
    click Crew "https://github.com/strnad/CrewAI-Studio/blob/main/app/my_crew.py"
    click Task "https://github.com/strnad/CrewAI-Studio/blob/main/app/my_task.py"
    click Tool "https://github.com/strnad/CrewAI-Studio/blob/main/app/my_tools.py"
    click DB_Agents "https://github.com/strnad/CrewAI-Studio/blob/main/app/pg_agents.py"
    click DB_Crews "https://github.com/strnad/CrewAI-Studio/blob/main/app/pg_crews.py"
    click DB_Tasks "https://github.com/strnad/CrewAI-Studio/blob/main/app/pg_tasks.py"
    click LLM "https://github.com/strnad/CrewAI-Studio/blob/main/app/llms.py"

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef db fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
```
