# chirayurm21305-byte/production-agentic-rag-course-main architecture

> Architecture diagram of the GitHub repository chirayurm21305-byte/production-agentic-rag-course-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chirayurm21305-byte/production-agentic-rag-course-main
- Repository: https://github.com/chirayurm21305-byte/production-agentic-rag-course-main

## Overview

The repository is an arXiv research-paper curator: scheduled ingestion feeds metadata and parsed paper content into storage and search, while API and chat clients support search and RAG answers. The README also documents adaptive agentic retrieval, tracing, caching, a Gradio interface, and Telegram access. Several of those paths are represented from documented capabilities and the source index; unsampled internals are not expanded into speculative call chains.

Main entry points: [`src/dependencies.py`](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/dependencies.py) (Service dependencies), [`src/services/agents/agentic_rag.py`](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/agents/agentic_rag.py) (Adaptive RAG workflow), [`airflow/dags/arxiv_paper_ingestion.py`](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_paper_ingestion.py) (Airflow workflow), [`src/main.py`](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Paper ingestion"]
  node_airflow["Airflow workflow"]
  node_fetch["Paper fetching<br/>[fetching.py]"]
  node_pdf["PDF parsing"]
  node_report["Ingestion reporting<br/>[reporting.py]"]
end

subgraph group_storage["Storage and indexing"]
  node_indexing["Chunk and index"]
  node_postgres[("PostgreSQL<br/>[postgresql.py]")]
  node_paper_model["Paper metadata<br/>[paper.py]"]
  node_paper_repo["Paper repository<br/>[paper.py]"]
  node_opensearch[("OpenSearch search<br/>[client.py]")]
end

subgraph group_api["API and retrieval"]
  node_api["FastAPI application<br/>[main.py]"]
  node_search_route["Hybrid search API<br/>[hybrid_search.py]"]
  node_ask_route["RAG ask API<br/>[ask.py]"]
  node_dependencies["Service dependencies<br/>[dependencies.py]"]
  node_cache["Response cache<br/>[client.py]"]
end

subgraph group_agent["Agentic answers"]
  node_agent_route["Agentic ask API<br/>[agentic_ask.py]"]
  node_agent["Adaptive RAG workflow<br/>[agentic_rag.py]"]
  node_embedding["Jina embeddings<br/>[jina_client.py]"]
  node_llm["Ollama generation<br/>[client.py]"]
end

subgraph group_clients["User interfaces and observability"]
  node_gradio["Gradio chat<br/>[gradio_app.py]"]
  node_telegram["Telegram bot<br/>[bot.py]"]
  node_langfuse["Tracing<br/>[client.py]"]
end

node_researcher(("Researcher"))
node_arxiv(("arXiv API"))

node_researcher -->|"asks and searches"| node_api
node_api -->|"registers routes"| node_search_route
node_api -->|"registers routes"| node_ask_route
node_api -->|"registers route"| node_agent_route
node_search_route -->|"gets services"| node_dependencies
node_ask_route -->|"gets services"| node_dependencies
node_agent_route -->|"gets agent"| node_dependencies
node_dependencies -->|"constructs service"| node_agent
node_dependencies -->|"provides client"| node_opensearch
node_dependencies -->|"provides client"| node_llm
node_dependencies -->|"provides client"| node_embedding
node_search_route -.->|"searches chunks"| node_opensearch
node_agent -->|"retrieves papers"| node_opensearch
node_agent -->|"generates answers"| node_llm
node_agent -->|"embeds queries"| node_embedding
node_agent -->|"traces workflow"| node_langfuse
node_ask_route -.->|"uses cache"| node_cache
node_researcher -->|"chats through"| node_gradio
node_researcher -->|"chats through"| node_telegram
node_telegram -.->|"offers agentic access"| node_agent
node_airflow -->|"runs fetching"| node_fetch
node_airflow -->|"runs reporting"| node_report
node_airflow -->|"runs indexing"| node_indexing
node_fetch -->|"fetches papers"| node_arxiv
node_fetch -.->|"downloads and parses"| node_pdf
node_indexing -.->|"creates vectors"| node_embedding
node_indexing -->|"writes chunks"| node_opensearch
node_paper_repo -->|"persists records"| node_paper_model
node_paper_model -->|"maps database rows"| node_postgres
node_airflow -->|"initializes database"| node_postgres

click node_airflow "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_paper_ingestion.py"
click node_fetch "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_ingestion/fetching.py"
click node_pdf "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/tree/main/src/services/pdf_parser"
click node_indexing "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/tree/main/src/services/indexing"
click node_postgres "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/db/interfaces/postgresql.py"
click node_paper_model "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/models/paper.py"
click node_paper_repo "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/repositories/paper.py"
click node_opensearch "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/opensearch/client.py"
click node_api "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/main.py"
click node_search_route "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/routers/hybrid_search.py"
click node_ask_route "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/routers/ask.py"
click node_dependencies "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/dependencies.py"
click node_agent_route "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/routers/agentic_ask.py"
click node_agent "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/agents/agentic_rag.py"
click node_embedding "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/embeddings/jina_client.py"
click node_llm "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/ollama/client.py"
click node_cache "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/cache/client.py"
click node_gradio "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/gradio_app.py"
click node_telegram "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/telegram/bot.py"
click node_langfuse "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/langfuse/client.py"
click node_report "https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_ingestion/reporting.py"

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_airflow,node_fetch,node_pdf,node_report toneBlue
class node_indexing,node_postgres,node_paper_model,node_paper_repo,node_opensearch toneAmber
class node_api,node_search_route,node_ask_route,node_dependencies,node_cache,node_arxiv toneMint
class node_agent_route,node_agent,node_embedding,node_llm toneRose
class node_gradio,node_telegram,node_langfuse,node_researcher toneIndigo
```

## Components

### Paper ingestion

- [Airflow workflow](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_paper_ingestion.py): `airflow/dags/arxiv_paper_ingestion.py`
- [Paper fetching](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_ingestion/fetching.py): `airflow/dags/arxiv_ingestion/fetching.py`
- [PDF parsing](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/tree/main/src/services/pdf_parser): `src/services/pdf_parser`
- [Ingestion reporting](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/airflow/dags/arxiv_ingestion/reporting.py): `airflow/dags/arxiv_ingestion/reporting.py`

### Storage and indexing

- [Chunk and index](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/tree/main/src/services/indexing): `src/services/indexing`
- [PostgreSQL](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/db/interfaces/postgresql.py): `src/db/interfaces/postgresql.py`
- [Paper metadata](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/models/paper.py): `src/models/paper.py`
- [Paper repository](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/repositories/paper.py): `src/repositories/paper.py`
- [OpenSearch search](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/opensearch/client.py): `src/services/opensearch/client.py`

### API and retrieval

- [FastAPI application](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/main.py): `src/main.py`
- [Hybrid search API](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/routers/hybrid_search.py): `src/routers/hybrid_search.py`
- [RAG ask API](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/routers/ask.py): `src/routers/ask.py`
- [Service dependencies](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/dependencies.py): `src/dependencies.py`
- [Response cache](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/cache/client.py): `src/services/cache/client.py`

### Agentic answers

- [Agentic ask API](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/routers/agentic_ask.py): `src/routers/agentic_ask.py`
- [Adaptive RAG workflow](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/agents/agentic_rag.py): `src/services/agents/agentic_rag.py`
- [Jina embeddings](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/embeddings/jina_client.py): `src/services/embeddings/jina_client.py`
- [Ollama generation](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/ollama/client.py): `src/services/ollama/client.py`

### User interfaces and observability

- [Gradio chat](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/gradio_app.py): `src/gradio_app.py`
- [Telegram bot](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/telegram/bot.py): `src/services/telegram/bot.py`
- [Tracing](https://github.com/chirayurm21305-byte/production-agentic-rag-course-main/blob/main/src/services/langfuse/client.py): `src/services/langfuse/client.py`

### Other components

- **Researcher**
- **arXiv API**

## Connections

- Researcher → FastAPI application: asks and searches
- FastAPI application → Hybrid search API: registers routes (evidence: `src/main.py`)
- FastAPI application → RAG ask API: registers routes (evidence: `src/main.py`)
- FastAPI application → Agentic ask API: registers route (evidence: `src/main.py`)
- Hybrid search API → Service dependencies: gets services (evidence: `src/routers/hybrid_search.py`)
- RAG ask API → Service dependencies: gets services (evidence: `src/routers/ask.py`)
- Agentic ask API → Service dependencies: gets agent (evidence: `src/routers/agentic_ask.py`)
- Service dependencies → Adaptive RAG workflow: constructs service (evidence: `src/dependencies.py`)
- Service dependencies → OpenSearch search: provides client (evidence: `src/dependencies.py`)
- Service dependencies → Ollama generation: provides client (evidence: `src/dependencies.py`)
- Service dependencies → Jina embeddings: provides client (evidence: `src/dependencies.py`)
- Hybrid search API → OpenSearch search: searches chunks
- Adaptive RAG workflow → OpenSearch search: retrieves papers (evidence: `src/services/agents/agentic_rag.py`)
- Adaptive RAG workflow → Ollama generation: generates answers (evidence: `src/services/agents/agentic_rag.py`)
- Adaptive RAG workflow → Jina embeddings: embeds queries (evidence: `src/services/agents/agentic_rag.py`)
- Adaptive RAG workflow → Tracing: traces workflow (evidence: `src/services/agents/agentic_rag.py`)
- RAG ask API → Response cache: uses cache
- Researcher → Gradio chat: chats through
- Researcher → Telegram bot: chats through
- Telegram bot → Adaptive RAG workflow: offers agentic access
- Airflow workflow → Paper fetching: runs fetching (evidence: `airflow/dags/arxiv_paper_ingestion.py`)
- Airflow workflow → Ingestion reporting: runs reporting (evidence: `airflow/dags/arxiv_paper_ingestion.py`)
- Airflow workflow → Chunk and index: runs indexing (evidence: `airflow/dags/arxiv_paper_ingestion.py`)
- Paper fetching → arXiv API: fetches papers
- Paper fetching → PDF parsing: downloads and parses
- Chunk and index → Jina embeddings: creates vectors
- Chunk and index → OpenSearch search: writes chunks
- Paper repository → Paper metadata: persists records (evidence: `src/repositories/paper.py`)
- Paper metadata → PostgreSQL: maps database rows (evidence: `src/models/paper.py`)
- Airflow workflow → PostgreSQL: initializes database
