# DEB-138: Implementing RAG Cache and updating System prompt

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

- **Status:** Development in Progress
- **Assignee:** Maggidi Amulya
- **Priority:** Medium
- **Created:** 2026-02-16T08:29:51.250+0530
- **Updated:** 2026-02-23T11:12:00.091+0530

**Description:**

The agent should be having a rag cache layer where we will be storing the successful agent responses with user acceptance or some other mechanism into one rag caching layer. When user ask a new question this will be checked first to provide the best possible answer then if nothing is found in the cache then it will be moved to the like sources salesforce, gsuit or the insurance database.

**Architecture Diagram:**

```mermaid
flowchart TD
    A[User Query] --> B[Semantic search in RAG Cache]
    B --> C{Cache Hit?}
    C -->|Yes<br/>high similarity| D[Return cached answer]
    C -->|No| E[Query data sources<br/>Salesforce / GSuite / Insurance DB]
    E --> F[Generate answer]
    F --> G{User accepts<br/>answer?}
    G -->|Yes| H[Store Q+A in RAG Cache]
    G -->|No| I[Do not cache<br/>re-query or refine]
    H --> J[Return answer to user]
    D --> J
    I --> J
```
