# csallahbakash/enterprise-data-agent architecture

> Architecture diagram of the GitHub repository csallahbakash/enterprise-data-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/csallahbakash/enterprise-data-agent
- Repository: https://github.com/csallahbakash/enterprise-data-agent

## Overview

This is a database-focused AI agent application: users request schema analysis, natural-language querying, Airflow DAG generation, or data-quality checks through a Streamlit UI or REST API. The API dispatches each request to a LangGraph agent; those agents use database introspection, query execution, and, where applicable, Claude to produce results. The README also documents Prometheus monitoring and an evaluation framework. The schema-discovery implementation was not sampled, so its internal wiring is not shown.

Main entry points: [`src/api/routes.py`](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/api/routes.py) (Agent Routes), [`src/core/database.py`](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/core/database.py) (Database Access), [`src/api/main.py`](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/api/main.py) (FastAPI App), [`src/core/llm.py`](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/core/llm.py) (LLM Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_frontend["Streamlit UI<br/>[app.py]"]
  node_api["FastAPI App<br/>[main.py]"]
  node_routes["Agent Routes<br/>[routes.py]"]
end

subgraph group_agents["Agent Workflows"]
  node_schema_agent["Schema Discovery"]
  node_sql_agent["NL-to-SQL<br/>[nl_to_sql.py]"]
  node_pipeline_agent["Pipeline Generator"]
  node_quality_agent["Data Quality<br/>[data_quality.py]"]
  node_pipeline_context["Gather Schema Context"]
  node_dag_generation["Generate DAG"]
  node_dag_explanation["Explain DAG"]
  node_sql_context["Load Schema Context<br/>[nl_to_sql.py]"]
  node_sql_generation["Generate SQL<br/>[nl_to_sql.py]"]
  node_query_execution["Execute Query<br/>[nl_to_sql.py]"]
  node_answer_formatting["Format Answer<br/>[nl_to_sql.py]"]
  node_null_checks["Null Checks<br/>[data_quality.py]"]
  node_duplicate_checks["Duplicate Checks<br/>[data_quality.py]"]
  node_quality_summary["Quality Summary<br/>[data_quality.py]"]
end

subgraph group_core["Data and LLM"]
  node_database["Database Access<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_llm_client["LLM Client<br/>[llm.py]"]
  node_claude["Anthropic Claude"]
end

subgraph group_observability["Evaluation and Monitoring"]
  node_evaluation["Agent Evaluation<br/>[evals.py]"]
  node_metrics["Prometheus Metrics<br/>[metrics.py]"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
end

node_user(("User"))

node_user -->|"uses"| node_frontend
node_user -->|"requests"| node_api
node_frontend -->|"HTTP requests"| node_api
node_api -->|"mounts routes"| node_routes
node_routes -->|"invokes"| node_schema_agent
node_routes -->|"invokes"| node_sql_agent
node_routes -->|"invokes"| node_pipeline_agent
node_routes -->|"invokes"| node_quality_agent
node_sql_agent -->|"starts"| node_sql_context
node_sql_context -->|"passes context"| node_sql_generation
node_sql_generation -->|"passes SQL"| node_query_execution
node_query_execution -->|"passes results"| node_answer_formatting
node_pipeline_agent -->|"starts"| node_pipeline_context
node_pipeline_context -->|"passes schema"| node_dag_generation
node_dag_generation -->|"passes DAG"| node_dag_explanation
node_quality_agent -->|"starts"| node_null_checks
node_null_checks -->|"passes checks"| node_duplicate_checks
node_duplicate_checks -->|"passes checks"| node_quality_summary
node_sql_context -->|"introspects"| node_database
node_query_execution -->|"executes query"| node_database
node_pipeline_context -->|"introspects"| node_database
node_null_checks -->|"checks data"| node_database
node_duplicate_checks -->|"checks data"| node_database
node_database -->|"reads"| node_postgres
node_sql_generation -->|"requests SQL"| node_llm_client
node_answer_formatting -->|"requests answer"| node_llm_client
node_dag_generation -->|"requests DAG"| node_llm_client
node_dag_explanation -->|"requests explanation"| node_llm_client
node_llm_client -->|"invokes"| node_claude
node_routes -->|"records requests"| node_metrics
node_api -.->|"exposes metrics"| node_prometheus
node_prometheus -.->|"scrapes"| node_api
node_evaluation -->|"invokes graph"| node_sql_agent
node_routes -->|"returns results"| node_frontend

click node_frontend "https://github.com/csallahbakash/enterprise-data-agent/blob/master/frontend/app.py"
click node_api "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/api/main.py"
click node_routes "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/api/routes.py"
click node_schema_agent "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/schema_discovery.py"
click node_sql_agent "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py"
click node_pipeline_agent "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py"
click node_quality_agent "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py"
click node_database "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/core/database.py"
click node_llm_client "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/core/llm.py"
click node_pipeline_context "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py"
click node_dag_generation "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py"
click node_dag_explanation "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py"
click node_sql_context "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py"
click node_sql_generation "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py"
click node_query_execution "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py"
click node_answer_formatting "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py"
click node_null_checks "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py"
click node_duplicate_checks "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py"
click node_quality_summary "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py"
click node_evaluation "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/evaluation/evals.py"
click node_metrics "https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/evaluation/metrics.py"
click node_prometheus "https://github.com/csallahbakash/enterprise-data-agent/blob/master/monitoring/prometheus.yml"

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_frontend,node_api,node_routes,node_user toneBlue
class node_schema_agent,node_sql_agent,node_pipeline_agent,node_quality_agent,node_pipeline_context,node_dag_generation,node_dag_explanation,node_sql_context,node_sql_generation,node_query_execution,node_answer_formatting,node_null_checks,node_duplicate_checks,node_quality_summary toneAmber
class node_database,node_postgres,node_llm_client,node_claude toneMint
class node_evaluation,node_metrics,node_prometheus toneRose
```

## Components

### User Interface

- [Streamlit UI](https://github.com/csallahbakash/enterprise-data-agent/blob/master/frontend/app.py): `frontend/app.py`
- [FastAPI App](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/api/main.py): `src/api/main.py`
- [Agent Routes](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/api/routes.py): `src/api/routes.py`

### Agent Workflows

- [Schema Discovery](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/schema_discovery.py): `src/agents/schema_discovery.py`
- [NL-to-SQL](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py): `src/agents/nl_to_sql.py`
- [Pipeline Generator](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py): `src/agents/pipeline_generator.py`
- [Data Quality](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py): `src/agents/data_quality.py`
- [Gather Schema Context](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py): `src/agents/pipeline_generator.py`
- [Generate DAG](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py): `src/agents/pipeline_generator.py`
- [Explain DAG](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/pipeline_generator.py): `src/agents/pipeline_generator.py`
- [Load Schema Context](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py): `src/agents/nl_to_sql.py`
- [Generate SQL](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py): `src/agents/nl_to_sql.py`
- [Execute Query](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py): `src/agents/nl_to_sql.py`
- [Format Answer](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/nl_to_sql.py): `src/agents/nl_to_sql.py`
- [Null Checks](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py): `src/agents/data_quality.py`
- [Duplicate Checks](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py): `src/agents/data_quality.py`
- [Quality Summary](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/agents/data_quality.py): `src/agents/data_quality.py`

### Data and LLM

- [Database Access](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/core/database.py): `src/core/database.py`
- **PostgreSQL**
- [LLM Client](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/core/llm.py): `src/core/llm.py`
- **Anthropic Claude**

### Evaluation and Monitoring

- [Agent Evaluation](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/evaluation/evals.py): `src/evaluation/evals.py`
- [Prometheus Metrics](https://github.com/csallahbakash/enterprise-data-agent/blob/master/src/evaluation/metrics.py): `src/evaluation/metrics.py`
- [Prometheus](https://github.com/csallahbakash/enterprise-data-agent/blob/master/monitoring/prometheus.yml): `monitoring/prometheus.yml`

### Other components

- **User**

## Connections

- User → Streamlit UI: uses
- User → FastAPI App: requests
- Streamlit UI → FastAPI App: HTTP requests
- FastAPI App → Agent Routes: mounts routes
- Agent Routes → Schema Discovery: invokes
- Agent Routes → NL-to-SQL: invokes
- Agent Routes → Pipeline Generator: invokes
- Agent Routes → Data Quality: invokes
- NL-to-SQL → Load Schema Context: starts
- Load Schema Context → Generate SQL: passes context
- Generate SQL → Execute Query: passes SQL
- Execute Query → Format Answer: passes results
- Pipeline Generator → Gather Schema Context: starts
- Gather Schema Context → Generate DAG: passes schema
- Generate DAG → Explain DAG: passes DAG
- Data Quality → Null Checks: starts
- Null Checks → Duplicate Checks: passes checks
- Duplicate Checks → Quality Summary: passes checks
- Load Schema Context → Database Access: introspects
- Execute Query → Database Access: executes query
- Gather Schema Context → Database Access: introspects
- Null Checks → Database Access: checks data
- Duplicate Checks → Database Access: checks data
- Database Access → PostgreSQL: reads
- Generate SQL → LLM Client: requests SQL
- Format Answer → LLM Client: requests answer
- Generate DAG → LLM Client: requests DAG
- Explain DAG → LLM Client: requests explanation
- LLM Client → Anthropic Claude: invokes
- Agent Routes → Prometheus Metrics: records requests
- FastAPI App → Prometheus: exposes metrics
- Prometheus → FastAPI App: scrapes
- Agent Evaluation → NL-to-SQL: invokes graph
- Agent Routes → Streamlit UI: returns results
