# divyansh1508/free-auto-gpt architecture

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

- Interactive diagram: https://gitdiagram.com/divyansh1508/free-auto-gpt
- Repository: https://github.com/divyansh1508/free-auto-gpt

## Overview

##### Project Type & Purpose
- This is an open-source Python tool/library for running “autonomous AI agents” (AutoGPT, BabyAGI, CAMEL, custom agents) without paid APIs.
- It provides:
- Free LLM wrappers (ChatGPT, HuggingChat, BingChat, BardChat) under FreeLLM/ and hfAgent/
- Embedding support via HuggingFaceEmbedding
- Agent implementations (AutoGPT.py, BABYAGI.py, Camel.py, TransformersAgent.py, MetaPrompt.py)
- Example/custom agent folder (OtherAgent/) with reusable tools
- Colab notebook entrypoints and VS Code devcontainer

##### File Structure & Architectural Patterns
- Top-level “scripts” (AUTOGPT.py, BABYAGI.py, Camel.py, TransformersAgent.py, MetaPrompt.py) launch specific agent workflows.
- Python packages:
- FreeLLM/ & hfAgent/ → LLM wrappers implementing a common LLM interface for LangChain
- Embedding/ → embedding provider implementation
- BabyAgi/ → modules for task creation, prioritization, execution
- OtherAgent/ → custom agent templates & tools
- Config layer: .env (tokens, cookies), cookiesBing.json
- Dev/CI: .devcontainer/ and .github/ for reproducible containerized dev environment
- Architectural style: modular, plugin-based LangChain agents + tool pattern

##### Key README Insights
- The system reverse-engineers public web-endpoints of ChatGPT, HuggingChat, Bing, Bard to wrap them as LLMs
- Uses LangChain’s agent/tool abstraction to glue LLMs + tools (e.g. WikipediaAPIWrapper, PythonREPL, DuckDuckGoSearchTool)
- Provides zero-shot, BabyAGI, AutoGPT, CAMEL patterns as standalone scripts

a. Main Components
1. User Interface layer
- CLI entrypoint scripts (e.g. AUTOGPT.py)
- Jupyter/Colab notebooks under PlugAndPlayStart/
2. Agent Engine
- Core agent orchestrator (LangChain initialize_agent wrapper)
- BabyAgi modules (task_creation.py, task_prioritization.py, task_execution.py)
3. LLM Abstraction layer
- FreeLLM.* (ChatGPTAPI.py, BingChatAPI.py, BardChatAPI.py, HuggingChatAPI.py)
- hfAgent.FreeLLM/ (alternate wrappers)
4. Embeddings service
- Embedding/HuggingFaceEmbedding.py
5. Tooling modules
- Wikipedia, PythonREPL, DuckDuckGoSearch under OtherAgent/Tool or direct LangChain tools
6. Configuration & Secrets
- .env (environment variables), cookiesBing.json
7. Dev & Deployment
- .devcontainer Dockerfile + compose
- requirements.txt for Python deps

b. Relationships & Data Flow
- User → CLI/Notebook → Agent Engine
- Agent Engine ⇄ LLM Abstraction (HTTP/browser automation to ChatGPT/Bing/Bard/HuggingChat)
- Agent Engine → Embedding Service for similarity-based tasks
- Agent Engine → Tool Modules → External APIs (Wiki, Search) or Python REPL
- LLM responses & tool outputs feed back into Agent Engine, then back to User

c. Architectural Patterns
- Plugin pattern: interchangeable LLM backends & tools
- Agent/Tool pattern from LangChain
- Modular layering: UI, Orchestrator, LLM, Tools, Config

