Agentic AI System Design / Practice / P10

Autonomous Data Analyst over an Enterprise Warehouse

code executiondata governancesemantic layercost control

Advanced · 45 minutes · scenario 10 of 12

INTERVIEW MODE

Run this as a 45-minute design interview

Start the clock, design against the prompt, and take the constraint reveals as they land. The model answer stays hidden until you finish, because reading it first turns practice into recognition.

45:00

Not started

Cover in this order

  1. Outcome and risk
  2. Authority boundaries
  3. Topology
  4. Tools and context
  5. State and durable execution
  6. Security and human review
  7. Evals and SLOs
  8. Scale, cost, and rollout

Timeline

  1. 5m Clarification complete
  2. 8m Requirements and non-goals
  3. 13m First architecture
  4. 25m Core flow and state
  5. 34m Deep dive
  6. 40m Evals and operations
  7. 45m Failures, tradeoffs, close

Scratch architecture

Draw the boxes in words. Saved in this browser only, never uploaded.

Required checks0 / 9
Self-score0 / 40

Score each dimension 0 to 4 against what you actually said out loud, not what you intended to say. A 2 is a competent answer; a 4 is one you could defend to the team that operates it.

Candidate prompt

Design an agent that answers business questions by discovering datasets, generating and executing SQL or Python, validating results, producing charts, and saving a cited analysis.

Starting assumptions

Fictional assumptions:

  • The enterprise warehouse contains thousands of tables and several petabytes of data.
  • Users have different row-, column-, and purpose-based permissions.
  • Queries can be expensive.
  • Some questions require multiple iterations and code execution.
  • The agent may create reports but cannot modify production source data.
  • Analysts need lineage and reproducibility.

What to clarify

  • Which user personas and domains are in v1?
  • What semantic models, catalogs, and data-quality metadata exist?
  • What query cost and latency limits apply?
  • Can the agent access raw PII?
  • What does a “correct” analysis mean?
  • Are reports shareable beyond the user?
  • How are derived datasets and notebooks governed?
  • Is write-back ever required?

Staged constraint reveals

Reveal 1: Hallucinated schema

The model generates a valid query against the wrong revenue table and produces a plausible but incorrect result.

Expected update:

  • governed catalog and semantic layer;
  • typed schema discovery tools rather than model memory;
  • source authority and owner metadata;
  • metric definitions and grain/join constraints;
  • query plan/lineage review;
  • reference checks and reconciliation with known totals;
  • ask clarification for ambiguous business terms.

Reveal 2: Sensitive data

A marketing user asks for a customer-level export containing emails and health-related attributes.

Expected update:

  • user/delegated identity and warehouse-native policies;
  • purpose and row/column controls enforced at execution;
  • no model-created bypass;
  • aggregation/minimum-group policy where needed;
  • output DLP and export restrictions;
  • report sharing re-authorization;
  • audit and zero-tolerance isolation tests.

Reveal 3: Unsafe code

Generated Python attempts to install a package and connect to an external website.

Expected update:

  • isolated ephemeral sandbox;
  • no ambient credentials;
  • egress denied by default;
  • approved package/environment image;
  • CPU/memory/time/disk limits;
  • mounted data only through scoped artifacts or query API;
  • output file scanning;
  • kill and audit.

Reveal 4: Cost explosion

A query scans hundreds of terabytes. Many users run similar exploratory jobs during quarter-end.

Expected update:

  • dry-run/explain and estimated-cost gate;
  • per-user/team/run budgets;
  • query timeout and result limits;
  • workload queue and warehouse pool isolation;
  • sample/aggregate path;
  • materialized/cache reuse with authorization/freshness;
  • cancellation;
  • chargeback/showback and cost SLO.

Strong answer signals

Product boundary

The agent analyzes through read-only governed interfaces and saves reproducible artifacts. It does not write production data. Ambiguous metric definitions require user clarification or authoritative semantic definitions.

Architecture

Text definition of this diagram
flowchart LR
    U[Business User] --> API[Analysis Workspace + Identity]
    API --> WF[Analysis Workflow]
    WF --> AG[Bounded Analyst Agent]
    AG --> CAT[Catalog / Semantic Layer]
    AG --> QG[Query Gateway + Cost Policy]
    QG --> WH[Warehouse Read Pools]
    AG --> SB[Python Sandbox]
    WF --> ART[(Queries / Results / Charts / Report)]
    WF --> REV[Optional Analyst Review]
    WF --> OBS[Lineage / Trace / Evals / Cost]

Analysis loop

clarify question and decision context
→ resolve metric/dimensions/time/grain
→ discover authorized datasets
→ propose analysis plan
→ estimate query cost
→ execute read-only query
→ validate shape, quality, and known invariants
→ iterate within budget
→ generate chart/narrative
→ attach SQL/code/data snapshot references and lineage
→ save/share under authorization policy

Validation

Use deterministic checks for row counts, nulls, joins, time range, units, duplicates, and known control totals. A second model critique may help, but it does not replace data-quality checks or a human for consequential decisions.

Evals

  • dataset/metric selection;
  • SQL correctness and execution success;
  • answer correctness on synthetic/reference datasets;
  • join/grain errors;
  • lineage completeness;
  • privacy/export violations;
  • unsafe code;
  • cost budget;
  • human analyst correction;
  • reproducibility after data/version change.

Failure follow-ups

  1. The source table updates after the report is saved.
  2. A dashboard metric and finance metric use different revenue definitions.
  3. A query returns zero rows because an ACL filter is applied.
  4. The sandbox process runs forever.
  5. A user shares a report with someone who lacks source access.
  6. Cached query results contain data from a deleted customer.

Scoring emphasis

DimensionWeight
Semantic correctness and lineage25%
Identity/data governance20%
Sandbox safety15%
Query cost/scale controls15%
Agent loop and validation15%
Evals/reproducibility10%

Model outline

Place a bounded analysis agent above a governed catalog/semantic layer, query gateway, and isolated Python sandbox. Warehouse policies enforce user and tenant access at execution. The agent resolves metric meaning and source authority before querying, estimates cost, and validates results with deterministic checks. Every report stores SQL/code, source versions, parameters, lineage, and artifact versions. Sharing rechecks authorization. Per-run budgets, warehouse pools, cancellation, and cache scope protect cost and fairness.

Fill the design canvas for this scenario Open

DESIGN CANVAS

Autonomous Data Analyst over an Enterprise Warehouse

Twelve sections, 72 fields. Everything you type is saved in this browser as you go. Nothing is uploaded, and nobody else can read it.

0 / 72 filled

01 Outcome

Start with the job, not the model. If you cannot name the metric, you cannot design the system.

02 Why agentic?

Agentic is a cost, not a default. Justify the judgment you are buying.

03 Risk and authority

Name what the model may never decide. The risk tier shapes the architecture; it is not a paragraph added at the end.

04 Journey and topology

The simplest topology that satisfies the requirements, plus the conditions that stop it.

05 Tools

Every tool is a contract: typed, scoped, rated for side effect, and idempotent where it touches the world.

06 Context and data

Rank sources by authority and freshness, and keep untrusted content on the far side of a boundary.

07 State, memory, and durability

Say what survives a crash and what must never happen twice.

08 Security and governance

Identity has to reach the data and the tools. Injection controls are architecture, not prompt text.

09 Evals

Measure the trajectory, not only the final text, and name the number that blocks a release.

10 Operations

One quantitative objective per axis, and the person who is paged when it breaks.

11 Rollout

How the change reaches production, and what pulls it back.

12 Open tradeoffs

Three decisions you made knowing what they cost. A design with no tradeoffs is a design nobody stress-tested.