Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_text-to-sql-agent

Text-to-SQL Agent (read-only questions over an analytics database)

14 COMPONENTS · 18 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[![Text-to-SQL Agent (read-only questions over an analytics database) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_text-to-sql-agent/opengraph-image)](https://archos.sageideas.dev/d/dgm_text-to-sql-agent)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_text-to-sql-agent)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_text-to-sql-agent" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Text-to-SQL Agent (read-only questions over an analytics database) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0[("Data Analyst")]
  alerting_1[("Alerting")]
  inference_2["Inference server"]
  db_3[("PostgreSQL")]
  audit_4[("Audit log")]
  gw_5["API gateway"]
  eval_6[("Evaluation service")]
  guard_7["Guardrails"]
  orch_8[("Agent orchestration runtime")]
  secrets_9[("Secrets manager")]
  tsdb_10[("Time-series database (TSDB)")]
  toolgw_11["Function calling"]
  pdp_12["Policy decision point (PDP)"]
  capacity_13["Capacity Estimate"]
  client_0 -->|"1. Asks with JWT · HTTPS"| gw_5
  gw_5 -->|"2. Starts (mTLS) · HTTP/2"| orch_8
  orch_8 -->|"3. Asks model for SQL · HTTPS"| inference_2
  inference_2 -->|"4. Returns SQL text · HTTPS"| orch_8
  orch_8 -->|"5. Sends SQL (mTLS) · HTTP/2"| guard_7
  guard_7 -->|"6. Returns verdict · HTTP/2"| orch_8
  orch_8 -->|"7. Calls with JWT (mTLS) · HTTP/2"| toolgw_11
  toolgw_11 -->|"8. Asks: tables, columns · HTTP/2"| pdp_12
  pdp_12 -->|"9. Decision · HTTP/2"| toolgw_11
  toolgw_11 -->|"10a. Runs SELECT · SQL"| db_3
  toolgw_11 -->|"10b. Returns capped rows · HTTP/2"| orch_8
  orch_8 -->|"11. Sends answer · HTTP/2"| gw_5
  gw_5 -->|"12. Relays answer · HTTPS"| client_0
  secrets_9 -->|"DB credential · HTTPS"| toolgw_11
  toolgw_11 -->|"Audit record · HTTPS"| audit_4
  orch_8 -->|"Exports (OTLP) · OTLP"| tsdb_10
  tsdb_10 -->|"Notifies · HTTP"| alerting_1
  eval_6 -->|"Replays test questions · HTTP/2"| orch_8

COMPONENT STACK (13)

  • Data AnalystSTATEFUL
    Asks questions from an untrusted network
  • AlertingSTATEFUL
    On-call pager outside our boundary
  • Inference serverSTATELESS
    Hosted model API outside our boundary
  • PostgreSQLSTATEFUL
    Data team read replica; read-only role
  • Audit logSTATEFUL
    Security-owned record of who ran which SQL
  • API gatewaySTATELESS
    Checks the JWT and scope, then starts the question
  • Evaluation serviceSTATEFUL
    Replays a fixed question set on every change
  • GuardrailsSTATELESS
    Parses SQL: one SELECT, allowed tables, functions
  • Agent orchestration runtimeSTATEFUL
    Prompts model, repairs once, enforces the deadline
  • Secrets managerSTATEFUL
    Holds the read-only database credential
  • Time-series database (TSDB)STATEFUL
    Stores latency, rejects, timeouts, row counts
  • Function callingSTATELESS
    Parses columns, runs the SQL tool
  • Policy decision point (PDP)STATELESS
    Allows tables and columns per user

REQUEST & DATA FLOW (18)

  1. Data Analyst → API gateway (Asks with JWT)[HTTPS]
  2. API gateway → Agent orchestration runtime (Starts (mTLS))[HTTP/2]
  3. Agent orchestration runtime → Inference server (Asks model for SQL)[HTTPS]
  4. Inference server → Agent orchestration runtime (Returns SQL text)[HTTPS]
  5. Agent orchestration runtime → Guardrails (Sends SQL (mTLS))[HTTP/2]
  6. Guardrails → Agent orchestration runtime (Returns verdict)[HTTP/2]
  7. Agent orchestration runtime → Function calling (Calls with JWT (mTLS))[HTTP/2]
  8. Function calling → Policy decision point (PDP) (Asks: tables, columns)[HTTP/2]
  9. Policy decision point (PDP) → Function calling (Decision)[HTTP/2]
  10. Function calling → PostgreSQL (Runs SELECT)[SQL]
  11. Function calling → Agent orchestration runtime (Returns capped rows)[HTTP/2]
  12. Agent orchestration runtime → API gateway (Sends answer)[HTTP/2]
  13. API gateway → Data Analyst (Relays answer)[HTTPS]
  14. Secrets manager → Function calling (DB credential)[HTTPS]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →