<?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: Triptease ProdEng</title>
    <description>The latest articles on DEV Community by Triptease ProdEng (@triptease-admin).</description>
    <link>https://dev.to/triptease-admin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4240842%2F9a86c2e0-86e9-4ffa-b98f-6f9ec16003e2.webp</url>
      <title>DEV Community: Triptease ProdEng</title>
      <link>https://dev.to/triptease-admin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/triptease-admin"/>
    <language>en</language>
    <item>
      <title>How we turned agentic babble into an audit trail for our data warehouse</title>
      <dc:creator>Triptease ProdEng</dc:creator>
      <pubDate>Tue, 24 Nov 2026 11:43:24 +0000</pubDate>
      <link>https://dev.to/triptease/how-we-turned-agentic-babble-into-an-audit-trail-for-our-data-warehouse-4f81</link>
      <guid>https://dev.to/triptease/how-we-turned-agentic-babble-into-an-audit-trail-for-our-data-warehouse-4f81</guid>
      <description>&lt;p&gt;Work that sits between software engineering and data engineering tends to involve writing a lot of SQL in BigQuery. A small amount of this ends up checked in as production code, but more often than not it's just one-off analysis to aid with understanding, debugging and decision-making.&lt;/p&gt;

&lt;p&gt;We were thrilled when, around spring this year, LLMs got consistently good enough at GoogleSQL (BigQuery's dialect) that using them became faster than writing by hand.&lt;/p&gt;

&lt;p&gt;We began to wonder if AI could do some simple data investigations autonomously, especially the kind where finding the answer is slow but verifying is quick.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cost and motivation
&lt;/h2&gt;

&lt;p&gt;Our BigQuery warehouse is priced &lt;a href="https://cloud.google.com/bigquery/pricing?hl=en#on-demand-compute-pricing" rel="noopener noreferrer"&gt;on-demand&lt;/a&gt;. That means you pay for the amount of data that each query reads. BigQuery offers several mitigations for this, including &lt;a href="https://docs.cloud.google.com/bigquery/docs/clustered-tables" rel="noopener noreferrer"&gt;clustering&lt;/a&gt; and &lt;a href="https://docs.cloud.google.com/bigquery/docs/partitioned-tables" rel="noopener noreferrer"&gt;partitioning&lt;/a&gt;, as well as the ability to dry-run a query to see how much it would bill before executing it.&lt;/p&gt;

&lt;p&gt;Part of the analyst's job, then, is to dry-run, check the estimate, find out how the underlying table is partitioned and clustered, then optimise the SQL as appropriate. This was not an optional part of the job: an unoptimised auto-refreshing dashboard could easily produce a six-figure bill.&lt;/p&gt;

&lt;p&gt;Herein lay the first problem with letting an agent go autonomous. Agents are trained to complete the task you give them, and they may or may not follow additional instructions. When writing, dry-running and optimising a query was their goal, they did a great job; but as soon as a higher-level goal requiring multiple queries was in play, they tended to "forget" to dry-run and check costs and start spending more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quotas and caps
&lt;/h2&gt;

&lt;p&gt;We built a simple MCP server to connect our agents to BigQuery with a hand-written version of the same thing: a hard cap on total query spend, set at $5 and enforced by the server for as long as it runs. Agents submit SQL to a &lt;code&gt;query&lt;/code&gt; tool, which alongside the results of the query returns some metadata about query cost and the remaining balance under the cap. It also provided the option to dry run a query to get a cost estimate.&lt;/p&gt;

&lt;p&gt;This was the scene of the first happy accident. We realised that &lt;em&gt;the presence alone&lt;/em&gt; of a cost cap immediately incentivises agents to be efficient about cost. They started &lt;em&gt;caring&lt;/em&gt; about selecting few columns, dry-running to check cost, and iterating on partition pruning. The introduction of a "budget", visibly dwindling after each query, made them more careful than they had been with any static prompt!&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter The Synopsis
&lt;/h2&gt;

&lt;p&gt;After a couple of months of daily usage, then expanding to some technical colleagues, we could see that the agent was rarely making mistakes in query correctness. We started wondering whether we could expand to less technical colleagues as well - by which we mean users who weren't necessarily able to check the correctness of the SQL themselves. One rule has never moved: any number that reaches a customer is verified against our canonical sources - our BI tooling and our customer-facing platform - before it goes anywhere.&lt;/p&gt;

&lt;p&gt;The problem was that just looking at a SQL query is not enough to know whether it is correct &lt;em&gt;in the context of its session&lt;/em&gt;. You need to know the question if you want to check the answer.&lt;/p&gt;

&lt;p&gt;This is where the second happy accident comes in. If you've used an LLM to generate code, or a coding agent, you'll know that they really, &lt;em&gt;really&lt;/em&gt; like to talk about what they're doing. They will put paragraphs and paragraphs of text into the chat window, into docblock and inline comments, into additional report documents and readmes, basically wherever.&lt;/p&gt;

&lt;p&gt;We speculatively added a new &lt;code&gt;synopsis&lt;/code&gt; field in the query tool, documented thusly:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;synopsis: string&lt;/code&gt;&lt;br&gt;&lt;br&gt;
&lt;code&gt;One-sentence summary of the query motivation/context, logged for audit.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To our amazement, it had exactly the effect we were expecting. Agents were completely happy to explain what they were doing into this field. Including why they were doing it, and so on. They weren't ever trying to skip the field, or just adding a placeholder, and in the sessions we sampled we never once saw them lie. Some examples, with the internal specifics changed:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Monthly active accounts by plan tier, for a retention tile on an internal dashboard&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Exchange rate for a given month, to normalise reported revenue into a single currency&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;List available reporting views/tables to locate signup-funnel sources for a quarterly summary&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We'd finally found a positive outlet for the LLM tendency to spew unnecessary context everywhere!&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent-driven development
&lt;/h2&gt;

&lt;p&gt;The synopsis field, combined with BigQuery's own audit logs, gave us an observability dream. After a few weeks in production, we had a thousands-long labelled dataset of questions and answers. With this, we were able to identify problems, extract reproduction cases, make fixes, and also add evidence-based new features.&lt;/p&gt;

&lt;p&gt;For example, the first iteration gave no indication of how agents should discover what tables were available to answer a question. They generally ended up guessing project names, and reading &lt;code&gt;INFORMATION_SCHEMA.COLUMNS&lt;/code&gt; in the guessed projects. That surfaced deprecated tables alongside the current ones, so the agent sometimes picked the wrong one and had to be corrected - obvious to us, less so to a colleague who didn't know the history. We also noticed that agents were rarely discovering our table functions, even when one existed that would have answered the exact question.&lt;/p&gt;

&lt;p&gt;To fix this, we compressed an index of the supported surface (which doesn't change often) into the MCP's readme, and created a &lt;code&gt;catalogue&lt;/code&gt; tool that described datasets, tables, table functions, views, and other objects in detail in a structured and controlled way.&lt;sup id="fnref1"&gt;1&lt;/sup&gt; This stopped agents guessing at table names overnight,  took the deprecated tables out of reach, and reduced almost to zero the number of INFORMATION_SCHEMA queries they were running.&lt;/p&gt;

&lt;p&gt;We've also been able to use the data to progressively increase the quality of the documentation around our BigQuery estate in an evidence-based way. For example, when agents were having to run expensive queries to guess the values of an enum value, we added the possible values to the column description and the guessing stopped straightaway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents aren't like humans
&lt;/h2&gt;

&lt;p&gt;That agents comply so remarkably consistently with the synopsis request is a key and difficult-to-intuit difference between a human and an agent. As humans, we'd be deeply annoyed if we had to write a synopsis with every query. Accurately summarising context into a sentence or two is something we find difficult, and it seems irrelevant to the task at hand. We'd end up writing &lt;code&gt;"get data for report"&lt;/code&gt; or &lt;code&gt;"asldkfjhsd"&lt;/code&gt; or something equally useless just to get past the validation.&lt;/p&gt;

&lt;p&gt;The incredible difference in performance between an upfront prompt saying "You may only spend $5", and a repeated inline tool call result specifying how much of that $5 the agent has left, was another surprising finding. If you can make a soft constraint (an instruction in the prompt) into a hard one (continuous evidence that their ability to complete the main task will degrade if they aren't careful), agents are much more likely to follow it.&lt;/p&gt;

&lt;p&gt;We've also seen the huge need for a data-driven approach. When working with agents, we can never capture an entire task space in tests, because that means the entire space of English language - not to mention the fact that models are always changing and being upgraded. This is a world where hypotheses must more than ever be tested with real data before they are acted upon.&lt;/p&gt;

&lt;p&gt;Learning how to appraise these kinds of differences, and build and plan for them, will be key to the level of performance, safety, and reliability that we can get out of agentic systems in the future.&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;You'd think BigQuery would have one of these built in, and it sort of does for tables and views, but it's not quite fit for TVFs. For example, it doesn't give the return type of a TVF invocation, so we were finding agents ended up inspecting the function body instead just to find out types - we didn't want this, because our TVFs are often hundreds of lines of quite difficult and easily-misinterpretable code. To get around this, this needed something nastier: running &lt;code&gt;SELECT * FROM tvf(CAST(NULL AS type1), CAST(NULL AS type2), ...)&lt;/code&gt;, produces a query that compiles just well enough to dry-run and return the column types in the job metadata.&amp;nbsp;↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>dataengineering</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
