# mrzasad/langgraph-superstore-ai-assistant architecture

> Architecture diagram of the GitHub repository mrzasad/langgraph-superstore-ai-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrzasad/langgraph-superstore-ai-assistant
- Repository: https://github.com/mrzasad/langgraph-superstore-ai-assistant

## Overview

This is a Streamlit conversational shopping assistant. A shopper enters a request in the chat; the LangGraph agent consults an LLM, dispatches shopping tools, and returns a response to the UI. Product search, loyalty lookup, price calculation, cart operations, and checkout are distinct capabilities; adding an item pauses for approval before the cart changes. Product and user data are loaded from the repository’s spreadsheet and JSON file. The excerpts show the main graph, data loading, approval flow, and UI; some tool implementations and wiring are documented in the README rather than excerpted.

Main entry points: [`agent.py`](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py) (Tool dispatch), [`llm.py`](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/llm.py) (LLM configuration), [`imtiaz_superstore_products.xlsx`](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/imtiaz_superstore_products.xlsx) (Product spreadsheet), [`users_data.json`](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/users_data.json) (User profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation"]
  node_chat_ui["Chat and sidebar<br/>[agent.py]"]
  node_agent_graph{{"LangGraph agent<br/>[agent.py]"}}
  node_llm_call["LLM call<br/>[agent.py]"]
  node_llm_config["LLM configuration<br/>[llm.py]"]
  node_approval["Approval controls<br/>[agent.py]"]
end

subgraph group_shopping["Shopping capabilities"]
  node_tool_dispatch["Tool dispatch<br/>[agent.py]"]
  node_product_search["Product search<br/>[agent.py]"]
  node_user_lookup["Loyalty lookup<br/>[agent.py]"]
  node_price_calc["Price calculation<br/>[agent.py]"]
  node_cart_add["Add to cart<br/>[agent.py]"]
  node_cart_ops["View and remove<br/>[agent.py]"]
  node_checkout["Checkout response<br/>[agent.py]"]
end

subgraph group_state_data["State and data"]
  node_product_data[("Product spreadsheet")]
  node_user_data[("User profiles<br/>[users_data.json]")]
  node_cart_state[("Session cart<br/>[agent.py]")]
  node_conversation_state[("Conversation checkpoint<br/>[agent.py]")]
end

node_shopper(("Shopper"))
node_groq["Groq model"]

node_shopper -->|"sends request"| node_chat_ui
node_chat_ui -->|"invokes"| node_agent_graph
node_agent_graph -->|"routes to"| node_llm_call
node_llm_call -->|"calls"| node_llm_config
node_llm_config -->|"configures"| node_groq
node_agent_graph -->|"dispatches tools"| node_tool_dispatch
node_tool_dispatch -->|"runs"| node_product_search
node_tool_dispatch -->|"runs"| node_user_lookup
node_tool_dispatch -->|"runs"| node_price_calc
node_tool_dispatch -->|"runs"| node_cart_add
node_tool_dispatch -->|"runs"| node_cart_ops
node_product_search -->|"filters"| node_product_data
node_user_lookup -->|"reads"| node_user_data
node_cart_add -->|"checks stock"| node_product_data
node_cart_add -->|"requests approval"| node_approval
node_approval -->|"resumes"| node_cart_add
node_cart_add -->|"adds item"| node_cart_state
node_cart_ops -->|"reads or updates"| node_cart_state
node_chat_ui -->|"shows controls"| node_approval
node_chat_ui -->|"formats checkout"| node_checkout
node_agent_graph -->|"checkpoints"| node_conversation_state
node_agent_graph -->|"returns response"| node_chat_ui

click node_chat_ui "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_agent_graph "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_llm_call "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_llm_config "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/llm.py"
click node_tool_dispatch "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_product_search "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_user_lookup "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_price_calc "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_cart_add "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_cart_ops "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_checkout "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_approval "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_product_data "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/imtiaz_superstore_products.xlsx"
click node_user_data "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/users_data.json"
click node_cart_state "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py"
click node_conversation_state "https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.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_chat_ui,node_agent_graph,node_llm_call,node_llm_config,node_approval toneBlue
class node_tool_dispatch,node_product_search,node_user_lookup,node_price_calc,node_cart_add,node_cart_ops,node_checkout toneAmber
class node_product_data,node_user_data,node_cart_state,node_conversation_state toneMint
class node_shopper,node_groq toneIndigo
```

## Components

### Conversation

- [Chat and sidebar](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [LangGraph agent](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [LLM call](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [LLM configuration](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/llm.py): `llm.py`
- [Approval controls](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`

### Shopping capabilities

- [Tool dispatch](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [Product search](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [Loyalty lookup](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [Price calculation](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [Add to cart](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [View and remove](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [Checkout response](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`

### State and data

- [Product spreadsheet](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/imtiaz_superstore_products.xlsx): `imtiaz_superstore_products.xlsx`
- [User profiles](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/users_data.json): `users_data.json`
- [Session cart](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`
- [Conversation checkpoint](https://github.com/mrzasad/langgraph-superstore-ai-assistant/blob/main/agent.py): `agent.py`

### Other components

- **Shopper**
- **Groq model**

## Connections

- Shopper → Chat and sidebar: sends request (evidence: `README.md`)
- Chat and sidebar → LangGraph agent: invokes (evidence: `agent.py`)
- LangGraph agent → LLM call: routes to (evidence: `agent.py`)
- LLM call → LLM configuration: calls (evidence: `agent.py`)
- LLM configuration → Groq model: configures (evidence: `llm.py`)
- LangGraph agent → Tool dispatch: dispatches tools (evidence: `README.md`)
- Tool dispatch → Product search: runs (evidence: `README.md`)
- Tool dispatch → Loyalty lookup: runs (evidence: `README.md`)
- Tool dispatch → Price calculation: runs (evidence: `README.md`)
- Tool dispatch → Add to cart: runs (evidence: `README.md`)
- Tool dispatch → View and remove: runs (evidence: `README.md`)
- Product search → Product spreadsheet: filters (evidence: `agent.py`)
- Loyalty lookup → User profiles: reads (evidence: `agent.py`)
- Add to cart → Product spreadsheet: checks stock (evidence: `agent.py`)
- Add to cart → Approval controls: requests approval (evidence: `agent.py`)
- Approval controls → Add to cart: resumes (evidence: `agent.py`)
- Add to cart → Session cart: adds item (evidence: `agent.py`)
- View and remove → Session cart: reads or updates (evidence: `README.md`)
- Chat and sidebar → Approval controls: shows controls (evidence: `agent.py`)
- Chat and sidebar → Checkout response: formats checkout (evidence: `agent.py`)
- LangGraph agent → Conversation checkpoint: checkpoints (evidence: `agent.py`)
- LangGraph agent → Chat and sidebar: returns response (evidence: `agent.py`)