d. Technologies & Frameworks
- Python 3, LangChain
- Browser automation or reverse-engineered endpoints (EdgeGPT, pyChatGPT, hugging-chat-api, Bard)
- Docker/Dev Containers for local development
- Jupyter/Colab for notebooks

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entrypoint Layer
    subgraph "User Interface Layer"
      direction TB
      AUTOGPT["AUTOGPT.py"]:::entry
      BABYAGI["BABYAGI.py"]:::entry
      CAMEL["Camel.py"]:::entry
      TransformersAgent["TransformersAgent.py"]:::entry
      MetaPrompt["MetaPrompt.py"]:::entry
      Notebook["FREE_AUTOGPT.ipynb"]:::entry
      NotebookReadme["README.md"]:::entry
    end

    %% Agent Engine Layer
    subgraph "Agent Engine"
      direction TB
      CoreOrch["Core Orchestrator\n(LangChain initialize_agent)"]:::core
      BabyAGIMod["BabyAGIMod.py"]:::core
      TaskCreate["task_creation.py"]:::core
      TaskPrior["task_prioritization.py"]:::core
      TaskExec["task_execution.py"]:::core
    end

    %% LLM Abstraction Layer
    subgraph "LLM Abstraction"
      direction TB
      ChatGPTAPI["ChatGPTAPI.py"]:::core
      BingChatAPI["BingChatAPI.py"]:::core
      BardChatAPI["BardChatAPI.py"]:::core
      HuggingChatAPI["HuggingChatAPI.py"]:::core
      HFCore["hfAgent/agents.py"]:::core
      HFChatGPT["hfAgent/FreeLLM/ChatGPTAPI.py"]:::core
      HFBing["hfAgent/FreeLLM/BingChatAPI.py"]:::core
      HFBard["hfAgent/FreeLLM/BardChatAPI.py"]:::core
      HFHugging["hfAgent/FreeLLM/HuggingChatAPI.py"]:::core
      OtherChatGPT["OtherAgent/FreeLLM/ChatGPTAPI.py"]:::core
      OtherBing["OtherAgent/FreeLLM/BingChatAPI.py"]:::core
      OtherBard["OtherAgent/FreeLLM/BardChatAPI.py"]:::core
      OtherHugging["OtherAgent/FreeLLM/HuggingChatAPI.py"]:::core
    end

    %% Embedding Service
    subgraph "Embedding Service"
      direction TB
      Embedding["HuggingFaceEmbedding.py"]:::embed
    end

    %% Tooling Modules
    subgraph "Tooling Modules"
      direction TB
      BrowserQA["browserQA.py"]:::tool
      CSVAgent["csvAgent.py"]:::tool
      CustomAgent["customAgent.py"]:::tool
      PythonAgent["pythonAgent.py"]:::tool
      StartupData["startup.csv"]:::tool
    end

    %% Configuration & Secrets
    subgraph "Configuration & Secrets"
      direction TB
      Env[".env"]:::config
      Cookies["cookiesBing.json"]:::config
    end

    %% Dev & Deployment
    subgraph "Dev & Deployment"
      direction TB
      Dockerfile["Dockerfile"]:::dev
      DevContainer["devcontainer.json"]:::dev
      Compose["docker-compose.yml"]:::dev
      FUNDING["FUNDING.yml"]:::dev
      IssueTemplate["issue.md"]:::dev
      Requirements["requirements.txt"]:::dev
    end

    %% External Services
    subgraph "External Services"
      direction TB
      ChatGPTSvc["ChatGPT"]:::external
      BingSvc["BingChat"]:::external
      BardSvc["Bard"]:::external
      HuggingChatSvc["HuggingChat"]:::external
      HFHub["HuggingFace Hub"]:::external
      Wikipedia["Wikipedia API"]:::external
      DuckDuckGo["DuckDuckGo Search"]:::external
    end

    %% Connections
    AUTOGPT -->|runs| CoreOrch
    BABYAGI -->|runs| CoreOrch
    CAMEL -->|runs| CoreOrch
    TransformersAgent -->|runs| CoreOrch
    MetaPrompt -->|runs| CoreOrch
    Notebook -->|runs| CoreOrch
    NotebookReadme -->|guides| Notebook

    CoreOrch -->|uses| BabyAGIMod
    BabyAGIMod --> TaskCreate
    BabyAGIMod --> TaskPrior
    BabyAGIMod --> TaskExec

    CoreOrch -->|calls| ChatGPTAPI
    CoreOrch -->|calls| BingChatAPI
    CoreOrch -->|calls| BardChatAPI
    CoreOrch -->|calls| HuggingChatAPI
    CoreOrch -->|alternatively| HFCore

    HFCore --> HFChatGPT
    HFCore --> HFBing
    HFCore --> HFBard
    HFCore --> HFHugging

    CoreOrch -->|plugins| OtherChatGPT
    CoreOrch --> OtherBing
    CoreOrch --> OtherBard
    CoreOrch --> OtherHugging

    CoreOrch -->|requires| Embedding

    CoreOrch -->|invokes| BrowserQA
    CoreOrch -->|invokes| CSVAgent
    CoreOrch -->|invokes| CustomAgent
    CoreOrch -->|invokes| PythonAgent

    BrowserQA -->|fetches| Wikipedia
    CoreOrch -->|searches| DuckDuckGo

    ChatGPTAPI -->|endpoint| ChatGPTSvc
    BingChatAPI -->|endpoint| BingSvc
    BardChatAPI -->|endpoint| BardSvc
    HuggingChatAPI -->|endpoint| HuggingChatSvc
    Embedding -->|service| HFHub

    Env -->|configures| ChatGPTAPI
    Env -->|configures| BingChatAPI
    Env -->|configures| BardChatAPI
    Env -->|configures| HuggingChatAPI
    Cookies -->|auth| BingChatAPI

    Dockerfile -->|defines| DevContainer
    DevContainer -->|orchestrates| Compose
    FUNDING -->|defines| CI
    IssueTemplate -->|guides| CI
    Requirements -->|deps for| CoreOrch

    %% Click Events
    click AUTOGPT "https://github.com/divyansh1508/free-auto-gpt/blob/main/AUTOGPT.py"
    click BABYAGI "https://github.com/divyansh1508/free-auto-gpt/blob/main/BABYAGI.py"
    click CAMEL "https://github.com/divyansh1508/free-auto-gpt/blob/main/Camel.py"
    click TransformersAgent "https://github.com/divyansh1508/free-auto-gpt/blob/main/TransformersAgent.py"
    click MetaPrompt "https://github.com/divyansh1508/free-auto-gpt/blob/main/MetaPrompt.py"
    click Notebook "https://github.com/divyansh1508/free-auto-gpt/blob/main/PlugAndPlayStart/FREE_AUTOGPT.ipynb"
    click NotebookReadme "https://github.com/divyansh1508/free-auto-gpt/blob/main/PlugAndPlayStart/README.md"
    click BabyAGIMod "https://github.com/divyansh1508/free-auto-gpt/blob/main/BabyAgi/BabyAGIMod.py"
    click TaskCreate "https://github.com/divyansh1508/free-auto-gpt/blob/main/BabyAgi/task_creation.py"
    click TaskPrior "https://github.com/divyansh1508/free-auto-gpt/blob/main/BabyAgi/task_prioritization.py"
    click TaskExec "https://github.com/divyansh1508/free-auto-gpt/blob/main/BabyAgi/task_execution.py"
    click ChatGPTAPI "https://github.com/divyansh1508/free-auto-gpt/blob/main/FreeLLM/ChatGPTAPI.py"
    click BingChatAPI "https://github.com/divyansh1508/free-auto-gpt/blob/main/FreeLLM/BingChatAPI.py"
    click BardChatAPI "https://github.com/divyansh1508/free-auto-gpt/blob/main/FreeLLM/BardChatAPI.py"
    click HuggingChatAPI "https://github.com/divyansh1508/free-auto-gpt/blob/main/FreeLLM/HuggingChatAPI.py"
    click HFCore "https://github.com/divyansh1508/free-auto-gpt/blob/main/hfAgent/agents.py"
    click HFChatGPT "https://github.com/divyansh1508/free-auto-gpt/blob/main/hfAgent/FreeLLM/ChatGPTAPI.py"
    click HFBing "https://github.com/divyansh1508/free-auto-gpt/blob/main/hfAgent/FreeLLM/BingChatAPI.py"
    click HFBard "https://github.com/divyansh1508/free-auto-gpt/blob/main/hfAgent/FreeLLM/BardChatAPI.py"
    click HFHugging "https://github.com/divyansh1508/free-auto-gpt/blob/main/hfAgent/FreeLLM/HuggingChatAPI.py"
    click OtherChatGPT "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/FreeLLM/ChatGPTAPI.py"
    click OtherBing "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/FreeLLM/BingChatAPI.py"
    click OtherBard "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/FreeLLM/BardChatAPI.py"
    click OtherHugging "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/FreeLLM/HuggingChatAPI.py"
    click Embedding "https://github.com/divyansh1508/free-auto-gpt/blob/main/Embedding/HuggingFaceEmbedding.py"
    click BrowserQA "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/Tool/browserQA.py"
    click CSVAgent "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/csvAgent.py"
    click CustomAgent "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/customAgent.py"
    click PythonAgent "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/pythonAgent.py"
    click StartupData "https://github.com/divyansh1508/free-auto-gpt/blob/main/OtherAgent/startup.csv"
    click Env "https://github.com/divyansh1508/free-auto-gpt/blob/main/.env"
    click Cookies "https://github.com/divyansh1508/free-auto-gpt/blob/main/cookiesBing.json"
    click Dockerfile "https://github.com/divyansh1508/free-auto-gpt/tree/main/.devcontainer/Dockerfile"
    click DevContainer "https://github.com/divyansh1508/free-auto-gpt/blob/main/.devcontainer/devcontainer.json"
    click Compose "https://github.com/divyansh1508/free-auto-gpt/blob/main/.devcontainer/docker-compose.yml"
    click FUNDING "https://github.com/divyansh1508/free-auto-gpt/blob/main/.github/FUNDING.yml"
    click IssueTemplate "https://github.com/divyansh1508/free-auto-gpt/blob/main/.github/ISSUE_TEMPLATE/issue.md"
    click Requirements "https://github.com/divyansh1508/free-auto-gpt/blob/main/requirements.txt"

    %% Styles
    classDef entry fill:#D4BFFF,stroke:#333,stroke-width:1px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef embed fill:#FFF2CC,stroke:#333,stroke-width:1px
    classDef tool fill:#A0C4FF,stroke:#333,stroke-width:1px
    classDef config fill:#FFC680,stroke:#333,stroke-width:1px
    classDef dev fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef external fill:#A8E6A3,stroke:#333,stroke-width:1px
```
