# xuxuew/ecommerce-support-agent architecture

> Architecture diagram of the GitHub repository xuxuew/ecommerce-support-agent, 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/xuxuew/ecommerce-support-agent
- Repository: https://github.com/xuxuew/ecommerce-support-agent

## Overview

This is an e-commerce customer-support and ticket-coordination application. A user enters through Streamlit or the service API; the LangGraph support agent handles policy questions and order, refund, and ticket workflows, then returns a response. The documented product also includes hybrid policy retrieval, conversation checkpointing, and voice input/output. The README documents the major integrations; sampled source confirms selected service, agent, retrieval, and voice relationships. Some business-tool wiring and UI details are unsampled, so those links rely on the README.

Main entry points: [`src/agents/customer_support_agent.py`](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/agents/customer_support_agent.py) (Support agent), [`src/service/service.py`](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/service/service.py) (FastAPI service), [`src/customer_support/rag.py`](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/rag.py) (Hybrid policy RAG), [`src/streamlit_app.py`](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/streamlit_app.py) (Streamlit UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_streamlit["Streamlit UI<br/>[streamlit_app.py]"]
  node_client["HTTP client<br/>[client.py]"]
  node_api["FastAPI service<br/>[service.py]"]
end

subgraph group_orchestration["Agent orchestration"]
  node_agent["Support agent"]
  node_guard["Safety checks<br/>[safeguard.py]"]
  node_schemas["Chat schemas<br/>[schema.py]"]
end

subgraph group_support["Support capabilities"]
  node_policy["Policy rules<br/>[policy.py]"]
  node_rag["Hybrid policy RAG<br/>[rag.py]"]
  node_business_tools["Support tools<br/>[tools.py]"]
end

subgraph group_state["Data and memory"]
  node_orders[("Order and refund data<br/>[mysql_store.py]")]
  node_tickets[("Ticket data<br/>[mysql_store.py]")]
  node_memory[("Conversation checkpoints<br/>[__init__.py]")]
end

subgraph group_integrations["Model and voice"]
  node_model["Language model<br/>[llm.py]"]
  node_voice_manager["Voice UI integration<br/>[manager.py]"]
  node_stt["Speech recognition<br/>[stt.py]"]
  node_tts["Speech synthesis<br/>[tts.py]"]
end

node_user(("Customer"))
node_qwen["Qwen"]
node_embeddings["BGE embeddings"]
node_chroma[("Chroma index")]
node_openai_voice["OpenAI voice providers<br/>[openai_stt.py]"]

node_user -->|"uses"| node_streamlit
node_streamlit -->|"sends requests"| node_client
node_client -->|"invokes or streams"| node_api
node_api -->|"dispatches"| node_agent
node_agent -.->|"checks safety"| node_guard
node_agent -->|"routes requests"| node_business_tools
node_agent -->|"retrieves policies"| node_rag
node_agent -.->|"generates replies"| node_model
node_model -->|"calls"| node_qwen
node_business_tools -->|"queries orders"| node_orders
node_business_tools -->|"creates tickets"| node_tickets
node_rag -->|"loads policies"| node_policy
node_rag -->|"embeds documents"| node_embeddings
node_rag -->|"searches index"| node_chroma
node_api -->|"persists conversations"| node_memory
node_streamlit -->|"uses voice UI"| node_voice_manager
node_voice_manager -->|"transcribes audio"| node_stt
node_voice_manager -->|"generates audio"| node_tts
node_stt -->|"loads provider"| node_openai_voice
node_tts -.->|"loads provider"| node_openai_voice
node_client -->|"serializes messages"| node_schemas
node_api -->|"accepts chat input"| node_schemas

click node_streamlit "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/streamlit_app.py"
click node_client "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/client/client.py"
click node_api "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/service/service.py"
click node_agent "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/agents/customer_support_agent.py"
click node_guard "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/agents/safeguard.py"
click node_policy "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/policy.py"
click node_rag "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/rag.py"
click node_business_tools "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/tools.py"
click node_orders "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/mysql_store.py"
click node_tickets "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/mysql_store.py"
click node_memory "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/memory/__init__.py"
click node_schemas "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/schema/schema.py"
click node_model "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/core/llm.py"
click node_voice_manager "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/manager.py"
click node_stt "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/stt.py"
click node_tts "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/tts.py"
click node_openai_voice "https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/providers/openai_stt.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_streamlit,node_client,node_api toneBlue
class node_agent,node_guard,node_schemas,node_chroma toneAmber
class node_policy,node_rag,node_business_tools toneMint
class node_orders,node_tickets,node_memory toneRose
class node_model,node_voice_manager,node_stt,node_tts,node_user,node_qwen,node_embeddings,node_openai_voice toneIndigo
```

## Components

### User interfaces

- [Streamlit UI](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/streamlit_app.py): `src/streamlit_app.py`
- [HTTP client](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/client/client.py): `src/client/client.py`
- [FastAPI service](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/service/service.py): `src/service/service.py`

### Agent orchestration

- [Support agent](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/agents/customer_support_agent.py): `src/agents/customer_support_agent.py`
- [Safety checks](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/agents/safeguard.py): `src/agents/safeguard.py`
- [Chat schemas](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/schema/schema.py): `src/schema/schema.py`

### Support capabilities

- [Policy rules](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/policy.py): `src/customer_support/policy.py`
- [Hybrid policy RAG](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/rag.py): `src/customer_support/rag.py`
- [Support tools](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/tools.py): `src/customer_support/tools.py`

### Data and memory

- [Order and refund data](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/mysql_store.py): `src/customer_support/mysql_store.py`
- [Ticket data](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/customer_support/mysql_store.py): `src/customer_support/mysql_store.py`
- [Conversation checkpoints](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/memory/__init__.py): `src/memory/__init__.py`

### Model and voice

- [Language model](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/core/llm.py): `src/core/llm.py`
- [Voice UI integration](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/manager.py): `src/voice/manager.py`
- [Speech recognition](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/stt.py): `src/voice/stt.py`
- [Speech synthesis](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/tts.py): `src/voice/tts.py`

### Other components

- **Customer**
- **Qwen**
- **BGE embeddings**
- **Chroma index**
- [OpenAI voice providers](https://github.com/xuxuew/ecommerce-support-agent/blob/main/src/voice/providers/openai_stt.py): `src/voice/providers/openai_stt.py`

## Connections

- Customer → Streamlit UI: uses (evidence: `README.md`)
- Streamlit UI → HTTP client: sends requests (evidence: `src/streamlit_app.py`)
- HTTP client → FastAPI service: invokes or streams (evidence: `src/client/client.py`)
- FastAPI service → Support agent: dispatches (evidence: `src/service/service.py`)
- Support agent → Safety checks: checks safety
- Support agent → Support tools: routes requests (evidence: `src/agents/customer_support_agent.py`)
- Support agent → Hybrid policy RAG: retrieves policies (evidence: `README.md`)
- Support agent → Language model: generates replies
- Language model → Qwen: calls (evidence: `README.md`)
- Support tools → Order and refund data: queries orders (evidence: `README.md`)
- Support tools → Ticket data: creates tickets (evidence: `README.md`)
- Hybrid policy RAG → Policy rules: loads policies (evidence: `src/customer_support/rag.py`)
- Hybrid policy RAG → BGE embeddings: embeds documents (evidence: `README.md`)
- Hybrid policy RAG → Chroma index: searches index (evidence: `src/customer_support/rag.py`)
- FastAPI service → Conversation checkpoints: persists conversations (evidence: `src/service/service.py`)
- Streamlit UI → Voice UI integration: uses voice UI (evidence: `src/streamlit_app.py`)
- Voice UI integration → Speech recognition: transcribes audio (evidence: `src/voice/manager.py`)
- Voice UI integration → Speech synthesis: generates audio (evidence: `src/voice/manager.py`)
- Speech recognition → OpenAI voice providers: loads provider (evidence: `src/voice/stt.py`)
- Speech synthesis → OpenAI voice providers: loads provider
- HTTP client → Chat schemas: serializes messages (evidence: `src/client/client.py`)
- FastAPI service → Chat schemas: accepts chat input (evidence: `src/service/service.py`)
