# shahzaibkaramat67-coder/topic_pipeline_agent architecture

> Architecture diagram of the GitHub repository shahzaibkaramat67-coder/topic_pipeline_agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shahzaibkaramat67-coder/topic_pipeline_agent
- Repository: https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent

## Overview

This is an interactive article-generation application: a user enters a topic, and the program returns an approved, edited article. The pipeline creates and reviews an outline, writes and reviews an article, then edits and reviews the final version, retrying each stage with feedback when rejected. Each content stage builds a prompt and calls a shared language-model client. The README is empty; the graph follows the sampled code. `json_hendler.py` is imported but unused in the shown pipeline, so no runtime connection is asserted.

Main entry points: [`pipeline.py`](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/pipeline.py) (Article pipeline), [`model.py`](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/model.py) (LLM client), [`main.py`](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/main.py) (Interactive CLI), [`Filnal_prompt.py`](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/Filnal_prompt.py) (Prompt templater)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow"]
  node_main["Interactive CLI<br/>[main.py]"]
  node_pipeline["Article pipeline<br/>[pipeline.py]"]
  node_json_handler["JSON helper<br/>[json_hendler.py]"]
end

subgraph group_content["Content stages"]
  node_outline["Outline creator<br/>[outliner.py]"]
  node_analyzer["Content analyzer<br/>[analyzer.py]"]
  node_writer["Article writer<br/>[writter.py]"]
  node_editor["Article editor<br/>[editer.py]"]
end

subgraph group_ai["Prompt and AI"]
  node_templater["Prompt templater<br/>[Filnal_prompt.py]"]
  node_model["LLM client<br/>[model.py]"]
end

node_user(("User"))
node_llm_service["Configured LLM API"]

node_user -->|"enters topic"| node_main
node_main -->|"runs"| node_pipeline
node_pipeline -->|"creates outline"| node_outline
node_pipeline -->|"checks drafts"| node_analyzer
node_pipeline -->|"writes article"| node_writer
node_pipeline -->|"edits article"| node_editor
node_outline -->|"builds prompt"| node_templater
node_outline -->|"requests completion"| node_model
node_analyzer -->|"builds prompt"| node_templater
node_analyzer -->|"requests completion"| node_model
node_writer -->|"builds prompt"| node_templater
node_writer -->|"requests completion"| node_model
node_editor -->|"builds prompt"| node_templater
node_editor -->|"requests completion"| node_model
node_model -->|"sends completion request"| node_llm_service
node_pipeline -->|"returns final article"| node_main
node_main -->|"prints result"| node_user

click node_main "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/main.py"
click node_pipeline "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/pipeline.py"
click node_json_handler "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/json_hendler.py"
click node_outline "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/outliner.py"
click node_analyzer "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/analyzer.py"
click node_writer "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/writter.py"
click node_editor "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/editer.py"
click node_templater "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/Filnal_prompt.py"
click node_model "https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/model.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_main,node_pipeline,node_json_handler,node_user toneBlue
class node_outline,node_analyzer,node_writer,node_editor toneAmber
class node_templater,node_model,node_llm_service toneMint
```

## Components

### Workflow

- [Interactive CLI](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/main.py): `main.py`
- [Article pipeline](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/pipeline.py): `pipeline.py`
- [JSON helper](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/json_hendler.py): `json_hendler.py`

### Content stages

- [Outline creator](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/outliner.py): `outliner.py`
- [Content analyzer](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/analyzer.py): `analyzer.py`
- [Article writer](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/writter.py): `writter.py`
- [Article editor](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/editer.py): `editer.py`

### Prompt and AI

- [Prompt templater](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/Filnal_prompt.py): `Filnal_prompt.py`
- [LLM client](https://github.com/shahzaibkaramat67-coder/topic_pipeline_agent/blob/main/model.py): `model.py`

### Other components

- **User**
- **Configured LLM API**

## Connections

- User → Interactive CLI: enters topic (evidence: `main.py`)
- Interactive CLI → Article pipeline: runs (evidence: `main.py`)
- Article pipeline → Outline creator: creates outline (evidence: `pipeline.py`)
- Article pipeline → Content analyzer: checks drafts (evidence: `pipeline.py`)
- Article pipeline → Article writer: writes article (evidence: `pipeline.py`)
- Article pipeline → Article editor: edits article (evidence: `pipeline.py`)
- Outline creator → Prompt templater: builds prompt (evidence: `outliner.py`)
- Outline creator → LLM client: requests completion (evidence: `outliner.py`)
- Content analyzer → Prompt templater: builds prompt (evidence: `analyzer.py`)
- Content analyzer → LLM client: requests completion (evidence: `analyzer.py`)
- Article writer → Prompt templater: builds prompt (evidence: `writter.py`)
- Article writer → LLM client: requests completion (evidence: `writter.py`)
- Article editor → Prompt templater: builds prompt (evidence: `editer.py`)
- Article editor → LLM client: requests completion (evidence: `editer.py`)
- LLM client → Configured LLM API: sends completion request (evidence: `model.py`)
- Article pipeline → Interactive CLI: returns final article (evidence: `main.py`)
- Interactive CLI → User: prints result (evidence: `main.py`)
