A natural-language-to-SQL agent with sqlglot AST-based safety validation (SELECT-only,
provably — not a fragile regex check), schema introspection, and a self-correcting retry
loop that injects SQL errors back into the prompt. Same retry-on-failure pattern as the
test generator, applied somewhere a wrong answer can actually hurt — a database.
AST-based safety validation (not regex) on generated SQL is the detail that makes this defensible in a real interview — shows you think about AI output as untrusted input.