# ismail-2001/customer-support-ai-employee architecture

> Architecture diagram of the GitHub repository ismail-2001/customer-support-ai-employee, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ismail-2001/customer-support-ai-employee
- Repository: https://github.com/ismail-2001/customer-support-ai-employee

## Overview

cs-agent is a multi-store ecommerce support agent with a review-oriented dashboard and storefront chat. The main workflow is ticket intake, conversation-aware classification and context gathering, grounded response drafting, then guarded delivery or human-approved actions. README capabilities also include knowledge-base sync, subscriptions, return labels, tracing, analytics, ROI, and guided setup. Edges are limited to relationships shown in excerpts, the SOURCE INDEX, or README; unsampled subsystem links are omitted where their caller is not evidenced.

Main entry points: [`api/customer_support.py`](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/customer_support.py) (Ticket workflows), [`api/main.py`](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/main.py) (API service), [`agent/response_engine.py`](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/response_engine.py) (Reply generation), [`agent/support_agent.py`](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/support_agent.py) (Order and policy context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and intake"]
  node_api_server["API service<br/>[main.py]"]
  node_ticket_routes["Ticket workflows"]
  node_chat_routes["Storefront chat<br/>[chat.py]"]
end

subgraph group_agent["Support intelligence"]
  node_classifier["Ticket classification<br/>[classifier.py]"]
  node_context["Order and policy context<br/>[support_agent.py]"]
  node_response["Reply generation<br/>[response_engine.py]"]
  node_conversation["Thread memory<br/>[conversation.py]"]
  node_llm["LLM providers<br/>[llm.py]"]
  node_observability["LLM tracing<br/>[observability.py]"]
  node_automation["Send and escalate<br/>[automation.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_data["Store data"]
  node_knowledge[("Policy and product KB<br/>[knowledge_base.py]")]
  node_product_sync["Catalog sync<br/>[product_sync.py]"]
  node_ticket_store[("Tickets and analytics<br/>[storage.py]")]
  node_store_registry[("Store isolation<br/>[multistore.py]")]
end

subgraph group_integrations["Commerce integrations"]
  node_shopify["Shopify commerce<br/>[shopify.py]"]
  node_gorgias["Gorgias support desk<br/>[gorgias.py]"]
  node_subscriptions["Subscription providers<br/>[subscriptions.py]"]
  node_return_labels["Return labels<br/>[shipengine.py]"]
end

subgraph group_operator["Operator experience"]
  node_dashboard["Operator dashboard<br/>[App.tsx]"]
  node_dashboard_api["Dashboard API client<br/>[api.ts]"]
  node_setup_page["Onboarding wizard<br/>[SetupPage.tsx]"]
  node_widget["Chat widget<br/>[widget.ts]"]
end

node_customer(("Customer"))
node_operator(("Support operator"))

node_customer -->|"sends request"| node_api_server
node_api_server -->|"routes requests"| node_ticket_routes
node_api_server -->|"routes requests"| node_chat_routes
node_ticket_routes -->|"classifies ticket"| node_classifier
node_ticket_routes -->|"gets context"| node_context
node_ticket_routes -->|"requests draft"| node_response
node_response -->|"calls model"| node_llm
node_response -->|"records call"| node_observability
node_response -->|"uses thread"| node_conversation
node_ticket_routes -->|"controls delivery"| node_automation
node_ticket_routes -->|"reads and writes"| node_ticket_store
node_context -.->|"looks up orders"| node_shopify
node_context -->|"retrieves policy"| node_knowledge
node_product_sync -.->|"imports catalog"| node_shopify
node_product_sync -.->|"indexes products"| node_knowledge
node_api_server -->|"scopes stores"| node_store_registry
node_store_registry -->|"selects store data"| node_ticket_store
node_store_registry -->|"selects store KB"| node_knowledge
node_ticket_routes -.->|"syncs tickets"| node_gorgias
node_ticket_routes -.->|"handles approvals"| node_subscriptions
node_ticket_routes -.->|"requests label"| node_return_labels
node_operator -->|"reviews tickets"| node_dashboard
node_dashboard -->|"loads data"| node_dashboard_api
node_dashboard_api -.->|"calls API"| node_api_server
node_dashboard -->|"opens setup"| node_setup_page
node_setup_page -->|"submits setup"| node_dashboard_api
node_customer -->|"chats"| node_widget
node_widget -.->|"streams chat"| node_chat_routes
node_config -->|"configures providers"| node_llm
node_ticket_routes -.->|"serves analytics"| node_ticket_store

click node_api_server "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/main.py"
click node_ticket_routes "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/customer_support.py"
click node_chat_routes "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/chat.py"
click node_classifier "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/classifier.py"
click node_context "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/support_agent.py"
click node_response "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/response_engine.py"
click node_conversation "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/conversation.py"
click node_llm "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/llm.py"
click node_observability "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/observability.py"
click node_automation "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/automation.py"
click node_knowledge "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/knowledge_base.py"
click node_product_sync "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/product_sync.py"
click node_ticket_store "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/storage.py"
click node_store_registry "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/multistore.py"
click node_shopify "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/shopify.py"
click node_gorgias "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/gorgias.py"
click node_subscriptions "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/subscriptions.py"
click node_return_labels "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/shipengine.py"
click node_dashboard "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/App.tsx"
click node_dashboard_api "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/lib/api.ts"
click node_setup_page "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/pages/SetupPage.tsx"
click node_widget "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/widget/widget.ts"
click node_config "https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/config.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_api_server,node_ticket_routes,node_chat_routes toneBlue
class node_classifier,node_context,node_response,node_conversation,node_llm,node_observability,node_automation,node_config toneAmber
class node_knowledge,node_product_sync,node_ticket_store,node_store_registry toneMint
class node_shopify,node_gorgias,node_subscriptions,node_return_labels toneRose
class node_dashboard,node_dashboard_api,node_setup_page,node_widget,node_customer,node_operator toneIndigo
```

## Components

### API and intake

- [API service](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/main.py): `api/main.py`
- [Ticket workflows](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/customer_support.py): `api/customer_support.py`
- [Storefront chat](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/api/chat.py): `api/chat.py`

### Support intelligence

- [Ticket classification](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/classifier.py): `agent/classifier.py`
- [Order and policy context](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/support_agent.py): `agent/support_agent.py`
- [Reply generation](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/response_engine.py): `agent/response_engine.py`
- [Thread memory](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/conversation.py): `agent/conversation.py`
- [LLM providers](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/llm.py): `agent/llm.py`
- [LLM tracing](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/observability.py): `agent/observability.py`
- [Send and escalate](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/automation.py): `agent/automation.py`
- [Runtime configuration](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/config.py): `agent/config.py`

### Store data

- [Policy and product KB](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/knowledge_base.py): `agent/knowledge_base.py`
- [Catalog sync](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/product_sync.py): `agent/product_sync.py`
- [Tickets and analytics](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/storage.py): `agent/storage.py`
- [Store isolation](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/agent/multistore.py): `agent/multistore.py`

### Commerce integrations

- [Shopify commerce](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/shopify.py): `integrations/shopify.py`
- [Gorgias support desk](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/gorgias.py): `integrations/gorgias.py`
- [Subscription providers](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/subscriptions.py): `integrations/subscriptions.py`
- [Return labels](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/integrations/shipengine.py): `integrations/shipengine.py`

### Operator experience

- [Operator dashboard](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Dashboard API client](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/lib/api.ts): `dashboard/src/lib/api.ts`
- [Onboarding wizard](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/pages/SetupPage.tsx): `dashboard/src/pages/SetupPage.tsx`
- [Chat widget](https://github.com/ismail-2001/customer-support-ai-employee/blob/main/dashboard/src/widget/widget.ts): `dashboard/src/widget/widget.ts`

### Other components

- **Customer**
- **Support operator**

## Connections

- Customer → API service: sends request (evidence: `api/main.py`)
- API service → Ticket workflows: routes requests (evidence: `api/main.py`)
- API service → Storefront chat: routes requests (evidence: `api/main.py`)
- Ticket workflows → Ticket classification: classifies ticket (evidence: `api/customer_support.py`)
- Ticket workflows → Order and policy context: gets context (evidence: `api/customer_support.py`)
- Ticket workflows → Reply generation: requests draft (evidence: `api/customer_support.py`)
- Reply generation → LLM providers: calls model (evidence: `agent/response_engine.py`)
- Reply generation → LLM tracing: records call (evidence: `agent/response_engine.py`)
- Reply generation → Thread memory: uses thread (evidence: `agent/response_engine.py`)
- Ticket workflows → Send and escalate: controls delivery (evidence: `agent/automation.py`)
- Ticket workflows → Tickets and analytics: reads and writes (evidence: `agent/storage.py`)
- Order and policy context → Shopify commerce: looks up orders
- Order and policy context → Policy and product KB: retrieves policy (evidence: `agent/knowledge_base.py`)
- Catalog sync → Shopify commerce: imports catalog
- Catalog sync → Policy and product KB: indexes products
- API service → Store isolation: scopes stores (evidence: `api/main.py`)
- Store isolation → Tickets and analytics: selects store data (evidence: `agent/multistore.py`)
- Store isolation → Policy and product KB: selects store KB (evidence: `agent/multistore.py`)
- Ticket workflows → Gorgias support desk: syncs tickets (evidence: `api/customer_support.py`)
- Ticket workflows → Subscription providers: handles approvals (evidence: `api/customer_support.py`)
- Ticket workflows → Return labels: requests label (evidence: `api/customer_support.py`)
- Support operator → Operator dashboard: reviews tickets
- Operator dashboard → Dashboard API client: loads data (evidence: `dashboard/src/App.tsx`)
- Dashboard API client → API service: calls API
- Operator dashboard → Onboarding wizard: opens setup (evidence: `dashboard/src/App.tsx`)
- Onboarding wizard → Dashboard API client: submits setup (evidence: `dashboard/src/pages/SetupPage.tsx`)
- Customer → Chat widget: chats
- Chat widget → Storefront chat: streams chat
- Runtime configuration → LLM providers: configures providers (evidence: `agent/llm.py`)
- Ticket workflows → Tickets and analytics: serves analytics (evidence: `api/customer_support.py`)
