DEV Community

Sugunah
Sugunah

Posted on Edited on

I let a coding agent build my analytics — here's the guardrail system that made it safe

Dex by Exmergo, hands-on. Independent notes; not affiliated with Exmergo. Links to my free cheat sheet and starter pack are at the end.

An agent with warehouse access runs two meters at once: the warehouse bill (bytes scanned, compute seconds, DBUs) and the token bill. Most "AI analytics" demos quietly ignore both. Dex by Exmergo — open source, Apache 2.0 — is a tool that treats both meters as design constraints. Here's how the system works, based on the official docs, the open-source engine, and its public benchmark repo.

The loop: Explore, Transform, Maintain

Dex installs into your coding agent (Claude Code as a plugin; Codex, Cursor, Gemini CLI via skills) and gives it three commands:

  • /dex:explore — read-only profiling. It ranks tables, profiles columns from aggregates, infers and verifies joins, establishes each table's grain, and flags PII columns (flagged, never surfaced). The map is cached locally in .dex/, so the next session doesn't re-scan — or re-bill — your warehouse.
  • /dex:transform — ask for a metric and you get a plan, then diffs: dbt SQL models, schema tests, docs, and the semantic layer on top (MetricFlow, Apache Ossie, SLayer, Cube, Snowflake Semantic Views, or Databricks Metric Views). Builds validate against dev targets only.
  • /dex:maintain — diff the project against your .dex/ baseline and get drift reports on four axes: schema, volume, grain, semantic — each with a proposed fix you review before anything merges.

The part I didn't expect: semantics as code

The November "Dex Semantics" release adds declarations to analytical models: what a row means, what a join does to row counts, how a number is allowed to add up, and which business assumptions a metric rests on. They live in your models, in your repo — and they flow forward into the next agent session, which is exactly where unaided agents usually re-guess your conventions and get them wrong.

The test worth running on your own data (the starter pack below walks through it step by step): ask a fresh agent session for a metric that depends on one of your conventions — refund timing is the classic — once without the semantic context and once with it, and compare the corrections you have to make. That's your personal version of the benchmark. Exmergo's own ADE-bench numbers (80% vs 73.3% task success, Sonnet 5.5) are vendor-reported and linked from their site if you want the methodology.

The guardrails, concretely

  1. Read-only against source data; reads pass a SQL/cost guard.
  2. Dry-run first: billed scans return a needs_confirmation estimate and run only with an explicit budget (e.g. --confirm --budget <bytes> on BigQuery), capped server-side. Over-ceiling calls are refused outright.
  3. A spend ledger you can read: .dex/spend.jsonl, one record per billed call.
  4. Credentials are discovered, never collected: BigQuery via ADC, Snowflake via connections.toml/env/dbt profile. Dex never asks for a key — if your agent ever asks you to paste one, stop; something else is wrong.
  5. PII containment: flagged columns stay out of the model's context.

Try it in 10 minutes (free)

# Claude Code, one command at a time
/plugin marketplace add exmergo/exmergo-agent-plugins
/plugin install dex@exmergo

# or the Python engine with the zero-credential DuckDB on-ramp
pip install "exmergo-dex-core[duckdb]"
Enter fullscreen mode Exit fullscreen mode

Start on a local DuckDB file. Prove the loop at $0 before any agent touches a billed warehouse — that ordering is the whole trick.

Honest limits

Dex is early and under active development; connector maturity varies (check the PyPI page for exmergo-dex-core). There are also at least four other products called "Dex" — make sure you're installing Exmergo's (exmergo/dex on GitHub).


Free: I condensed the install, the three commands, all 8 connectors, and the 6 safety rules into a one-page cheat sheet: https://payhip.com/b/zOwsR

Full starter pack: an 18-section tutorial, 12 copy-paste agent prompts, and 3 workflow worksheets (source onboarding, metric requests, weekly drift log): https://payhip.com/b/yUI8Y

Disclosure: the pack is my own independent product, sold on Payhip. The cheat sheet is free and covers the essentials.

Top comments (0)