📥 RAW
Source / Ingestion
⚙️ SILVER
Transformation
🏅 GOLD
Curated / KPIs
📊 REPORTING
Looker Studio
🏢 EXECUTIVE
Dashboards
UC1 Raw Ingestion Gatekeeper

Gate: Raw → Silver promotion

Checks: Schema drift · Null rates · Row volume anomaly · Critical column presence

Model: Gemini 2.5 Flash (non-PASS cases only)

Hard gate: FAIL HIGH/CRITICAL → quarantine raw load, stop downstream

PASS WARNING ≥20% row delta FAIL — schema break INSUFFICIENT_DATA
UC3 Silver Transformation Validator

Gate: Transformation deployment

Checks: SQL/dbt join correctness · Duplicate ratio · Source-target schema alignment · BigQuery anti-patterns

Model: Gemini 2.5 Pro (complex multi-hop SQL validation)

Hard gate: CRITICAL formula/join defects → block deploy

PASS WARNING ≥0.5% dup FAIL — join risk Gemini 2.5 Pro
UC2 Cross-Layer Reconciliation

Gate: Gold/Reporting promotion

Checks: Row loss Raw→Silver→Gold · Aggregate drift · Dropped key counts · Dataplex lineage watermark alignment

Model: Gemini 2.5 Flash

Hard gate: HIGH/CRITICAL drift → hold Gold promotion

PASS WARNING ≥2% row loss FAIL — agg drift Dataplex lineage
UC4 Gold KPI Assurance

Gate: Dashboard / exec reporting refresh

Checks: Business rule enforcement · Gross margin sanity · Gold vs Reporting reconciliation · ML.DETECT_ANOMALIES (ARIMA_PLUS)

Model: Gemini 2.5 Pro (structured JSON anomaly summaries)

Hard gate: CRITICAL KPI trust failure → block dashboard refresh

PASS WARNING ≥1% KPI diff FAIL — gross margin <0 ARIMA_PLUS
✅ RELEASED
Status = PASS or WARNING with LOW/MEDIUM severity and confidence ≥ 70. Data is promoted automatically. No steward action required.
🔍 PENDING_REVIEW
Status = WARNING with HIGH severity, FAIL with exception suppressed, confidence < 70, or INSUFFICIENT_DATA. Steward review queue. Data held pending decision.
🚫 QUARANTINED
Status = FAIL HIGH/CRITICAL with no active exception and advisory_mode = FALSE. Hard block. release_blocked = TRUE. Downstream promotion halted.
0
Batch Initialization
Generate batch_id · Set advisory_mode = os.environ.get("ADVISORY_MODE","true") · Pass into every agent call
1
UC1 — Raw Ingestion Gate
Consumes raw metadata, row/null profile, pipeline logs. Deterministic checks first → Gemini 2.5 Flash for non-PASS.
Advisory Mode
Always continue; log result to agent_findings
Controlled Gate
FAIL HIGH/CRITICAL → quarantine raw load, halt downstream
2
UC3 — Silver Transformation Review
Consumes SQL/dbt artifact, source/target schema, execution stats. Gemini 2.5 Pro for complex join/KPI logic.
Advisory Mode
Always continue; flag deployment risk
Controlled Gate
CRITICAL formula/join defect → block transformation deploy
3
UC2 — Cross-Layer Reconciliation
Consumes UC1 result + UC3 result + Dataplex lineage + layer row counts. Validates Raw→Silver→Gold continuity.
Advisory Mode
Always continue; log drift findings
Controlled Gate
HIGH/CRITICAL drift → hold Gold/Reporting promotion
4
UC4 — Gold KPI Assurance
Consumes UC2 result + Gold output + reporting extract + semantic metric definitions + ARIMA_PLUS anomaly score.
Advisory Mode
Always continue; alert review queue
Controlled Gate
CRITICAL KPI trust failure → block dashboard refresh
5
Post-Run: Merge + Batch Status + Notify
Run merge_audit_violations.sql → Compute batch_status → Pub/Sub notify if open HIGH/CRITICAL violations with alerted=FALSE

batch_status Roll-Up

QUARANTINED — any agent release_blocked=TRUE

PENDING_REVIEW — any agent review_required=TRUE

RELEASED — all agents clear

Timeout / Partial Failure

