Skip to content

The Solution: A Closed Loop in 5 Seconds

Event fires. AI explains. Operator acts. KPIs update. All within 5 seconds.


The core loop

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#1e293b', 'primaryTextColor': '#f8fafc', 'lineColor': '#64748b', 'fontSize': '14px'}} }%%
graph LR
    E["<b>1. Event</b><br/>device.damage_detected"]
    C["<b>2. Context</b><br/>customer + device +<br/>coverage + ops"]
    AI["<b>3. AI Decision</b><br/>rules decide<br/>LLM explains why"]
    A["<b>4. Operator Action</b><br/>approve repair"]
    F["<b>5. Feedback</b><br/>outcome recorded"]
    K["<b>6. KPI Update</b><br/>Cost Avoided +$210<br/>within 5 seconds"]

    E --> C --> AI --> A --> F --> K
    K -.->|"continuous learning"| E

    classDef eventNode fill:#f59e0b,stroke:#d97706,color:#1e293b,stroke-width:2px,rx:10
    classDef contextNode fill:#8b5cf6,stroke:#6d28d9,color:#fff,stroke-width:2px,rx:10
    classDef aiNode fill:#6366f1,stroke:#4f46e5,color:#fff,stroke-width:2px,rx:10
    classDef actionNode fill:#3b82f6,stroke:#1d4ed8,color:#fff,stroke-width:2px,rx:10
    classDef feedbackNode fill:#14b8a6,stroke:#0d9488,color:#fff,stroke-width:2px,rx:10
    classDef kpiNode fill:#22c55e,stroke:#15803d,color:#fff,stroke-width:3px,rx:10

    class E eventNode
    class C contextNode
    class AI aiNode
    class A actionNode
    class F feedbackNode
    class K kpiNode

The punch line

Approve repair Cost Avoided MTD +$210, Active Issues -1 — visible on the dashboard within 5 seconds. That's the closed loop.


What we built — every layer is real

Customer + device + coverage + ops context fused into one abstraction.

The operator sees everything in a single view — no tab-switching, no second system.

backend/app/decisions.py

Rules + weighted scoring pick the action. Bedrock narrates the reason codes into plain language.

AI explains the decision — it never makes it.

backend/app/rationale.py

Event Postgres Redis pub/sub WebSocket dashboard tiles.

Sub-second propagation. The KPI strip ticks before the operator lifts their finger off the mouse.

backend/app/main.py

LangGraph Clarifier: describe a metric in plain English, get a live dashboard widget in 30 seconds.

8-node state machine with human-in-the-loop. Resolves against Asurion's actual metric catalog.

backend/app/widgets/graph.py

3 metrics querying the real Asurion Databricks warehouse. Not synthetic. Not mocked.

Same dashboard, same tiles — backed by real claim data.

backend/app/sql_gen/generator.py


How it flows end to end

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#1e293b', 'primaryTextColor': '#f8fafc', 'lineColor': '#64748b', 'fontSize': '13px'}} }%%
sequenceDiagram
    participant D as Device
    participant API as FastAPI
    participant PG as Postgres
    participant R as Redis
    participant B as Bedrock
    participant UI as Dashboard

    rect rgb(254, 243, 199)
        Note over D,API: 1. Event
        D->>API: device.damage_detected
    end

    rect rgb(237, 233, 254)
        Note over API,PG: 2. Context assembly
        API->>PG: fetch customer + device + coverage
        PG-->>API: unified session
    end

    rect rgb(224, 231, 255)
        Note over API,B: 3. AI explanation
        API->>API: rules engine scores action
        API->>B: explain reason codes
        B-->>API: natural language rationale
    end

    rect rgb(219, 234, 254)
        Note over UI,API: 4. Operator sees recommendation
        API->>R: publish update
        R-->>UI: WebSocket push
        UI->>UI: KPI strip ticks
    end

    rect rgb(209, 250, 229)
        Note over UI,PG: 5. Approve + feedback
        UI->>API: approve repair
        API->>PG: record outcome
        API->>R: publish KPI delta
        R-->>UI: Cost Avoided +$210
    end

Speaker notes (45-60s)
  • Walk through the core loop diagram left to right. Emphasize: "The AI explains the decision, it doesn't make it. Rules and weighted scoring pick the action."
  • Use the tabs: click through each layer briefly. Key point: "Every layer is implemented, not mocked. These are real file paths you can open."
  • Land on the outcome callout: "One click, five seconds, the KPIs update. That's the closed loop."
  • The sequence diagram is for follow-up questions — skip it in the pitch unless someone asks "how does it flow?"