# shreyask95/zycus_ai_assignment architecture

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

- Interactive diagram: https://gitdiagram.com/shreyask95/zycus_ai_assignment
- Repository: https://github.com/shreyask95/zycus_ai_assignment

## Overview

This is an employee-facing IT helpdesk assistant with a dashboard for agents. Employees submit messages through the dashboard; the API hands them to a deterministic pipeline that applies identity, rate-limit and safety checks, retrieves approved knowledge, then answers with a citation, refuses, or handles a ticket. The dashboard also exposes conversation, statistics, audit and override features. The sampled source shows the main calls and persistence behavior; dashboard details and some integrations are documented in the README, so those links are cited there.

Main entry points: [`app/pipeline.py`](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/pipeline.py) (Message pipeline), [`app/main.py`](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/main.py) (FastAPI endpoints), [`app/llm.py`](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/llm.py) (Gemini drafting), [`app/retrieval.py`](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/retrieval.py) (KB retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_dashboard["Dashboard<br/>[index.html]"]
  node_api["FastAPI endpoints<br/>[main.py]"]
end

subgraph group_decision["Decision and safety"]
  node_pipeline["Message pipeline<br/>[pipeline.py]"]
  node_guards["Safety guards<br/>[guards.py]"]
  node_config["Runtime rules<br/>[config.yaml]"]
end

subgraph group_answering["Knowledge and response"]
  node_retrieval["KB retrieval<br/>[retrieval.py]"]
  node_kb["Approved articles<br/>[kb.json]"]
  node_llm["Gemini drafting<br/>[llm.py]"]
  node_router["Model failover<br/>[router.py]"]
end

subgraph group_operations["Tickets and records"]
  node_ticketing["Ticket handling<br/>[tickets.py]"]
  node_directory["User and ticket data<br/>[directory.json]"]
  node_store[("Conversation store<br/>[store.py]")]
end

node_employee(("Employee"))
node_agent(("Helpdesk agent"))
node_gemini{{"Google Gemini"}}

node_employee -->|"submits message"| node_dashboard
node_agent -->|"reviews records"| node_dashboard
node_dashboard -->|"uses endpoints"| node_api
node_api -->|"handles chat"| node_pipeline
node_api -->|"reads and overrides"| node_store
node_api -->|"resets tickets"| node_ticketing
node_pipeline -->|"checks and masks"| node_guards
node_pipeline -->|"searches articles"| node_retrieval
node_retrieval -->|"loads articles"| node_kb
node_retrieval -->|"sanitizes content"| node_guards
node_pipeline -->|"requests draft"| node_llm
node_llm -->|"routes model calls"| node_router
node_llm -->|"generates response"| node_gemini
node_pipeline -->|"checks and creates"| node_ticketing
node_pipeline -->|"checks limits; saves"| node_store
node_ticketing -->|"loads initial tickets"| node_directory
node_guards -->|"loads rules"| node_config
node_llm -->|"loads model settings"| node_config

click node_dashboard "https://github.com/shreyask95/zycus_ai_assignment/blob/main/static/index.html"
click node_api "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/main.py"
click node_pipeline "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/pipeline.py"
click node_guards "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/guards.py"
click node_retrieval "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/retrieval.py"
click node_kb "https://github.com/shreyask95/zycus_ai_assignment/blob/main/data/kb.json"
click node_llm "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/llm.py"
click node_router "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/router.py"
click node_ticketing "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/tickets.py"
click node_directory "https://github.com/shreyask95/zycus_ai_assignment/blob/main/data/directory.json"
click node_store "https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/store.py"
click node_config "https://github.com/shreyask95/zycus_ai_assignment/blob/main/config.yaml"

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_dashboard,node_api toneBlue
class node_pipeline,node_guards,node_config toneAmber
class node_retrieval,node_kb,node_llm,node_router toneMint
class node_ticketing,node_directory,node_store toneRose
class node_employee,node_agent,node_gemini toneIndigo
```

## Components

### Web interface

- [Dashboard](https://github.com/shreyask95/zycus_ai_assignment/blob/main/static/index.html): `static/index.html`
- [FastAPI endpoints](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/main.py): `app/main.py`

### Decision and safety

- [Message pipeline](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/pipeline.py): `app/pipeline.py`
- [Safety guards](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/guards.py): `app/guards.py`
- [Runtime rules](https://github.com/shreyask95/zycus_ai_assignment/blob/main/config.yaml): `config.yaml`

### Knowledge and response

- [KB retrieval](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/retrieval.py): `app/retrieval.py`
- [Approved articles](https://github.com/shreyask95/zycus_ai_assignment/blob/main/data/kb.json): `data/kb.json`
- [Gemini drafting](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/llm.py): `app/llm.py`
- [Model failover](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/router.py): `app/router.py`

### Tickets and records

- [Ticket handling](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/tickets.py): `app/tickets.py`
- [User and ticket data](https://github.com/shreyask95/zycus_ai_assignment/blob/main/data/directory.json): `data/directory.json`
- [Conversation store](https://github.com/shreyask95/zycus_ai_assignment/blob/main/app/store.py): `app/store.py`

### Other components

- **Employee**
- **Helpdesk agent**
- **Google Gemini**

## Connections

- Employee → Dashboard: submits message (evidence: `README.md`)
- Helpdesk agent → Dashboard: reviews records (evidence: `README.md`)
- Dashboard → FastAPI endpoints: uses endpoints (evidence: `README.md`)
- FastAPI endpoints → Message pipeline: handles chat (evidence: `app/main.py`)
- FastAPI endpoints → Conversation store: reads and overrides (evidence: `app/main.py`)
- FastAPI endpoints → Ticket handling: resets tickets (evidence: `app/main.py`)
- Message pipeline → Safety guards: checks and masks (evidence: `app/pipeline.py`)
- Message pipeline → KB retrieval: searches articles (evidence: `app/pipeline.py`)
- KB retrieval → Approved articles: loads articles (evidence: `app/retrieval.py`)
- KB retrieval → Safety guards: sanitizes content (evidence: `app/retrieval.py`)
- Message pipeline → Gemini drafting: requests draft (evidence: `app/pipeline.py`)
- Gemini drafting → Model failover: routes model calls (evidence: `app/llm.py`)
- Gemini drafting → Google Gemini: generates response (evidence: `README.md`)
- Message pipeline → Ticket handling: checks and creates (evidence: `app/pipeline.py`)
- Message pipeline → Conversation store: checks limits; saves (evidence: `app/pipeline.py`)
- Ticket handling → User and ticket data: loads initial tickets (evidence: `app/tickets.py`)
- Safety guards → Runtime rules: loads rules (evidence: `app/guards.py`)
- Gemini drafting → Runtime rules: loads model settings (evidence: `app/llm.py`)
