# DEB-362: Data Source Agent: Adhoc Query Lifecycle - II

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

- **Status:** Start
- **Assignee:** arpit
- **Priority:** Medium
- **Created:** 2026-03-13T15:54:46.288+0530
- **Updated:** 2026-03-13T16:37:15.252+0530

**Description:**

Implementation of RAG Cache and Testing it out (GMail)

Find the solution from the RAG Cache first. If not found, execute the flow as finding the right skill, executing and returning the response

**Architecture Diagram:**

```mermaid
flowchart TD
    A[Adhoc Query from RT Agent] --> B[DSA: Receive Query]
    B --> C[Check RAG Cache<br/>vector similarity search]
    C --> D{Cache Hit?}
    D -->|Yes - high similarity| E[Return Cached Answer]
    D -->|No| F[Find Matching Skill / Pattern]
    F --> G[Execute Skill<br/>against Data Source]
    G --> H[Get Raw Data via REST API Adaptor]
    H --> I[Generate Response]
    I --> J[Store in RAG Cache<br/>for future queries]
    J --> K[Return Response to RT Agent]
    E --> K
```
