Agentic analytics · public reference build

MarginGuard AI

A governed revenue-investigation system that validates data before explanation, uses controlled analytical tools, links every conclusion to evidence, and keeps consequential actions behind human approval.

Public mode: verified replay. No public LLM, database or paid API call is made.

Business problemRevenue leakage
Engineering layerPostgreSQL + dbt
Agent boundaryTyped tools only
Control modelApprove + verify

01 · THE CASE

Not a chatbot. A controlled decision loop.

The demo business is Northstar Coffee Club, a synthetic subscription retailer. The system separates four questions that are often blurred together: is the data trustworthy, is the signal unusual, what caused it, and what action is safe to take?

OBSERVE

Find the deviation

Monitor governed metrics rather than asking a model to browse raw tables.

VALIDATE

Check evidence first

Freshness and completeness gates can stop the investigation before a false narrative forms.

CONTROL

Separate advice from action

Customer, pricing and campaign changes require explicit approval.

VERIFY

Measure what happened next

An action is not a success until the target outcome is checked.

02 · INTERACTIVE VERIFIED REPLAY

Choose a failure mode.

Each scenario replays a captured reference run. The payment-failure case comes from the verified PostgreSQL/dbt execution; the other fixtures exercise the same decision and guardrail patterns without exposing a public backend.

Portfolio-safe public modev1.0.0
NORTHSTAR COFFEE CLUB · REVENUE OPERATIONSVERIFIED REPLAY

CONTROLLED WORKFLOW Observe → Validate → Investigate → Recommend → Approve → Verify

Ready. No conclusion is displayed before the evidence path runs.

Governed tool trace

Every conclusion has an inspectable path.

Select a scenario and run the investigation.

Evidence store

Evidence, not confidence theatre.

Human approval gate

Recommendation pending

The action boundary remains closed until the investigation completes.

Outcome verification

03 · REFERENCE IMPLEMENTATION

The public demo is static. The repository is executable.

The browser layer is deliberately zero-cost and abuse-resistant. The source repository contains the reproducible warehouse, dbt project, typed investigation tools, audit/evidence store, deterministic orchestration, tests and local API.

01Synthetic business eventsPayments, customers and scenario fixtures
02PostgreSQL + dbtStaging, facts, marts and assertions
03Governed toolsTyped inputs, allow-listed metrics, read-only role
04Audit + evidenceRun IDs, tool calls and durable evidence records
05Approval + verificationConsequential action remains controlled

Public website

Safe interactive replay

  • No OpenAI key
  • No public database
  • No user-generated tool calls
  • No ongoing inference cost

GitHub repository

Full reference system

  • Docker/PostgreSQL setup
  • dbt models and tests
  • FastAPI and audit trace
  • Deterministic scenario runner

Design boundary

Agent does not receive SQL

  • Enums instead of table names
  • Bound parameters
  • Physical read-only role
  • Data-quality hard stop

BUILT BY SERGEY KAMINOV

Analytics engineering with an operating decision in mind.

MarginGuard connects my background in payments, fraud, customer behaviour and commercial analytics with a production-minded approach to agentic systems: governed tools, explicit failure modes, human judgement and outcome verification.