Skip to content
← All projects

AI/ML · Data Engineering · Full Stack

InsightForge

An autonomous data analyst with sandboxed SQL

Status
Complete
Year
2026
Live application
Runs locally with Ollama. No authentication; not publicly deployed.
Analyst copilot answering a trend question with a chart
unsafe-SQL rejection and injection safety
100%
unsafe-SQL rejection and injection safety
numerical correctness with a local 4B model
66.7%
numerical correctness with a local 4B model
layers of SQL isolation
4
layers of SQL isolation

01 Problem

"Chat with your data" tools risk unsafe execution, wrong analysis and prose containing numbers nobody computed. InsightForge treats the model as a planner whose proposals are validated, runs everything in an OS-level sandbox and checks every number in the explanation against computed facts.

02 Product overview

A LangGraph agent proposes typed statistical operations first and SQL second, with up to three repair attempts. Model-written SQL passes four layers of isolation before it touches data. Explanations are written with fact placeholders that a verifier fills from computed results, and charts are built server-side with Plotly.

Implemented

  • Four-layer SQL isolation: SQLGlot AST policy → isolated Python worker → sandbox-exec / bubblewrap → locked DuckDB
  • 12 typed statistical operations
  • Fact-placeholder explanations checked by a number verifier
  • Ingestion of CSV, TSV, XLSX, Parquet and SQLite into versioned Parquet with profiling
  • Chart Studio, Monaco query console with an audit log, saved analyses and export

Planned, not yet built

  • Warm sandbox pool
  • PostgreSQL connector
  • PDF export
  • Larger-model evaluation
  • Cross-filtering

03 System architecture

SQLNext.js UIREST · SSEFastAPILangGraph agentplan · repair ×3Ollamaplan · explainSQLGlot policyAST allow-listSandboxed DuckDBOS-level isolationVerifiernumbers · chartsSQLitemetadata · audit
The model never executes anything directly: proposals pass a policy check and run in an isolated worker against versioned Parquet.clientservicestoremodelqueue

04 Core technologies

Analysis

  • DuckDB
  • SQLGlot
  • pandas
  • NumPy
  • SciPy
  • statsmodels
  • scikit-learn

Agent

  • LangGraph
  • Ollama (qwen3:4b-instruct)

Application

  • FastAPI
  • Pydantic 2
  • SQLAlchemy 2
  • Next.js 16
  • Plotly
  • Monaco

05 Engineering challenges

Streaming through Next.js

Next.js gzip buffered the SSE stream, so progress arrived all at once. A no-transform middleware fixed it.

Isolation that holds

A query filter alone isn't a sandbox. Process-per-query isolation adds roughly 100-300 ms per statement, a deliberate trade for safety.

Numbers you can trust

Explanations reference facts by placeholder, so the model cannot invent a figure that wasn't computed.

06 Technical decisions

  1. 01Typed operations first, SQL second
  2. 02Process-level sandbox rather than query filtering
  3. 03Parquet as the canonical store
  4. 04Server-built charts

07 Verified test results

pytest
170 passed, 1 skipped
Playwright E2E
6/6
Vitest
12/12

Latest GitHub Actions run on main: passing. Counts as reported in the repository's README and testing docs.

08 Screenshots

Analyst copilot answering a trend question with a chart
Copilot answer with a verified trend chart
Execution trace of the analyst agent
Agent trace: plan, policy check, execution
Chart Studio for building Plotly charts
Chart Studio
Monaco SQL query console
Query console with audit log

Screenshots captured from the running application and published in the repository's docs.

09 Links

No public deployment. Runs locally with Ollama. No authentication; not publicly deployed.