Goal
Make InsightIq safe to point at a real database and provable on
every deploy. The agent generates executable SQL, so the production
layer is mostly safety + observability.
Layer 1 — Observability (Langfuse)
Layer 2 — Evaluation (execution accuracy, CI-gated)
Layer 3 — SQL guardrails (model-output safety)
Layer 4 — Data access & security (defense in depth) [NEW]
Layer 5 — Cost
Layer 6 — Reliability (graceful degradation)
Layer 7 — Caching (optional, pays for itself)
Operations — scale-to-zero (Container Apps)
Acceptance
- One query = one Langfuse trace with SQL, time, rows, cost
- CI blocks merge if exec accuracy < 90% or any malicious prompt runs
- A generated DROP/DELETE is parsed, blocked, logged — and would fail
anyway because the role can't write
- statement_timeout + LIMIT enforced; PII column request is refused
- Every failure mode shows a clear message, never a raw 500
Closes #53
Goal
Make InsightIq safe to point at a real database and provable on
every deploy. The agent generates executable SQL, so the production
layer is mostly safety + observability.
Layer 1 — Observability (Langfuse)
tokens, cost, retry count, guardrail verdict
Layer 2 — Evaluation (execution accuracy, CI-gated)
compare result sets (order-insensitive). NOT string match.
Layer 3 — SQL guardrails (model-output safety)
Layer 4 — Data access & security (defense in depth) [NEW]
Layer 5 — Cost
Layer 6 — Reliability (graceful degradation)
Layer 7 — Caching (optional, pays for itself)
Operations — scale-to-zero (Container Apps)
Acceptance
anyway because the role can't write
Closes #53