Ecommerce Customer Service
Customer Service Flow with leveling system for integration with an e-commerce
+3
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
ChatInput-larrt[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Input]
style ChatInput-larrt stroke:#a170ff
GoogleGenerativeAIModel-hrflu[Gemini]
style GoogleGenerativeAIModel-hrflu stroke:#a170ff
GoogleGenerativeAIEmbeddings-fnjt0[Google Generative AI Embeddings]
style GoogleGenerativeAIEmbeddings-fnjt0 stroke:#a170ff
APIRequest-78xr1[API Request]
style APIRequest-78xr1 stroke:#a170ff
TelegramMessage-zvrp9[Telegram Message]
style TelegramMessage-zvrp9 stroke:#a170ff
ChatOutput-16z2g[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-16z2g stroke:#a170ff
ChatOutput-0vfib[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output2]
style ChatOutput-0vfib stroke:#a170ff
ChatOutput-7h910[<div><img alt="logo" src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output3]
style ChatOutput-7h910 stroke:#a170ff
GoogleGenerativeAIEmbeddings-mn2ew[Google Generative AI Embeddings2]
style GoogleGenerativeAIEmbeddings-mn2ew stroke:#a170ff
SplitText-xm92m[<div><img alt="logo" src="/_astro/scissors-line-dashed.CajsPhTx.svg" style="height: 20px !important;width: 20px !important"/></div>Split Text]
style SplitText-xm92m stroke:#a170ff
GDriveFilesComponent-q2n9y[<div><img alt="logo" src="/_astro/google_drive.wKmDsV2c.svg" style="height: 20px !important;width: 20px !important"/></div>Google Drive File Manager]
style GDriveFilesComponent-q2n9y stroke:#a170ff
ParseData-dpd2k[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data]
style ParseData-dpd2k stroke:#a170ff
AdvancedAgent-zbpzj[Agent4]
style AdvancedAgent-zbpzj stroke:#a170ff
AdvancedAgent-aazz1[Agent]
style AdvancedAgent-aazz1 stroke:#a170ff
AdvancedAgent-hs2r4[Agent5]
style AdvancedAgent-hs2r4 stroke:#a170ff
ParseData-2g4fn[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data2]
style ParseData-2g4fn stroke:#a170ff
ParseData-mrvuk[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data3]
style ParseData-mrvuk stroke:#a170ff
ParseData-z8755[<div><img alt="logo" src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data4]
style ParseData-z8755 stroke:#a170ff
DeepseekModel-7c7w4[Deepseek2]
style DeepseekModel-7c7w4 stroke:#a170ff
DeepseekModel-juyng[Deepseek3]
style DeepseekModel-juyng stroke:#a170ff
DeepseekModel-ova3h[Deepseek4]
style DeepseekModel-ova3h stroke:#a170ff
SmartRouter-kldld[Agent Router]
style SmartRouter-kldld stroke:#a170ff
RetrieverTool-65vrx[<div><img alt="logo" src="/_astro/langchain-icon.BXtvU_nA.svg" style="height: 20px !important;width: 20px !important"/></div>RetrieverTool]
style RetrieverTool-65vrx stroke:#a170ff
AstraDB-bdkzn[Astra DB]
style AstraDB-bdkzn stroke:#a170ff
AstraDB-xlv27[Astra DB2]
style AstraDB-xlv27 stroke:#a170ff
ParseData-dpd2k -.- SplitText-xm92m
linkStyle 0 stroke:#a170ff
GDriveFilesComponent-q2n9y -.- ParseData-dpd2k
linkStyle 1 stroke:#a170ff
AdvancedAgent-zbpzj -.- ChatOutput-16z2g
linkStyle 2 stroke:#a170ff
AdvancedAgent-aazz1 -.- ChatOutput-7h910
linkStyle 3 stroke:#a170ff
APIRequest-78xr1 -.- AdvancedAgent-aazz1
linkStyle 4 stroke:#a170ff
AdvancedAgent-hs2r4 -.- ChatOutput-0vfib
linkStyle 5 stroke:#a170ff
TelegramMessage-zvrp9 -.- AdvancedAgent-hs2r4
linkStyle 6 stroke:#a170ff
ParseData-2g4fn -.- AdvancedAgent-zbpzj
linkStyle 7 stroke:#a170ff
ParseData-mrvuk -.- AdvancedAgent-aazz1
linkStyle 8 stroke:#a170ff
ParseData-z8755 -.- AdvancedAgent-hs2r4
linkStyle 9 stroke:#a170ff
DeepseekModel-7c7w4 -.- AdvancedAgent-zbpzj
linkStyle 10 stroke:#a170ff
DeepseekModel-juyng -.- AdvancedAgent-aazz1
linkStyle 11 stroke:#a170ff
DeepseekModel-ova3h -.- AdvancedAgent-hs2r4
linkStyle 12 stroke:#a170ff
ChatInput-larrt -.- SmartRouter-kldld
linkStyle 13 stroke:#a170ff
GoogleGenerativeAIModel-hrflu -.- SmartRouter-kldld
linkStyle 14 stroke:#a170ff
SmartRouter-kldld -.- ParseData-2g4fn
linkStyle 15 stroke:#a170ff
SmartRouter-kldld -.- ParseData-mrvuk
linkStyle 16 stroke:#a170ff
SmartRouter-kldld -.- ParseData-z8755
linkStyle 17 stroke:#a170ff
RetrieverTool-65vrx -.- AdvancedAgent-zbpzj
linkStyle 18 stroke:#a170ff
SplitText-xm92m -.- AstraDB-bdkzn
linkStyle 19 stroke:#a170ff
GoogleGenerativeAIEmbeddings-mn2ew -.- AstraDB-bdkzn
linkStyle 20 stroke:#a170ff
AstraDB-xlv27 -.- RetrieverTool-65vrx
linkStyle 21 stroke:#a170ff
GoogleGenerativeAIEmbeddings-fnjt0 -.- AstraDB-xlv27
linkStyle 22 stroke:#a170ff
📄 Ecommerce Customer Service – Automated Query Handling
đź§© Overview
The workflow automates the entire customer‑service experience for an e‑commerce platform.
When a user submits a question in the chat, the system classifies the request into one of three intent levels:
- Level 1 – Information‑only queries (e.g., company background).
- Level 2 – Operational queries (e.g., order status, inventory).
- Level 3 – Escalation queries (e.g., returns, refund requests).
For each intent the system selects the appropriate agent, which either retrieves knowledge from a vector store, calls an external API, or forwards the request to a human employee via Telegram. The final response is displayed back to the user in the chat interface.
⚙️ Main Features
- Intent routing – AI‑powered classifier directs user messages to the correct agent.
- Vector‑based knowledge base – documents are chunked, embedded, and indexed in Astra DB for semantic search.
- LLM integration – Deepseek or Gemini models generate natural‑language answers.
- Dynamic tool usage – Agents call external APIs (order status) or send notifications (Telegram) as needed.
- Multi‑step agent logic – Each agent can perform several actions, including reasoning, retrieval, and tool execution, before delivering a final reply.
- Real‑time chat output – Responses are streamed to the user as they are produced.
🔄 Workflow Steps
| # | Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|---|
| 1 | Google Drive File Manager | Pulls raw documents from Google Drive | File selection / ID | Binary file content |
| 2 | Parse Data (File) | Converts binary file to plain text | File content | Text string |
| 3 | Split Text | Breaks large text into 1 000‑char chunks with 200‑char overlap | Full text | Chunked text array |
| 4 | Google Generative AI Embeddings | Generates high‑dimensional vectors for each chunk | Text chunks | Embedding vectors |
| 5 | Astra DB – Add Documents | Stores embeddings and metadata in a vector store | Embeddings, metadata | Success flag |
| 6 | Astra DB – Base Retriever | Builds a retriever for semantic search | Vector store | Retriever instance |
| 7 | Retrieval Tool | Exposes the retriever as a callable tool | Retriever | Tool object |
| 8 | Deepseek Model (Level 1) | Provides the language model for the Level 1 agent | Model parameters | LLM instance |
| 9 | Deepseek Model (Level 2) | Provides the language model for the Level 2 agent | Model parameters | LLM instance |
| 10 | Deepseek Model (Level 3) | Provides the language model for the Level 3 agent | Model parameters | LLM instance |
| 11 | Chat Input | Receives user messages | Message text | Message object |
| 12 | Smart Router | Classifies message into nivel1, nivel2, or nivel3 |
User message, LLM | Intent output data |
| 13 | Parse Data (Level 1) | Formats intent data for the Level 1 agent | Intent data | Text string |
| 14 | Advanced Agent – Level 1 | Answers using the Retrieval Tool | Prompt, Retrieval Tool, LLM | Text response |
| 15 | Chat Output – Level 1 | Displays Level 1 answer | Response text | Rendered chat message |
| 16 | Parse Data (Level 2) | Formats intent data for the Level 2 agent | Intent data | Text string |
| 17 | API Request | Calls external e‑commerce API (e.g., order status) | URL, headers, body | API response |
| 18 | Advanced Agent – Level 2 | Uses API result to compose answer | Prompt, API response, LLM | Text response |
| 19 | Chat Output – Level 2 | Displays Level 2 answer | Response text | Rendered chat message |
| 20 | Parse Data (Level 3) | Formats intent data for the Level 3 agent | Intent data | Text string |
| 21 | Telegram Message | Sends a notification to a human agent | Message text, chat ID | Telegram API response |
| 22 | Advanced Agent – Level 3 | Calls Telegram tool and confirms escalation | Prompt, Telegram tool, LLM | Confirmation text |
| 23 | Chat Output – Level 3 | Displays Level 3 confirmation | Response text | Rendered chat message |
đź§ Notes
- File loading is performed once at startup; subsequent queries use the pre‑built vector store.
- Retrieval Tool is only required for Level 1 agents; Level 2 agents rely on the external API.
- Deepseek Models are instantiated per intent level; this allows independent tuning and cost control.
- API Request must include a valid authentication token; otherwise the Level 2 agent will return an error message.
- Telegram Message requires the bot token and chat ID to be configured; missing credentials will prevent escalation notifications.
- Intent thresholds are set at 0.7 confidence; lower thresholds can increase routing errors, higher thresholds may miss ambiguous queries.
- Memory handling is disabled in the agents to keep responses stateless; enable if conversational context is needed.
- Streaming is optional; enabling it provides real‑time feedback to the user but increases resource usage.
This documentation summarizes the logical flow, component responsibilities, and key data exchanges within the e‑commerce customer‑service automation pipeline.