# kasturimaheshbabu2316-mc/capstone---e-commerce-retail architecture

> Architecture diagram of the GitHub repository kasturimaheshbabu2316-mc/capstone---e-commerce-retail, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail
- Repository: https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail

## Overview

Nykaa’s support agent handles policy questions and order-status inquiries through a customer-facing API. The main documented flow applies runtime budget and input safeguards, checks a normalized response cache, executes specialized retrieval and lookup work, reviews the draft, then returns a structured answer and records telemetry. Separate capabilities include policy ingestion and indexing, session memory, escalation scoring, and evaluation. The README documents the broad architecture; some subsystem links below rely on that documentation because their implementation was not sampled.

Main entry points: [`app/pipeline.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/app/pipeline.py) (Support pipeline), [`app/main.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/app/main.py) (HTTP and WebSocket API), [`agents/crew.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/crew.py) (Crew orchestration), [`autogen_review/review_team.py`](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/autogen_review/review_team.py) (Draft review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["Serving"]
  node_gateway["HTTP and WebSocket API<br/>[main.py]"]
  node_pipeline["Support pipeline<br/>[pipeline.py]"]
  node_contracts["Response contracts<br/>[schemas.py]"]
end

subgraph group_governance["Governance"]
  node_budget["Token budget<br/>[risk_budget.py]"]
  node_guardrails["Input and output safeguards<br/>[guardrails.py]"]
  node_cache[("Response cache<br/>[cache.py]")]
end

subgraph group_agents["Agent workflow"]
  node_crew["Crew orchestration<br/>[crew.py]"]
  node_llm["Offline model<br/>[mock_llm.py]"]
  node_memory[("Session memory<br/>[memory.py]")]
  node_review["Draft review<br/>[review_team.py]"]
end

subgraph group_knowledge["Knowledge and orders"]
  node_tools["Policy and order tools<br/>[tools.py]"]
  node_orders[("Order records and scoring<br/>[dataset.py]")]
  node_policy["Policy documents"]
  node_chunking["Document chunking<br/>[chunking.py]"]
  node_indexer[("Vector indexing and search<br/>[indexer.py]")]
  node_rag_eval["Retrieval calibration<br/>[evaluation.py]"]
end

subgraph group_ops["Telemetry and evaluation"]
  node_logger["Redacted telemetry<br/>[logger.py]"]
  node_judge["LLM-as-judge evaluation<br/>[run_judge.py]"]
end

node_customer(("Customer"))

node_customer -->|"submits query"| node_gateway
node_gateway -->|"routes requests"| node_pipeline
node_gateway -->|"checks budget"| node_budget
node_gateway -->|"logs requests"| node_logger
node_pipeline -->|"sanitizes input"| node_guardrails
node_pipeline -->|"checks cache"| node_cache
node_pipeline -->|"runs query"| node_crew
node_pipeline -->|"reviews draft"| node_review
node_pipeline -->|"returns response"| node_contracts
node_crew -->|"invokes tools"| node_tools
node_crew -->|"records turns"| node_memory
node_crew -->|"generates draft"| node_llm
node_tools -->|"looks up orders"| node_orders
node_tools -->|"searches policies"| node_indexer
node_policy -->|"provides text"| node_chunking
node_chunking -->|"produces chunks"| node_indexer
node_gateway -->|"ingests documents"| node_indexer
node_rag_eval -->|"benchmarks retrieval"| node_indexer
node_review -->|"emits verdict"| node_contracts
node_review -->|"redacts PII"| node_guardrails
node_judge -->|"scores answers"| node_crew
node_judge -->|"evaluates review"| node_review

click node_gateway "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/app/main.py"
click node_pipeline "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/app/pipeline.py"
click node_budget "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/governance/risk_budget.py"
click node_guardrails "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/guardrails.py"
click node_cache "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/governance/cache.py"
click node_crew "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/crew.py"
click node_llm "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/mock_llm.py"
click node_memory "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/memory.py"
click node_review "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/autogen_review/review_team.py"
click node_contracts "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/api/schemas.py"
click node_tools "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/tools.py"
click node_orders "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/dataset.py"
click node_policy "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/tree/main/knowledge_base"
click node_chunking "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/rag/chunking.py"
click node_indexer "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/rag/indexer.py"
click node_rag_eval "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/rag/evaluation.py"
click node_logger "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/api/logger.py"
click node_judge "https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/evaluation/run_judge.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_gateway,node_pipeline,node_contracts toneBlue
class node_budget,node_guardrails,node_cache toneAmber
class node_crew,node_llm,node_memory,node_review toneMint
class node_tools,node_orders,node_policy,node_chunking,node_indexer,node_rag_eval toneRose
class node_logger,node_judge,node_customer toneIndigo
```

## Components

### Serving

- [HTTP and WebSocket API](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/app/main.py): `app/main.py`
- [Support pipeline](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/app/pipeline.py): `app/pipeline.py`
- [Response contracts](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/api/schemas.py): `api/schemas.py`

### Governance

- [Token budget](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/governance/risk_budget.py): `governance/risk_budget.py`
- [Input and output safeguards](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/guardrails.py): `agents/guardrails.py`
- [Response cache](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/governance/cache.py): `governance/cache.py`

### Agent workflow

- [Crew orchestration](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/crew.py): `agents/crew.py`
- [Offline model](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/mock_llm.py): `agents/mock_llm.py`
- [Session memory](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/memory.py): `agents/memory.py`
- [Draft review](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/autogen_review/review_team.py): `autogen_review/review_team.py`

### Knowledge and orders

- [Policy and order tools](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/agents/tools.py): `agents/tools.py`
- [Order records and scoring](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/dataset.py): `dataset.py`
- [Policy documents](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/tree/main/knowledge_base): `knowledge_base`
- [Document chunking](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/rag/chunking.py): `rag/chunking.py`
- [Vector indexing and search](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/rag/indexer.py): `rag/indexer.py`
- [Retrieval calibration](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/rag/evaluation.py): `rag/evaluation.py`

### Telemetry and evaluation

- [Redacted telemetry](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/api/logger.py): `api/logger.py`
- [LLM-as-judge evaluation](https://github.com/kasturimaheshbabu2316-mc/capstone---e-commerce-retail/blob/main/evaluation/run_judge.py): `evaluation/run_judge.py`

### Other components

- **Customer**

## Connections

- Customer → HTTP and WebSocket API: submits query (evidence: `README.md`)
- HTTP and WebSocket API → Support pipeline: routes requests (evidence: `app/main.py`)
- HTTP and WebSocket API → Token budget: checks budget (evidence: `README.md`)
- HTTP and WebSocket API → Redacted telemetry: logs requests (evidence: `app/main.py`)
- Support pipeline → Input and output safeguards: sanitizes input (evidence: `app/pipeline.py`)
- Support pipeline → Response cache: checks cache (evidence: `app/pipeline.py`)
- Support pipeline → Crew orchestration: runs query (evidence: `app/pipeline.py`)
- Support pipeline → Draft review: reviews draft (evidence: `app/pipeline.py`)
- Support pipeline → Response contracts: returns response (evidence: `app/pipeline.py`)
- Crew orchestration → Policy and order tools: invokes tools (evidence: `agents/crew.py`)
- Crew orchestration → Session memory: records turns (evidence: `agents/crew.py`)
- Crew orchestration → Offline model: generates draft (evidence: `agents/crew.py`)
- Policy and order tools → Order records and scoring: looks up orders (evidence: `README.md`)
- Policy and order tools → Vector indexing and search: searches policies (evidence: `README.md`)
- Policy documents → Document chunking: provides text (evidence: `README.md`)
- Document chunking → Vector indexing and search: produces chunks (evidence: `rag/indexer.py`)
- HTTP and WebSocket API → Vector indexing and search: ingests documents (evidence: `README.md`)
- Retrieval calibration → Vector indexing and search: benchmarks retrieval (evidence: `rag/evaluation.py`)
- Draft review → Response contracts: emits verdict (evidence: `autogen_review/review_team.py`)
- Draft review → Input and output safeguards: redacts PII (evidence: `autogen_review/review_team.py`)
- LLM-as-judge evaluation → Crew orchestration: scores answers (evidence: `README.md`)
- LLM-as-judge evaluation → Draft review: evaluates review (evidence: `README.md`)
