Agentic Data Analyst
An agentic data analysis system that investigates datasets through schema discovery, SQL generation, execution, validation, anomaly investigation, and structured analysis.
FROM telemetry_aggregates
GROUP BY 1 HAVING COUNT(*) > 50;
Open-source engineering system and architectural prototype. No fabricated client metrics.
01 / THE PROBLEM
Traditional text-to-SQL solutions produce syntactically plausible queries that hallucinate table relationships, fail on edge cases, or miss deeper statistical anomalies hidden within business datasets.
02 / APPROACH & WHY I BUILT IT
Designed to turn high-level analytical questions into deep exploratory workflows by chaining schema inspection, query planning, sandboxed execution, self-correction, and statistical synthesis.
Combines a schema discovery engine, an LLM query planner, a sandboxed SQL execution environment, a results validator, and an analytical synthesis pipeline. The system operates iteratively: if a query fails or produces empty sets, the agent analyzes the dialect error or schema mismatch and self-heals.
03 / HOW THE SYSTEM WORKS
- 01.Extracts and indexes schema definitions, foreign keys, and statistical column distributions.
- 02.Translates analytical intent into a staged query plan before generating SQL code.
- 03.Executes queries in an isolated, read-only database transaction sandbox.
- 04.Validates output data against statistical sanity checks and sanity bounds.
- 05.Generates a comprehensive analysis report with key drivers, cohort comparisons, and dynamic visualization configurations.
04 / KEY ENGINEERING DECISIONS
- ✦Read-only sandboxing with transaction rollback guarantees zero risk of state-modifying SQL execution.
- ✦Pre-execution validation passes through SQL dialect parsers to catch syntax errors before database roundtrips.
- ✦Structured anomaly detection routines to highlight outlier values rather than merely regurgitating raw rows.
05 / RELIABILITY & FAILURE BOUNDARIES
Implements query execution time limits (statement_timeout), maximum row constraints, and strict schema guardrails to prevent accidental denial-of-service on analytical stores.