<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vijay K Joseph</title>
    <description>The latest articles on DEV Community by Vijay K Joseph (@vijay_kjoseph_8d38867d27).</description>
    <link>https://dev.to/vijay_kjoseph_8d38867d27</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3648687%2F70191db9-baaa-4133-8817-2d1f74bb0a47.jpg</url>
      <title>DEV Community: Vijay K Joseph</title>
      <link>https://dev.to/vijay_kjoseph_8d38867d27</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vijay_kjoseph_8d38867d27"/>
    <language>en</language>
    <item>
      <title>The Zero-Trust Data Stack: Building Deterministic Agents with Google ADK</title>
      <dc:creator>Vijay K Joseph</dc:creator>
      <pubDate>Sat, 06 Dec 2025 03:24:43 +0000</pubDate>
      <link>https://dev.to/vijay_kjoseph_8d38867d27/the-zero-trust-data-stack-building-deterministic-agents-with-google-adk-4m52</link>
      <guid>https://dev.to/vijay_kjoseph_8d38867d27/the-zero-trust-data-stack-building-deterministic-agents-with-google-adk-4m52</guid>
      <description>&lt;h2&gt;
  
  
  The "Trusted Analyst" Problem
&lt;/h2&gt;

&lt;p&gt;When business stakeholders ask, “What was our Q3 revenue?” a hallucinating agent can invent numbers or misread columns. In enterprise contexts that becomes legal/financial risk, not a cute demo problem. We need answers that are: correct, explainable, reproducible, and auditable. ADK is designed for building code-first multi-agent systems that make these properties achievable. &lt;br&gt;
DEV Community&lt;br&gt;
+1&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture: A 6-Agent Assembly Line
&lt;/h2&gt;

&lt;p&gt;Design idea: split responsibility across small, well-specified agents. Each agent has a single purpose and uses deterministic tools whenever possible.&lt;br&gt;
Agents (6):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ingestor — accepts file/database input, infers schema, profiles data (row counts, types, nulls).&lt;/li&gt;
&lt;li&gt;Schema &amp;amp; Typing Validator — verifies column types, mappings (e.g., date, currency, customer_id), rejects ambiguous or malformed inputs; produces a canonical schema.&lt;/li&gt;
&lt;li&gt;Deterministic Query Generator — produces SQL using templates and a deterministic engine (no freeform LLM SQL). Uses parameterized templates, typed placeholders, and a SQL AST builder.&lt;/li&gt;
&lt;li&gt;Executor (Safe Runner) — runs SQL queries in a sandboxed environment (read-only, statement limits, sampling) and returns raw results plus execution plan, row counts, and checksums.&lt;/li&gt;
&lt;li&gt;Statistical Checker / Data Profiler — runs deterministic checks on results (aggregates vs expected ranges, null ratios, duplicates, joins cardinality checks), flags anomalies.&lt;/li&gt;
&lt;li&gt;Synthesizer/Reporter (+ Provenance) — creates the human answer, attaches provenance (original query, SQL text, execution plan, checksums, dataset snapshot index), and a confidence score with specific reason string(s).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Visualizing the Flow
&lt;/h2&gt;

&lt;p&gt;(Imagine a left-to-right pipeline.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68tp8r203guuj2t3hqzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68tp8r203guuj2t3hqzj.png" alt=" " width="550" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Secret Sauce": Deterministic Tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The single biggest defense vs hallucination is remove nondeterminism where possible. Examples:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SQL templating + AST builders: Build queries by composing AST nodes (no freeform LLM text). This guarantees syntactic correctness and limits injection / bad reads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Linters and static analyzers (e.g., SQLFluff or a SQL AST validator) to ensure queries follow best practices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deterministic transform functions for parsing dates/numbers: use typed parsers with fallback rules, not heuristic prose.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unit tests &amp;amp; snapshot tests: For every analytic endpoint, run a deterministic suite (e.g., expected aggregate for a fixed seed dataset).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checksums and sampling: the executor returns a hash of the resultset (or top-N canonical sample) so consumers can verify the same result is being used.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Handling the "Messy Reality" of Data
&lt;/h2&gt;

&lt;p&gt;Real data is rarely clean. Practical parts to implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Auto profiling: detect suspicious columns (e.g., numeric stored as string), outlier rates, rate of parsing failures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Column mapping UI / schema prompts: when the validator finds ambiguity (e.g., “is this column revenue or discount?”), surface a small verification step for a human-in-loop or a concise verification prompt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Robust parsing rules: explicit locale/format rules for dates, currencies, thousands separators; fallback strategies that are logged.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Progressive aggregation: for very large datasets, run sampling + incremental aggregations and compare to full-run results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Explainable imputations: if imputing missing data, log method and effect size (e.g., “imputed 12% of revenue rows with median per-customer”).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Escape hatches: allow a user to pin schema or upload a small canonical sample to avoid repeated ambiguity.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The "Evaluator" Loop: AI Checking AI
&lt;/h2&gt;

&lt;p&gt;An evaluator agent runs a suite of automated checks after the initial run:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Replay deterministic steps: re-run SQL templates with the same parameters and confirm checksum matches the Executor’s output.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sanity tests: compare top-line aggregates against last known stable values (e.g., month-over-month bounds), check for impossible values (negative revenue), ensure join cardinalities make sense.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Counterfactual queries: run alternate queries that test assumptions (e.g., run with and without particular filters, or with an extra grouping to see if aggregation collapses).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Explainability check: ensure every synthetic sentence references one or more provenance items (e.g., “Q3 revenue = $X (SQL: …, checksum: …)”).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Score and veto: if checks fail, the evaluator returns a veto with a clear failure reason and suggested remedial action (human review, improved schema mapping, or re-run with different filters).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Practical code sketch (Python + ADK pseudocode)
&lt;/h2&gt;

&lt;p&gt;Below is a simplified sketch to illustrate the idea&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa06tlub4t372xzafl0y1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa06tlub4t372xzafl0y1.png" alt=" " width="800" height="1179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Operational concerns &amp;amp; best practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;RBAC for agents and tools: limit which agents can run writes or access PII. Executor should be read-only by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Observability and replay: store event logs and snapshots so you can repro exactly what happened.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing harness: use codelabs / unit tests to run canned questions against synthetic datasets as regression tests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Human-in-the-loop escalation: for ambiguous answers or high-impact queries, preview SQL + provenance to a human reviewer before presenting to executives.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Release gating: require certain check pass thresholds before promoting a report from staging to production.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Yourself (quick path)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Read the ADK docs &amp;amp; quickstart — get the ADK Python quickstart running. This shows how to define agents and run them locally&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow a codelab — Google codelabs have hands-on examples (code reviewer, travel agent, database toolbox) you can adapt. Start with a DB example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build the minimal pipeline:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ingest: load a CSV and run a deterministic profiler (pandas + custom rules).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Schema validator: map ambiguous columns via a small prompt only for naming help; persist the choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deterministic SQL generator: implement templated SQL functions using a SQL AST library (avoid string concatenation).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Executor: run queries in a read-only sandbox and return a checksum/sample.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checker: implement deterministic checks (counts, sums, null rates).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Synthesizer: LLM generates explanation but always references SQL + checksum.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Add evaluator: make an agent that replays and runs the check suite; if it fails, create a human review ticket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Iterate: add more automated checks and unit tests (snapshot tests of expected aggregates).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>googleaichallenge</category>
      <category>ai</category>
      <category>python</category>
    </item>
  </channel>
</rss>
