# daxeshchaudhary/chatgpt-agent architecture

> Architecture diagram of the GitHub repository daxeshchaudhary/chatgpt-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/daxeshchaudhary/chatgpt-agent
- Repository: https://github.com/daxeshchaudhary/chatgpt-agent

## Overview

AI Learning Studio takes a question from a web interface or command-line entry point, identifies its topic, gathers relevant web material and video recommendations, and builds or reuses a topic-specific retrieval database. It retrieves context to draft and review study notes, then returns the notes with video and image recommendations. The graph follows the sampled pipeline and tool calls; template contents, configuration, and some implementation details were not sampled.

Main entry points: [`pipeline.py`](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/pipeline.py) (Learning Pipeline), [`rag.py`](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/rag.py) (RAG Service), [`tools.py`](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/tools.py) (Research Tools), [`app.py`](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/app.py) (FastAPI App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User Interface"]
  node_browser["Study Studio<br/>[script.js]"]
  node_page["Studio Page<br/>[index.html]"]
end

subgraph group_orchestration["Learning Workflow"]
  node_api["FastAPI App<br/>[app.py]"]
  node_cli["CLI Entry<br/>[main.py]"]
  node_pipeline["Learning Pipeline<br/>[pipeline.py]"]
end

subgraph group_research["Research and Retrieval"]
  node_search["Search Agent<br/>[search_agent.py]"]
  node_content["Content Agent<br/>[content_agent.py]"]
  node_rag["RAG Service<br/>[rag.py]"]
  node_tools["Research Tools<br/>[tools.py]"]
  node_vectordb[("Topic Vector Store")]
end

subgraph group_generation["Teaching and Review"]
  node_teacher["Teaching Agent<br/>[teaching_agent.py]"]
  node_critic["Critic Agent<br/>[critic_agent.py]"]
  node_llmclient["LLM Client<br/>[llm.py]"]
end

subgraph group_integrations["External Services"]
  node_mistral["Mistral API"]
  node_tavily["Tavily Search"]
  node_youtube["YouTube Search"]
  node_embedding["Embedding Model"]
end

node_learner(("Learner"))

node_learner -->|"asks question"| node_browser
node_browser -->|"posts question"| node_api
node_api -->|"renders page"| node_page
node_api -->|"runs workflow"| node_pipeline
node_pipeline -->|"returns results"| node_api
node_api -->|"returns JSON"| node_browser
node_learner -.->|"enters question"| node_cli
node_cli -.->|"runs workflow"| node_pipeline
node_pipeline -->|"identifies topic"| node_teacher
node_pipeline -->|"checks topic store"| node_rag
node_pipeline -->|"searches question"| node_search
node_search -->|"searches web and video"| node_tools
node_tools -.->|"searches web"| node_tavily
node_tools -.->|"searches videos"| node_youtube
node_pipeline -->|"extracts web sources"| node_content
node_content -->|"extracts webpages"| node_tools
node_pipeline -->|"indexes documents"| node_rag
node_rag -->|"creates and persists"| node_vectordb
node_rag -.->|"embeds documents"| node_embedding
node_pipeline -->|"retrieves context"| node_rag
node_rag -->|"loads and searches"| node_vectordb
node_pipeline -->|"drafts and revises notes"| node_teacher
node_pipeline -->|"requests review"| node_critic
node_critic -->|"generates review"| node_llmclient
node_teacher -->|"generates notes"| node_llmclient
node_llmclient -.->|"sends prompts"| node_mistral
node_pipeline -->|"searches topic images"| node_tools
node_tools -.->|"searches images"| node_tavily

click node_browser "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/static/script.js"
click node_page "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/templates/index.html"
click node_api "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/app.py"
click node_cli "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/main.py"
click node_pipeline "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/pipeline.py"
click node_teacher "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/teaching_agent.py"
click node_critic "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/critic_agent.py"
click node_llmclient "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/llm.py"
click node_search "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/search_agent.py"
click node_content "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/content_agent.py"
click node_rag "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/rag.py"
click node_tools "https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/tools.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_browser,node_page toneBlue
class node_api,node_cli,node_pipeline toneAmber
class node_search,node_content,node_rag,node_tools,node_vectordb toneMint
class node_teacher,node_critic,node_llmclient toneRose
class node_mistral,node_tavily,node_youtube,node_embedding,node_learner toneIndigo
```

## Components

### User Interface

- [Study Studio](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/static/script.js): `static/script.js`
- [Studio Page](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/templates/index.html): `templates/index.html`

### Learning Workflow

- [FastAPI App](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/app.py): `app.py`
- [CLI Entry](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/main.py): `main.py`
- [Learning Pipeline](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/pipeline.py): `pipeline.py`

### Research and Retrieval

- [Search Agent](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/search_agent.py): `search_agent.py`
- [Content Agent](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/content_agent.py): `content_agent.py`
- [RAG Service](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/rag.py): `rag.py`
- [Research Tools](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/tools.py): `tools.py`
- **Topic Vector Store**

### Teaching and Review

- [Teaching Agent](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/teaching_agent.py): `teaching_agent.py`
- [Critic Agent](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/critic_agent.py): `critic_agent.py`
- [LLM Client](https://github.com/daxeshchaudhary/chatgpt-agent/blob/main/llm.py): `llm.py`

### External Services

- **Mistral API**
- **Tavily Search**
- **YouTube Search**
- **Embedding Model**

### Other components

- **Learner**

## Connections

- Learner → Study Studio: asks question
- Study Studio → FastAPI App: posts question
- FastAPI App → Studio Page: renders page
- FastAPI App → Learning Pipeline: runs workflow
- Learning Pipeline → FastAPI App: returns results
- FastAPI App → Study Studio: returns JSON
- Learner → CLI Entry: enters question
- CLI Entry → Learning Pipeline: runs workflow
- Learning Pipeline → Teaching Agent: identifies topic
- Learning Pipeline → RAG Service: checks topic store
- Learning Pipeline → Search Agent: searches question
- Search Agent → Research Tools: searches web and video
- Research Tools → Tavily Search: searches web
- Research Tools → YouTube Search: searches videos
- Learning Pipeline → Content Agent: extracts web sources
- Content Agent → Research Tools: extracts webpages
- Learning Pipeline → RAG Service: indexes documents
- RAG Service → Topic Vector Store: creates and persists
- RAG Service → Embedding Model: embeds documents
- Learning Pipeline → RAG Service: retrieves context
- RAG Service → Topic Vector Store: loads and searches
- Learning Pipeline → Teaching Agent: drafts and revises notes
- Learning Pipeline → Critic Agent: requests review
- Critic Agent → LLM Client: generates review
- Teaching Agent → LLM Client: generates notes
- LLM Client → Mistral API: sends prompts
- Learning Pipeline → Research Tools: searches topic images
- Research Tools → Tavily Search: searches images
