# gpt-laboratory/codepori architecture

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

- Interactive diagram: https://gitdiagram.com/gpt-laboratory/codepori
- Repository: https://github.com/gpt-laboratory/codepori

## Overview

##### Project Overview
- Project Type & Purpose: CodePori is a large-scale autonomous software development system that uses multiple LLM-based agents to generate, review, verify, and finalize code from a high-level project description. The system automates the entire software development lifecycle.
- Key idea: Modular multi-agent orchestration with specialized agents (developer, finalizer, verification, manager) coordinated by an entry point (main.py) and enhanced via the OpenAI API.

##### And Label Main Components
- Main Controller/Orchestrator: Represented by the main.py file, which acts as the entry point. This component is responsible for starting the workflow, processing the project configuration (e.g., OpenAI API key and project description), and coordinating agent interactions.
- Manager Agent: Depicted as the “Manager Bot” (manager_bot.txt). This component likely oversees the overall process, delegating tasks to other specialized agents and monitoring progress.
- Developer Agents: Represent both dev_1.txt and dev_2.txt as components responsible for initial code generation and creative coding tasks.
- Finalizer Agents: Include finalizer_bot_1.txt and finalizer_bot_2.txt to handle final touches, review improvements, or code optimizations.
- Verification Agent: Represented by verfication_bot.txt, which is dedicated to code testing, error correction, and possibly security vulnerability checks.
- Project Configuration/Input: The project_description.txt file acts as the input for the system’s high-level description, indicating that the project’s details are externally provided and later processed by the system.
- External Service: OpenAI API as an external component that the system relies on. This should be included to show that calls are made for LLM processing.

##### Relationships and Data Flow
- Manager Bot then delegates tasks to specialized agents:

##### Architectural Patterns & Design Principles
- Modularization: Highlight that the system’s tasks are separated into distinct agents, each with a well-defined responsibility.
- Chained Processing/Pipeline: Emphasize that the system follows a sequential or pipeline approach starting from project description ingestion, then code generation, verification, and finalization.
- External Integration: Note that the system is dependent on an external API (OpenAI) and ensure that this external dependency is clearly marked.

## Diagram (Mermaid)

```mermaid
graph TD
    PI["Project Input (project_description.txt)"]
    MC["Main Controller (main.py)"]
    MA["Manager Agent (manager_bot.txt)"]
    
    subgraph "Specialized Agents"
        DA1["Developer Agent 1 (dev_1.txt)"]
        DA2["Developer Agent 2 (dev_2.txt)"]
        VA["Verification Agent (verfication_bot.txt)"]
        FA1["Finalizer Agent 1 (finalizer_bot_1.txt)"]
        FA2["Finalizer Agent 2 (finalizer_bot_2.txt)"]
    end
    
    API["External API (OpenAI)"]
    
    %% Internal orchestration
    PI -->|"reads"| MC
    MC -->|"initiates"| MA
    MA -->|"delegates"| DA1
    MA -->|"delegates"| DA2
    MA -->|"delegates"| VA
    MA -->|"delegates"| FA1
    MA -->|"delegates"| FA2
    
    %% Feedback loops from agents back to Manager
    DA1 -->|"output"| MA
    DA2 -->|"output"| MA
    VA  -->|"output"| MA
    FA1 -->|"output"| MA
    FA2 -->|"output"| MA
    
    %% LLM API interactions for each agent
    DA1 -->|"LLM_call"| API
    API -->|"response"| DA1
    
    DA2 -->|"LLM_call"| API
    API -->|"response"| DA2
    
    VA  -->|"LLM_call"| API
    API -->|"response"| VA
    
    FA1 -->|"LLM_call"| API
    API -->|"response"| FA1
    
    FA2 -->|"LLM_call"| API
    API -->|"response"| FA2

    %% Click Events
    click MC "https://github.com/gpt-laboratory/codepori/blob/main/main.py"
    click MA "https://github.com/gpt-laboratory/codepori/blob/main/manager_bot.txt"
    click DA1 "https://github.com/gpt-laboratory/codepori/blob/main/dev_1.txt"
    click DA2 "https://github.com/gpt-laboratory/codepori/blob/main/dev_2.txt"
    click FA1 "https://github.com/gpt-laboratory/codepori/blob/main/finalizer_bot_1.txt"
    click FA2 "https://github.com/gpt-laboratory/codepori/blob/main/finalizer_bot_2.txt"
    click VA "https://github.com/gpt-laboratory/codepori/blob/main/verfication_bot.txt"
    click PI "https://github.com/gpt-laboratory/codepori/blob/main/project_description.txt"

    %% Styles
    classDef internal fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef api fill:#fff3cd,stroke:#856404,stroke-width:2px,stroke-dasharray: 3 3;
    
    class PI,MC,MA,DA1,DA2,VA,FA1,FA2 internal
    class API api
```
