# DEB-131: Performance Optimisation

> **Jira:** [DEB-131](https://divami.atlassian.net/browse/DEB-131)  
> **Source Report:** [20260315.md](../../reports/jira/20260315.md)

- **Status:** Start
- **Assignee:** Unassigned
- **Priority:** Medium
- **Created:** 2026-01-20T19:39:19.446+0530
- **Updated:** 2026-02-09T15:08:45.672+0530

**Description:**

Application should be able to respond to user queries in less time (Eg. less than 3 seconds). It should be able to display the progress if it exceeds the set time limit (Eg. Searching in DB… Not Found, Searching in Drives.. Not Found, Searching in Chat Spaces… In Progress, etc.)

**Architecture Diagram:**

```mermaid
sequenceDiagram
    participant User
    participant UI as Chat Interface
    participant RT as RT Decision Agent
    participant Cache as RAG Cache
    participant DSA as Data Source Agents

    User->>UI: Submit query
    UI->>RT: POST /query
    RT->>Cache: Check RAG Cache (fast)
    alt Cache hit < 1s
        Cache-->>RT: Cached answer
        RT-->>UI: Response
    else Cache miss
        RT-->>UI: "Searching in Cache... Not found"
        RT->>DSA: Query data sources (parallel)
        DSA-->>UI: Streaming: "Searching in DB..."
        DSA-->>UI: Streaming: "Searching in Drive..."
        DSA-->>RT: Results
        RT->>RT: Synthesize
        RT-->>UI: Final response
    end
    UI-->>User: Display with source attribution
```
