# kaizer-1/genai-agent-driven-etl-pipeline architecture

> Architecture diagram of the GitHub repository kaizer-1/genai-agent-driven-etl-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kaizer-1/genai-agent-driven-etl-pipeline
- Repository: https://github.com/kaizer-1/genai-agent-driven-etl-pipeline

## Overview

1. This repository is a small Python proof-of-concept for an agent-driven ETL pipeline. The core architectural idea is a split between an LLM-based planner and a deterministic ETL runner.

2. The entry point is `src/main.py`. It likely wires together the pipeline end-to-end: read input data, ask the agent for a plan, run the ETL steps, and persist the result.

3. The orchestration boundary lives in `src/etl/orchestrator.py`. This is the execution layer that takes a transformation plan and runs the pipeline in order, rather than letting the agent directly manipulate data.

4. Data extraction is isolated in `src/etl/extract.py`, which reads the source dataset from `src/etl/input.csv` or the sample raw data under `data/raw/mock_data.csv`. This keeps source ingestion separate from transformation logic.

5. The transformation subsystem is concentrated in `src/etl/transformations.py`. From the README, this is where schema inference, flattening, type casting, missing-value handling, standardization, validation, feature engineering, and segmentation are implemented or coordinated.

6. The agent subsystem is `src/agent/agent.py`. Its role is not to execute ETL itself, but to inspect the input schema/sample and produce an ordered plan of transformation steps. The README describes this as LLM-driven planning and reasoning, likely using the Gemini API.

7. Loading is handled by `src/etl/sql_loader.py`, which writes the processed output into SQLite. The database contract is defined in `src/db/schema.sql`, so the persistence layer is explicitly modeled rather than embedded in transformation code.

8. `src/utils/helpers.py` appears to hold shared utility functions used across ETL stages, likely for logging, schema inspection, or data normalization support. This is the main cross-cutting support boundary.

9. The runtime data flow is: CSV input → extract → agent inspects sample/schema → orchestrator executes chosen transformations → SQL loader persists clean rows to SQLite. That is the main pipeline an architecture diagram should emphasize.

10. Operational artifacts are lightweight: `logs/agent.log` captures agent behavior, and the `data/` directory holds sample/raw inputs. There is no evidence of a larger service mesh, message queue, or web layer; the architecture is a single-process Python pipeline with an LLM decision component and a local SQLite sink.

