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
[](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_8COMPONENT STACK (13)
- Data AnalystSTATEFULAsks questions from an untrusted network
- AlertingSTATEFULOn-call pager outside our boundary
- Inference serverSTATELESSHosted model API outside our boundary
- PostgreSQLSTATEFULData team read replica; read-only role
- Audit logSTATEFULSecurity-owned record of who ran which SQL
- API gatewaySTATELESSChecks the JWT and scope, then starts the question
- Evaluation serviceSTATEFULReplays a fixed question set on every change
- GuardrailsSTATELESSParses SQL: one SELECT, allowed tables, functions
- Agent orchestration runtimeSTATEFULPrompts model, repairs once, enforces the deadline
- Secrets managerSTATEFULHolds the read-only database credential
- Time-series database (TSDB)STATEFULStores latency, rejects, timeouts, row counts
- Function callingSTATELESSParses columns, runs the SQL tool
- Policy decision point (PDP)STATELESSAllows tables and columns per user
REQUEST & DATA FLOW (18)
- Data Analyst → API gateway (Asks with JWT)[HTTPS]
- API gateway → Agent orchestration runtime (Starts (mTLS))[HTTP/2]
- Agent orchestration runtime → Inference server (Asks model for SQL)[HTTPS]
- Inference server → Agent orchestration runtime (Returns SQL text)[HTTPS]
- Agent orchestration runtime → Guardrails (Sends SQL (mTLS))[HTTP/2]
- Guardrails → Agent orchestration runtime (Returns verdict)[HTTP/2]
- Agent orchestration runtime → Function calling (Calls with JWT (mTLS))[HTTP/2]
- Function calling → Policy decision point (PDP) (Asks: tables, columns)[HTTP/2]
- Policy decision point (PDP) → Function calling (Decision)[HTTP/2]
- Function calling → PostgreSQL (Runs SELECT)[SQL]
- Function calling → Agent orchestration runtime (Returns capped rows)[HTTP/2]
- Agent orchestration runtime → API gateway (Sends answer)[HTTP/2]
- API gateway → Data Analyst (Relays answer)[HTTPS]
- Secrets manager → Function calling (DB credential)[HTTPS]