Show HN: Runtime Verification for SQL Agents (github.com)

🤖 AI Summary
A new open-source runtime environment for SQL agents brings correctness validation and automated optimization to PostgreSQL workflows, aimed at catching the silent semantic errors often produced by LLM-generated SQL. The project pairs metamorphic testing (TLP and NoREC) to verify query correctness with EXPLAIN-plan analysis to detect performance bottlenecks, then suggests concrete fixes (indexes, rewrites) or runs autonomous optimization loops. This matters for the AI/ML community because SQL agents are being used widely to automate data access and analytics, and subtle semantic or estimation errors from LLMs can produce silently wrong results or costly full-table scans—this tool provides guardrails and remediation. Technically, the system parses EXPLAIN (JSON) output to flag sequential scans, high-cost operations, and planner estimate errors; a “Semanticizer” (Anthropic Claude) converts findings into natural-language suggestions like CREATE INDEX or rewrite patterns. An agent runs a ReAct-style loop (Claude Sonnet) iteratively improving queries until a success criterion or max iterations. Safety features include two-phase EXPLAIN (estimates first, ANALYZE only if safe), statement timeouts, and HypoPG virtual-index testing. It’s available as a CLI and Python async API (requires Python 3.10+, Anthropic API key), ships with Docker demo data, pytest tests, and is MIT-licensed—ready for integration into SQL-agent development and CI.
Loading comments...
loading comments...