From over a year of live, multi-user text-to-SQL projects, the recurring mistakes and their fixes:
- Over-engineering. A plan / execute / validate multi-step agent pushed cost from under $1 to $20+ per 100 queries; a single-step agent handles ~80% of SQL tasks.
- No context. Always share the schema (tables, columns, types, keys), the business definitions, and the distributions of categorical fields - ideally as YAML - or the agent hallucinates columns and values.
- No guardrails. Add LIMIT rules (LIMIT 100 on raw SELECTs, none on aggregations), cap queries per question, and give a debug protocol.
- Security. Use read-only DB users with fine-grained permissions; a stray write permission once let a user truncate live tables.
- Async in name only. One blocking call kills concurrency for everyone - wrap blocking DB/file ops in thread pools.
- Wrong model. Right-size the model and monitor prompt-cache hits.
Result across projects: cost per 100 queries from $20+ to under $2, latency from 2 min+ to 10-30s, error rate from ~30% to under 5%. Full writeup: https://www.tigzig.com/post/mistakes-i-made-building-text-to-sql-agents-live-projects-2025-learnings. Live open-source app: https://www.tigzig.com/analyzer. Field guides: https://www.tigzig.com/database-landing.
Building something like this? How I work covers the rates, the availability and what I take on.