# suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool architecture

> Architecture diagram of the GitHub repository suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool, 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/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool
- Repository: https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool

## Overview

This is a customer-support automation service with a Streamlit control desk and FastAPI backend. The principal workflow submits a ticket message, retrieves local knowledge, infers intent and confidence, drafts a response, updates the ticket, optionally emails the customer, and records an event for history and analytics. The README also describes a LangChain/AI prompt pipeline, but the sampled agent implementation shows local intent and reply logic; the graph therefore does not claim a model-provider call. The queue worker is only a Redis connectivity placeholder. Edges reflect the sampled routes and services; unsampled details are omitted.

Main entry points: [`app/api/routes.py`](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/api/routes.py) (API routes), [`app/main.py`](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/main.py) (FastAPI app), [`app/services/history.py`](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/history.py) (History service), [`frontend/streamlit_app.py`](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/frontend/streamlit_app.py) (Streamlit desk)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interfaces"]
  node_frontend["Streamlit desk<br/>[streamlit_app.py]"]
end

subgraph group_api["API and controls"]
  node_server["FastAPI app<br/>[main.py]"]
  node_routes["API routes<br/>[routes.py]"]
  node_settings["Settings<br/>[config.py]"]
end

subgraph group_workflow["Support workflow"]
  node_agent["Support agent<br/>[agent.py]"]
  node_retriever["KB retriever<br/>[retriever.py]"]
  node_knowledge["Local KB files"]
  node_ticket_adapter["Ticket adapter<br/>[ticket_adapter.py]"]
  node_email_adapter["Email adapter<br/>[email_adapter.py]"]
end

subgraph group_records["History and analytics"]
  node_history["History service<br/>[history.py]"]
  node_event_model["Ticket event model<br/>[ticket_event.py]"]
  node_persistence["Database service<br/>[persistence.py]"]
end

node_operator(("Support operator"))
node_zendesk["Zendesk"]
node_gmail["Gmail"]
node_postgres[("PostgreSQL")]

node_operator -->|"submits tickets"| node_frontend
node_frontend -->|"calls API"| node_server
node_server -->|"loads config"| node_settings
node_server -->|"initializes database"| node_persistence
node_server -->|"dispatches requests"| node_routes
node_routes -->|"processes message"| node_agent
node_agent -->|"searches knowledge"| node_retriever
node_retriever -->|"reads documents"| node_knowledge
node_routes -->|"updates ticket"| node_ticket_adapter
node_ticket_adapter -.->|"searches or updates"| node_zendesk
node_routes -.->|"optionally sends email"| node_email_adapter
node_email_adapter -.->|"sends message"| node_gmail
node_routes -->|"schedules event save"| node_history
node_routes -->|"loads history or analytics"| node_history
node_history -->|"reads and writes events"| node_event_model
node_history -->|"opens sessions"| node_persistence
node_persistence -->|"reads and writes"| node_postgres
node_frontend -->|"requests history and analytics"| node_routes

click node_frontend "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/frontend/streamlit_app.py"
click node_server "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/main.py"
click node_routes "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/api/routes.py"
click node_settings "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/core/config.py"
click node_agent "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/agent.py"
click node_retriever "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/retriever.py"
click node_knowledge "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/tree/main/data/kb"
click node_ticket_adapter "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/adapters/ticket_adapter.py"
click node_email_adapter "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/adapters/email_adapter.py"
click node_history "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/history.py"
click node_event_model "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/models/ticket_event.py"
click node_persistence "https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/persistence.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_frontend toneBlue
class node_server,node_routes,node_settings,node_postgres toneAmber
class node_agent,node_retriever,node_knowledge,node_ticket_adapter,node_email_adapter toneMint
class node_history,node_event_model,node_persistence toneRose
class node_operator,node_zendesk,node_gmail toneIndigo
```

## Components

### User interfaces

- [Streamlit desk](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/frontend/streamlit_app.py): `frontend/streamlit_app.py`

### API and controls

- [FastAPI app](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/main.py): `app/main.py`
- [API routes](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/api/routes.py): `app/api/routes.py`
- [Settings](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/core/config.py): `app/core/config.py`

### Support workflow

- [Support agent](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/agent.py): `app/services/agent.py`
- [KB retriever](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/retriever.py): `app/services/retriever.py`
- [Local KB files](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/tree/main/data/kb): `data/kb`
- [Ticket adapter](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/adapters/ticket_adapter.py): `app/adapters/ticket_adapter.py`
- [Email adapter](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/adapters/email_adapter.py): `app/adapters/email_adapter.py`

### History and analytics

- [History service](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/history.py): `app/services/history.py`
- [Ticket event model](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/models/ticket_event.py): `app/models/ticket_event.py`
- [Database service](https://github.com/suksham11/agentic-ai-automation-automatic-mailing-ticketing-tool/blob/main/app/services/persistence.py): `app/services/persistence.py`

### Other components

- **Support operator**
- **Zendesk**
- **Gmail**
- **PostgreSQL**

## Connections

- Support operator → Streamlit desk: submits tickets
- Streamlit desk → FastAPI app: calls API
- FastAPI app → Settings: loads config
- FastAPI app → Database service: initializes database
- FastAPI app → API routes: dispatches requests
- API routes → Support agent: processes message
- Support agent → KB retriever: searches knowledge
- KB retriever → Local KB files: reads documents
- API routes → Ticket adapter: updates ticket
- Ticket adapter → Zendesk: searches or updates
- API routes → Email adapter: optionally sends email
- Email adapter → Gmail: sends message
- API routes → History service: schedules event save
- API routes → History service: loads history or analytics
- History service → Ticket event model: reads and writes events
- History service → Database service: opens sessions
- Database service → PostgreSQL: reads and writes
- Streamlit desk → API routes: requests history and analytics