Agent timeout → persist SYSTEM_FALLBACK_HANDLER with INSUFFICIENT_DATA/HIGH

UC1 fallback → UC2/UC3/UC4 continue in advisory with evidence_sufficiency=INSUFFICIENT

Advisory vs Gate Mode

In advisory_mode=TRUE: batch_status computed and logged but does NOT halt data movement

In advisory_mode=FALSE: hard gates enforce QUARANTINED blocks

Exception Suppression

Evaluated after deterministic severity, before routing. SUPPRESS clears block. DOWNGRADE reduces HIGH→MEDIUM only. CRITICAL is never reduced.

🗄️

BigQuery

Data & Compute Tier

Source, target, and deterministic evidence engine for all four agents.

  • dq_results dataset — agent_findings, audit_violations
  • dq_admin dataset — thresholds, exceptions, golden_labels
  • MERGE-based idempotent ingestion (no plain INSERT)
  • fn_route() routing UDF in dq_results
  • PARTITION BY DATE(run_ts) · CLUSTER BY agent_name/status
  • ML.DETECT_ANOMALIES on ARIMA_PLUS (UC4)
🧠

Vertex AI — Gemini 2.5

AI Reasoning Layer

Model invoked only for non-PASS deterministic cases. Model proposes; orchestrator decides.

  • Gemini 2.5 Flash — UC1/UC2 high-frequency classification
  • Gemini 2.5 Pro — UC3/UC4 complex SQL/KPI validation
  • gemini-2.0-flash RETIRED — never use
  • Structured output: response_mime_type="application/json"
  • Canonical response schema enforced — status, severity, evidence_refs
  • Business keys hashed (SHA-256) before invocation
🔍

Dataplex

Governance & Metadata

Metadata curation and data lineage tracking across pipeline layers.

  • Data Lineage API — tracks state boundaries Raw→Silver→Gold
  • Cloud Data Catalog — structural asset metadata
  • dq_asset_inventory table — scanned asset registry
  • Watermark alignment check in UC2 cross-layer reconciliation
  • Per-asset quality scan metadata
⚙️

Cloud Workflows

Orchestration

Executes the 5-step DAG preserving agent dependency ordering and advisory/gate semantics.

  • UC1 → UC3 → UC2 (uses UC1+UC3) → UC4 (uses UC2)
  • Passes advisory_mode into every agent call
  • SYSTEM_FALLBACK_HANDLER for timeout/partial failure
  • Triggers merge_audit_violations post-run
  • Computes batch_status roll-up
📨

Pub/Sub

Event & Alerting

Publishes violation alerts for open HIGH/CRITICAL findings that have not yet been alerted.

  • Alert eligibility: alerted=FALSE gate before publish
  • UPDATE alerted=TRUE after publish (idempotent)
  • Feeds Teams/Slack/PagerDuty notifications
  • Triggers steward review queue notifications
🔐

Secret Manager

Security & Credentials

Stores all service credentials. No secrets in environment variables or code.

  • Service account key rotation
  • Vertex AI API credentials
  • BigQuery connection secrets
  • IAM: dataEditor scoped to dq_results only
  • minimize_logs() strips keys/tokens/emails before Vertex AI
📋

Cloud Logging & Monitoring

Observability

Full observability stack for agent performance and pipeline health.

  • logger.warning() for all fallback / INSUFFICIENT_DATA events
  • Token counts — input_token_count, output_token_count per run
  • Latency tracking — latency_ms per agent execution
  • Advisory metrics: FP/FN rate, review queue volume
  • Promotion gate criteria monitoring (§13.3)
📈

Looker Studio

Reporting Layer

Executive KPI dashboards powered by the Gold layer, gated by UC4 assurance before refresh.

  • v_agent_summary — flat view for dashboard consumption
  • v_agent_findings — UNNEST findings for per-finding drill-down
  • UC4 CRITICAL failure blocks dashboard refresh
  • Routing target visible in dashboard (RELEASED/PENDING/QUARANTINED)
