# DEB-52: Integrate with the connected Database

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

- **Status:** Done
- **Assignee:** Abhilash Adunuri
- **Priority:** High
- **Created:** 2026-01-20T13:39:15.995+0530
- **Updated:** 2026-02-09T17:20:38.615+0530

**Description:**

As a user I should be able to query for information present in the connected DB using natural language prompts, and the system should interpret the query and provide response in text / table / graphical formats.

Lift and shift of the existing NL2SQL work for IIRM

**Architecture Diagram:**

```mermaid
sequenceDiagram
    participant User
    participant RT as RT Decision Agent
    participant DSA as DB Data Source Agent
    participant NL2SQL as NL2SQL Engine
    participant DB as Enterprise Database

    User->>RT: Natural language query
    RT->>DSA: A2A: query(nl_question, schema_context)
    DSA->>NL2SQL: Convert NL to SQL
    NL2SQL-->>DSA: SQL query
    DSA->>DSA: Validate SQL<br/>(query validation layer)
    DSA->>DB: Execute SQL
    DB-->>DSA: Raw rows
    DSA->>DSA: Format: text / table / chart
    DSA-->>RT: Formatted response + evidence
    RT-->>User: Display response
```
