# autogluon/autogluon-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/autogluon/autogluon-assistant
- Repository: https://github.com/autogluon/autogluon-assistant

## Overview

##### Project Type & Purpose
- This is a full-stack, multi-agent system (AutoGluon Assistant / MLZero) for end-to-end machine learning automation.
- It provides both a CLI (“mlzero” entry point) and a Streamlit-based Web UI, orchestrating specialized “agents” that generate and execute code via large language models (LLMs) to build ML pipelines with zero human intervention.

##### Top-Level Components
A. Presentation Layer
- CLI (run.py + src/autogluon/assistant/cli/app.py)
- Web UI (src/autogluon/assistant/webui/, Streamlit front-end + lightweight FastAPI backend)
B. Core Orchestrator
- Manager (src/autogluon/assistant/managers/manager.py) – dispatches tasks to agents, tracks progress, coordinates memory modules
C. Agents
- TaskDescriptorAgent
- RetrieverAgent
- DataPerceptionAgent
- ToolSelectorAgent
- CoderAgent / ExecuterAgent
- ErrorAnalyzerAgent
- RerankerAgent
(each under src/autogluon/assistant/agents/)
D. LLM Layer
- BaseChat + factory (llm_factory.py)
- Implementations: OpenAI, AzureOpenAI, Anthropic, AWS Bedrock (src/autogluon/assistant/llm/)
E. Tooling & Knowledge Base
- Tools Registry (src/autogluon/assistant/tools_registry/)
– catalogs, JSON descriptors, tutorials & “condensed_tutorials” for each domain (tabular, multimodal, embedding, timeseries)
- Utility modules (indexing.py, registry.py, utils.py)
F. Execution & Memory
- Dual-memory modules (in Manager / agents’ memory handling)
- Code execution environment (shell scripts invoked by ExecuterAgent)
- LogProcessor (captures stdout/stderr, feeds back to ErrorAnalyzerAgent)
G. Configuration & Logging
- YAML config (default.yaml) & constants
- rich_logging for structured logs
H. External Services & Data Stores
- LLM APIs (AWS Bedrock, OpenAI, Anthropic, Azure)
- Local file system (input dataset folder, generated code, model artifacts)
I. CI & Testing
- GitHub Actions workflows (.github/workflows/*.yml)
- Unit & integration tests (tests/unittests/)
- Release automation (pypi_release.yml, nightly_release.yml)

##### Relationships & Data Flows
- User invokes CLI or opens Web UI → Presentation Layer
- Presentation Layer calls Manager → Manager spins up Agents in sequence
- Agents invoke LLM Layer via LLMFactory → receive prompt completions
- RetrieverAgent & ToolSelectorAgent query Tools Registry for domain-specific snippets & docs
- CoderAgent generates code → ExecuterAgent runs it in the OS shell → LogProcessor collects execution logs
- ErrorAnalyzerAgent examines logs → feeds corrections back into CoderAgent
- RerankerAgent orders candidate solutions → Manager stores to Output folder
- Throughout, Manager uses Memory modules to track context & past interactions
- Final ML solution artifacts (trained models, evaluation reports) are saved locally

##### Architectural Patterns & Principles
- Multi-Agent Orchestration (each agent has single responsibility)
- Factory Pattern for LLM instantiation (llm_factory.py)
- Plugin/Registry Pattern for tools & tutorials
- Separation of Concerns: Presentation vs. Orchestration vs. Execution vs. Storage
- Feedback Loop: code generation ↔ execution feedback ↔ error analysis

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Run["run.py"]:::presentation
        CLIApp["CLI App"]:::presentation
        WebUI["Web UI"]:::presentation
    end

    %% Core Orchestrator
    Manager["Manager"]:::internal

    %% Agents
    subgraph "Agents"
        direction TB
        TD["TaskDescriptorAgent"]:::internal
        RET["RetrieverAgent"]:::internal
        DP["DataPerceptionAgent"]:::internal
        TS["ToolSelectorAgent"]:::internal
        CA["CoderAgent"]:::internal
        EA["ExecuterAgent"]:::internal
        ERR["ErrorAnalyzerAgent"]:::internal
        RR["RerankerAgent"]:::internal
        BaseAgent["BaseAgent & Utils"]:::internal
    end

    %% LLM Layer
    subgraph "LLM Layer"
        direction TB
        Factory["LLMFactory"]:::internal
        BaseChat["BaseChat"]:::internal
        OAI["OpenAI Chat"]:::internal
        AZ["AzureOpenAI Chat"]:::internal
        ANT["Anthropic Chat"]:::internal
        AWS["AWS Bedrock Chat"]:::internal
    end

    %% Tooling & Knowledge Base
    subgraph "Tools Registry"
        direction TB
        RegistryRoot["Registry Root"]:::internal
        IDX["indexing.py"]:::internal
        REG["registry.py"]:::internal
        UT["utils.py"]:::internal
    end

    %% Execution & Memory
    subgraph "Execution & Memory"
        direction TB
        ExecEnv["Execution Environment"]:::internal
        LogProc["LogProcessor"]:::internal
        Memory["Memory Modules"]:::datastore
    end

    %% Configuration & Logging
    subgraph "Configuration & Logging"
        direction TB
        Config["default.yaml"]:::datastore
        Const["constants.py"]:::internal
        Logging["rich_logging.py"]:::internal
    end

    %% External Services & Data Stores
    subgraph "External Services & Data Stores"
        direction TB
        LLMAPIs["LLM APIs"]:::external
        FS["Local File System"]:::datastore
    end

    %% CI & Testing
    subgraph "CI & Testing"
        direction TB
        CIW[".github/workflows"]:::internal
        Tests["tests/unittests"]:::internal
    end

    %% Connections
    Run -->|invokes| Manager
    CLIApp -->|invokes| Manager
    WebUI -->|calls| Manager

    Manager -->|dispatch| TD
    TD -->|prompts| Factory
    TD --> Memory
    Manager --> Memory

    RET -->|queries| RegistryRoot
    RET --> Memory
    Manager --> RET

    DP --> Memory
    Manager --> DP

    TS -->|queries| RegistryRoot
    TS --> Memory
    Manager --> TS

    CA -->|generates code| Factory
    CA --> Memory
    Manager --> CA

    CA -->|sends code| EA
    EA -->|executes in| ExecEnv
    EA -->|sends logs| LogProc
    LogProc -->|reports| ERR

    ERR -->|feedback| CA
    ERR --> Memory
    Manager --> ERR

    Manager -->|orders solutions| RR
    RR -->|saves artifacts| FS

    Factory --> BaseChat
    BaseChat --> OAI
    BaseChat --> AZ
    BaseChat --> ANT
    BaseChat --> AWS
    Factory -->|instantiates| OAI
    Factory -->|instantiates| AZ
    Factory -->|instantiates| ANT
    Factory -->|instantiates| AWS

    RegistryRoot --> IDX
    RegistryRoot --> REG
    RegistryRoot --> UT

    WebUI -->|uses| LogProc

    %% Click Events
    click Run "https://github.com/autogluon/autogluon-assistant/blob/main/run.py"
    click CLIApp "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/cli/app.py"
    click WebUI "https://github.com/autogluon/autogluon-assistant/tree/main/src/autogluon/assistant/webui/"
    click Manager "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/managers/manager.py"
    click TD "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/task_descriptor_agent.py"
    click RET "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/retriever_agent.py"
    click DP "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/data_perception_agent.py"
    click TS "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/tool_selector_agent.py"
    click CA "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/coder_agent.py"
    click EA "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/executer_agent.py"
    click ERR "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/error_analyzer_agent.py"
    click RR "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/reranker_agent.py"
    click BaseAgent "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/base_agent.py"
    click BaseAgent "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/agents/utils.py"
    click Factory "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/llm/llm_factory.py"
    click BaseChat "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/llm/base_chat.py"
    click OAI "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/llm/openai_chat.py"
    click AZ "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/llm/azure_openai_chat.py"
    click ANT "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/llm/anthropic_chat.py"
    click AWS "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/llm/bedrock_chat.py"
    click RegistryRoot "https://github.com/autogluon/autogluon-assistant/tree/main/src/autogluon/assistant/tools_registry/"
    click IDX "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/tools_registry/indexing.py"
    click REG "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/tools_registry/registry.py"
    click UT "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/tools_registry/utils.py"
    click LogProc "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/webui/log_processor.py"
    click Config "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/configs/default.yaml"
    click Const "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/constants.py"
    click Logging "https://github.com/autogluon/autogluon-assistant/blob/main/src/autogluon/assistant/rich_logging.py"
    click CIW "https://github.com/autogluon/autogluon-assistant/tree/main/.github/workflows/"
    click Tests "https://github.com/autogluon/autogluon-assistant/tree/main/tests/unittests/"

    %% Styles
    classDef internal fill:#cce5ff,stroke:#2f6f9f
    classDef datastore fill:#d4edda,stroke:#276749
    classDef external fill:#ffe5b4,stroke:#d97706
    classDef presentation fill:#e2e8f0,stroke:#1e40af,stroke-dasharray: 5 5
```