agent_findings CORE RESULT
run_idSTRINGPK
agent_nameSTRINGPK
entity_nameSTRINGPK
batch_idSTRING
run_tsTIMESTAMP
statusPASS|WARNING|FAIL|INSUF
max_severityLOW|MEDIUM|HIGH|CRITICAL
routing_targetSTRINGfn_route()
release_blockedBOOLderived
review_requiredBOOLderived
advisory_modeBOOL
approved_exception_refSTRING
model_statusSTRINGaudit only
payload_jsonJSON
input_token_countINT64
latency_msINT64
created_atTIMESTAMP
audit_violations SELF-AUDIT
violation_keySTRINGPK · SHA256
agent_nameSTRING
entity_nameSTRING
layer_nameSTRING
rule_nameSTRING
max_severitySTRING
first_detected_tsTIMESTAMP
last_detected_tsTIMESTAMP
detection_countINT64+1 per hit
last_run_idSTRINGFK
statusOPEN|RESOLVED
alertedBOOL
dq_exceptions SUPPRESSION
exception_idSTRINGPK
dataset_nameSTRING
entity_nameSTRING
rule_nameSTRING
suppression_actionSUPPRESS|DOWNGRADE|REVIEW
activeBOOL
expires_atTIMESTAMP
approved_bySTRING
golden_labels TESTING
case_idSTRINGPK = entity_name
agent_nameSTRING
expected_statusSTRING
expected_severitySTRING
scenario_typePASS|WARN|FAIL|INSUF|EDGE
notesSTRING
dq_thresholds CONFIG
agent_nameSTRINGPK
metric_nameSTRINGPK
warning_thresholdFLOAT64
fail_thresholdFLOAT64
critical_thresholdFLOAT64
threshold_sourceSTRING
payload_json structure JSON
findings[]ARRAY
issue_typeSTRING
descriptionSTRING
statusPASS|WARNING|FAIL|INSUF
severityLOW|MEDIUM|HIGH|CRITICAL
evidence_refs[]ARRAY[STRING]
recommended_actionSTRING
confidence_scoreINT 0-100
Phase 1 — Foundation
Schema Build
  • Run DDL §1–§3 (datasets, agent_findings, all supporting tables)
  • Deploy fn_route() UDF (§5)
  • Load MERGE SQL files into repo (§4 build gate)
  • Create views v_agent_summary, v_agent_findings (§7)
  • Load 160 golden labels into golden_labels (§15)
  • Architecture approved by lead architect
Gate: Architecture approved · Both SQL files in repo
Phase 2 — MVP PoC ◀ NOW
Advisory Mode
  • Run all 4 agents with advisory_mode=TRUE
  • 14-day passive live pipeline observation window
  • Track FP/FN rate (§13.1 query) daily
  • Monitor review queue volume and latency
  • Zero schema failures or unhandled JSON errors
  • Steward team processes review queue within capacity
Gate: FN rate = 0 over 14d · FP ≤ 5% · No schema failures
Phase 3 — Controlled Production
Deterministic Gates
  • Enable hard blocking gates per agent (advisory_mode=FALSE)
  • Refactor lookup_exception() to batch-query per run (N→1)
  • Expand golden labels to 100+ per agent (400+ total)
  • Rollback runbook tested end-to-end
  • UC4 Looker dashboard gated by UC4 assurance result
Gate: Model/deterministic agreement ≥ 95% · Zero CRITICAL misses over 2 windows
Phase 4 — Full Production
Bounded Agentic
  • Model-initiated actions within bounded scope
  • Full BigQuery estate coverage
  • Cloud Composer for enterprise-scale scheduling
  • Looker Studio fully integrated and auto-refreshed
  • Data Lineage API at full scale
Gate: Two successful evaluation windows · Rollback test passed
1

Result Table

dq_results.agent_findings — agent_results is RETIRED

2

JSON Payload

payload_json JSON containing {"findings":[...]}

3

Status Enum

PASS | WARNING | FAIL | INSUFFICIENT_DATA

4

Severity Enum

LOW | MEDIUM | HIGH | CRITICAL — always UPPERCASE

5

Evidence Sufficiency

SUFFICIENT | PARTIAL | INSUFFICIENT

6

Routing Targets

RELEASED | PENDING_REVIEW | QUARANTINED

7

Model

gemini-2.5-flash default · gemini-2.5-pro escalation · gemini-2.0-flash RETIRED

8

Decision Ownership

Orchestrator deterministic gate decides. Model proposes only.

9

Ingestion

MERGE-based idempotent only — no plain INSERT ever

10

Rollout Order

Advisory mode → deterministic gates → bounded agentic (in that order)