Main entry points: [`src/main.py`](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/main.py) (Main), [`src/agent/agent.py`](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/agent/agent.py) (Agent), [`src/etl/orchestrator.py`](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/orchestrator.py) (Orchestrator), [`src/etl/extract.py`](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/extract.py) (Extract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main["Main<br/>entrypoint<br/>[main.py]"]
  node_agent_log["Agent Log<br/>runtime log<br/>[agent.log]"]
end

subgraph group_agent["Agent"]
  node_agent_core(("Agent<br/>llm planner<br/>[agent.py]"))
end

subgraph group_etl["ETL"]
  node_orchestrator["Orchestrator<br/>pipeline runner<br/>[orchestrator.py]"]
  node_extract["Extract<br/>ingestion<br/>[extract.py]"]
  node_transformations["Transforms<br/>[transformations.py]"]
  node_sql_loader[("SQL Loader<br/>sqlite writer<br/>[sql_loader.py]")]
end

subgraph group_db["Persistence"]
  node_schema["Schema<br/>db contract<br/>[schema.sql]"]
end

subgraph group_utils["Utilities"]
  node_helpers["Helpers<br/>shared utils<br/>[helpers.py]"]
end

subgraph group_data["Data"]
  node_input_csv["Input CSV<br/>sample data<br/>[input.csv]"]
  node_mock_data["Mock Data<br/>raw sample<br/>[mock_data.csv]"]
end

node_main -->|"reads"| node_extract
node_main -->|"plans"| node_agent_core
node_main -->|"runs"| node_orchestrator
node_extract -->|"source"| node_input_csv
node_extract -.->|"fallback"| node_mock_data
node_agent_core -.->|"uses"| node_helpers
node_agent_core -->|"logs"| node_agent_log
node_orchestrator -->|"applies"| node_transformations
node_orchestrator -->|"loads"| node_sql_loader
node_transformations -.->|"uses"| node_helpers
node_transformations -.->|"validates"| node_schema
node_sql_loader -->|"writes to"| node_schema
node_main -->|"persists"| node_sql_loader
node_main -.->|"observes"| node_agent_log

click node_main "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/main.py"
click node_agent_core "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/agent/agent.py"
click node_orchestrator "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/orchestrator.py"
click node_extract "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/extract.py"
click node_transformations "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/transformations.py"
click node_sql_loader "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/sql_loader.py"
click node_schema "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/db/schema.sql"
click node_helpers "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/utils/helpers.py"
click node_input_csv "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/input.csv"
click node_mock_data "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/data/raw/mock_data.csv"
click node_agent_log "https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/logs/agent.log"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_agent_log toneBlue
class node_agent_core toneAmber
class node_orchestrator,node_extract,node_transformations,node_sql_loader toneMint
class node_schema toneRose
class node_helpers toneIndigo
class node_input_csv,node_mock_data toneTeal
```

## Components

### Runtime

Top-level entrypoint and operational artifacts for the single-process pipeline.

- [Main](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/main.py): entrypoint · Wires the end-to-end pipeline together. · `src/main.py`
- [Agent Log](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/logs/agent.log): runtime log · Captures agent behavior and planning traces. · `logs/agent.log`

### Agent

LLM planning layer that proposes transformation steps.

- [Agent](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/agent/agent.py): llm planner · Inspects input schema/sample and produces an ordered ETL plan. · `src/agent/agent.py`

### ETL

Deterministic extraction, orchestration, transformation, and loading layer.

- [Orchestrator](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/orchestrator.py): pipeline runner · Executes the chosen transformation plan in a deterministic order. · `src/etl/orchestrator.py`
- [Extract](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/extract.py): ingestion · Reads source CSV input into the pipeline. · `src/etl/extract.py`
- [Transforms](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/transformations.py): data transforms · Holds schema inference, cleaning, standardization, validation, and feature work. · `src/etl/transformations.py`
- [SQL Loader](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/sql_loader.py): sqlite writer · Persists processed rows into SQLite. · `src/etl/sql_loader.py`

### Persistence

Local database contract for persisted outputs.

- [Schema](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/db/schema.sql): db contract · Defines the SQLite schema used by the loader. · `src/db/schema.sql`

### Utilities

Shared support functions used across the pipeline.

- [Helpers](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/utils/helpers.py): shared utils · Cross-cutting utility functions for ETL support. · `src/utils/helpers.py`

### Data

Sample and raw input files used by the pipeline.

- [Input CSV](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/src/etl/input.csv): sample data · Primary local input dataset used by the ETL flow. · `src/etl/input.csv`
- [Mock Data](https://github.com/kaizer-1/genai-agent-driven-etl-pipeline/blob/main/data/raw/mock_data.csv): raw sample · Raw sample dataset used for local experimentation. · `data/raw/mock_data.csv`

## Connections

- Main → Extract: reads · Main starts the pipeline by loading source data.
- Main → Agent: plans · Main asks the agent to propose the transformation plan.
- Main → Orchestrator: runs · Main hands the plan to the deterministic runner.
- Extract → Input CSV: source · Primary source file consumed by extraction.
- Extract → Mock Data: fallback · Sample raw dataset available for local runs.
- Agent → Helpers: uses · Agent shares support logic for schema/sample handling.
- Agent → Agent Log: logs · Agent behavior is recorded for inspection.
- Orchestrator → Transforms: applies · The runner executes the selected transformation stages.
- Orchestrator → SQL Loader: loads · Completed rows are passed to persistence.
- Transforms → Helpers: uses · Transform steps rely on shared utility functions.
- Transforms → Schema: validates · Transformation output is checked against the database contract.
- SQL Loader → Schema: writes to · Loader persists rows according to the SQLite schema.
- Main → SQL Loader: persists · End-to-end execution ends with local database output.
- Main → Agent Log: observes · Runtime execution makes agent traces available for review.
