# jishnutej1804/customer-escalation-agent architecture

> Architecture diagram of the GitHub repository jishnutej1804/customer-escalation-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jishnutej1804/customer-escalation-agent
- Repository: https://github.com/jishnutej1804/customer-escalation-agent

## Overview

EscalationSentinel is a human-in-the-loop support escalation console. A supervisor submits a ticket through the console; the backend recalls relevant policy and precedent, asks Groq to assess the case, applies a cash-approval guardrail, and returns a recommendation with risk and auto-approval status. Supervisors can approve or override recommendations to retain precedents or corrections, and inspect the memory bank. The README also documents initial policy seeding. Backend source was sampled; the tree identifies the UI only as the templates directory.

Main entry points: [`server.py`](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py) (FastAPI Backend), [`templates`](https://github.com/jishnutej1804/customer-escalation-agent/tree/main/templates) (Web Console), [`seed_memory.py`](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/seed_memory.py) (Policy Seeding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Support Console"]
  node_console_ui["Web Console"]
  node_backend["FastAPI Backend<br/>[server.py]"]
end

subgraph group_analysis["Ticket Analysis"]
  node_ticket["Ticket Input<br/>[server.py]"]
  node_investigation["Investigation<br/>[server.py]"]
  node_risk_guardrail["Risk Guardrail<br/>[server.py]"]
  node_recommendation["Recommendation<br/>[server.py]"]
end

subgraph group_memory["Policy Memory"]
  node_memory_bank[("Memory Bank")]
  node_memory_inspector["Memory Inspector<br/>[server.py]"]
  node_correction_capture["Approval / Override<br/>[server.py]"]
  node_memory_seed["Policy Seeding<br/>[seed_memory.py]"]
end

node_supervisor(("Supervisor"))
node_groq_service{{"Groq API"}}
node_hindsight_service{{"Hindsight API"}}

node_supervisor -->|"submits ticket"| node_console_ui
node_console_ui -->|"sends request"| node_backend
node_backend -->|"dispatches investigation"| node_investigation
node_investigation -->|"validates input"| node_ticket
node_investigation -->|"recalls memories"| node_hindsight_service
node_hindsight_service -->|"reads memories"| node_memory_bank
node_investigation -->|"requests assessment"| node_groq_service
node_investigation -->|"applies guardrail"| node_risk_guardrail
node_risk_guardrail -->|"produces result"| node_recommendation
node_backend -->|"returns response"| node_console_ui
node_supervisor -->|"approves or overrides"| node_correction_capture
node_console_ui -->|"posts decision"| node_backend
node_backend -->|"dispatches decision"| node_correction_capture
node_correction_capture -->|"retains correction"| node_hindsight_service
node_hindsight_service -->|"writes memory"| node_memory_bank
node_supervisor -->|"requests inspection"| node_memory_inspector
node_console_ui -->|"requests memories"| node_backend
node_backend -->|"dispatches listing"| node_memory_inspector
node_memory_inspector -->|"lists memories"| node_hindsight_service
node_memory_seed -->|"seeds policies"| node_hindsight_service
node_hindsight_service -->|"stores policies"| node_memory_bank

click node_console_ui "https://github.com/jishnutej1804/customer-escalation-agent/tree/main/templates"
click node_backend "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_ticket "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_investigation "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_risk_guardrail "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_recommendation "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_memory_inspector "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_correction_capture "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py"
click node_memory_seed "https://github.com/jishnutej1804/customer-escalation-agent/blob/main/seed_memory.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_console_ui,node_backend toneBlue
class node_ticket,node_investigation,node_risk_guardrail,node_recommendation toneAmber
class node_memory_bank,node_memory_inspector,node_correction_capture,node_memory_seed,node_groq_service,node_hindsight_service toneMint
class node_supervisor toneIndigo
```

## Components

### Support Console

- [Web Console](https://github.com/jishnutej1804/customer-escalation-agent/tree/main/templates): `templates`
- [FastAPI Backend](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`

### Ticket Analysis

- [Ticket Input](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`
- [Investigation](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`
- [Risk Guardrail](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`
- [Recommendation](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`

### Policy Memory

- **Memory Bank**
- [Memory Inspector](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`
- [Approval / Override](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/server.py): `server.py`
- [Policy Seeding](https://github.com/jishnutej1804/customer-escalation-agent/blob/main/seed_memory.py): `seed_memory.py`

### Other components

- **Supervisor**
- **Groq API**
- **Hindsight API**

## Connections

- Supervisor → Web Console: submits ticket
- Web Console → FastAPI Backend: sends request
- FastAPI Backend → Investigation: dispatches investigation
- Investigation → Ticket Input: validates input
- Investigation → Hindsight API: recalls memories
- Hindsight API → Memory Bank: reads memories
- Investigation → Groq API: requests assessment
- Investigation → Risk Guardrail: applies guardrail
- Risk Guardrail → Recommendation: produces result
- FastAPI Backend → Web Console: returns response
- Supervisor → Approval / Override: approves or overrides
- Web Console → FastAPI Backend: posts decision
- FastAPI Backend → Approval / Override: dispatches decision
- Approval / Override → Hindsight API: retains correction
- Hindsight API → Memory Bank: writes memory
- Supervisor → Memory Inspector: requests inspection
- Web Console → FastAPI Backend: requests memories
- FastAPI Backend → Memory Inspector: dispatches listing
- Memory Inspector → Hindsight API: lists memories
- Policy Seeding → Hindsight API: seeds policies
- Hindsight API → Memory Bank: stores policies
