How kaizer-1/genai-agent-driven-etl-pipeline works
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: main.py Main · agent.py Agent · orchestrator.py Orchestrator · extract.py Extract
Components 11
Runtime
Top-level entrypoint and operational artifacts for the single-process pipeline.
Agent
LLM planning layer that proposes transformation steps.
- Agent · Inspects input schema/sample and produces an ordered ETL plan.
src/agent/agent.py
ETL
Deterministic extraction, orchestration, transformation, and loading layer.
- Orchestrator · Executes the chosen transformation plan in a deterministic order.
src/etl/orchestrator.py - Extract · Reads source CSV input into the pipeline.
src/etl/extract.py - Transforms · Holds schema inference, cleaning, standardization, validation, and feature work.
src/etl/transformations.py - SQL Loader · Persists processed rows into SQLite.
src/etl/sql_loader.py
Persistence
Local database contract for persisted outputs.
- Schema · Defines the SQLite schema used by the loader.
src/db/schema.sql
Utilities
Shared support functions used across the pipeline.
- Helpers · Cross-cutting utility functions for ETL support.
src/utils/helpers.py
Connections 14
- 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.