<?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: Alex Meador</title>
    <description>The latest articles on DEV Community by Alex Meador (@alex_meador_bad27eb8d7975).</description>
    <link>https://dev.to/alex_meador_bad27eb8d7975</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4103186%2F31b203bc-bed4-4b78-a0ae-654cd02d928b.png</url>
      <title>DEV Community: Alex Meador</title>
      <link>https://dev.to/alex_meador_bad27eb8d7975</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alex_meador_bad27eb8d7975"/>
    <language>en</language>
    <item>
      <title>Your agent demo is rigged (mine was too), so I let the judges write the tests</title>
      <dc:creator>Alex Meador</dc:creator>
      <pubDate>Mon, 31 Aug 2026 18:22:48 +0000</pubDate>
      <link>https://dev.to/alex_meador_bad27eb8d7975/your-agent-demo-is-rigged-mine-was-too-so-i-let-the-judges-write-the-tests-nad</link>
      <guid>https://dev.to/alex_meador_bad27eb8d7975/your-agent-demo-is-rigged-mine-was-too-so-i-let-the-judges-write-the-tests-nad</guid>
      <description>&lt;p&gt;&lt;em&gt;Built for the All Things Agentic Hackathon. The project: an autonomous&lt;br&gt;
compliance agent for cannabis track-and-trace, running on Cloud Run with&lt;br&gt;
Gemini 3.5 Flash. This post is about the test harness, because it turned out to be the most interesting part.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The objection every agent demo deserves
&lt;/h2&gt;

&lt;p&gt;Every hackathon agent demo has the same silent flaw: the person who built the agent also built the test. Of course the agent passes. The demo world was constructed, consciously or not, around what the agent is good at.&lt;/p&gt;

&lt;p&gt;My project had this problem in an acute form. It reconciles a cannabis&lt;br&gt;
facility's inventory against METRC - the state seed-to-sale system that is&lt;br&gt;
legally the record of what exists - and decides whether packages can be&lt;br&gt;
released under Kentucky's testing regulation, 915 KAR 1:110. There's no way to demo against production METRC (vendor API access requires a&lt;br&gt;
training-and-agreement process), so the whole thing runs against a fixture&lt;br&gt;
service I wrote: a fake METRC that serves the documented v2 API shapes from Firestore.&lt;/p&gt;

&lt;p&gt;So the pitch is "my agent correctly polices a world I invented." Rigged, by construction.&lt;/p&gt;
&lt;h2&gt;
  
  
  The fix: make the regulation the ground truth, then hand over the keys
&lt;/h2&gt;

&lt;p&gt;Two design moves converted the objection into the project's strongest&lt;br&gt;
property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First: the agent is never the reference. The regulation is.&lt;/strong&gt; The required test panels from 915 KAR 1:110 Section 2 are stored as structured data - ten analyte categories for finished product, three for an in-process batch, each with its citation. Whether a package's testing is complete is a &lt;em&gt;set difference computed in code&lt;/em&gt;, before any model is consulted. Anyone holding the same METRC record and the same regulation text can check every decision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second: judges can construct worlds I never wrote.&lt;/strong&gt; The fixture service&lt;br&gt;
takes a compact spec:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"packages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"item"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1oz THC Tincture"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Tincture"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"tests"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"finished"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"omit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"mycotoxins"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"item"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bulk Live Resin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Concentrate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"tests"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"production"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"fail"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"solvents"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One POST expands that into a full world - realistic METRC package records,&lt;br&gt;
lab results with plausible levels, transfer manifests - served over the same API surface as the seeded demo. Then you trigger a cycle and grade the agent yourself, against the regulation, on a case whose answer I never knew in advance.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened the first time someone (me) actually did this
&lt;/h2&gt;

&lt;p&gt;The first custom scenario ever run against the deployed system found three&lt;br&gt;
bugs in an evening. None of them were the model being wrong. All of them were the model being right about something &lt;em&gt;I&lt;/em&gt; got wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bug 1: my "passing" data was physically absurd.&lt;/strong&gt; The generator gave every product the same passing values, so a concentrate carried 1.2% total THC and a solventless rosin carried a butane result. Gemini escalated both as implausible - correctly. A rosin with residual butane on file is what a wrong-matrix lab result actually looks like. Lesson: &lt;strong&gt;generated test data must be boring.&lt;/strong&gt; If your fixtures trip the agent's plausibility instincts, every scenario drowns in false alarms and the agent looks paranoid instead of careful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bug 2: my records were internally contradictory.&lt;/strong&gt; A spec that failed a&lt;br&gt;
test still stamped the package &lt;code&gt;TestPassed&lt;/code&gt; in the METRC state field. The&lt;br&gt;
model refused to act on the contradiction and asked for a human. Right again. The state-vs-results contradiction is a &lt;em&gt;legitimate&lt;/em&gt; scenario - but it should be constructed on purpose, not seeded by accident.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bug 3 (the one that mattered): escalation left a failing package&lt;br&gt;
movable.&lt;/strong&gt; My rules layer had a principle I was proud of: escalation performs no write, because an agent that escalates to a human and then acts anyway hasn't escalated. The custom scenario exposed the flaw: the model escalated a failing-solvents record, no write happened, and a package with a failing required test &lt;strong&gt;stayed movable in the system of record&lt;/strong&gt;. A real compliance officer would never do that - you freeze the package &lt;em&gt;pending&lt;/em&gt; review. The fix distinguishes ambiguity (escalate, touch nothing) from hard evidence (a missing or failing required test: protective hold first, then escalate). Freezing state isn't deciding the outcome; it's making sure nothing moves while the human decides.&lt;/p&gt;

&lt;p&gt;That distinction is now enforced in code, covered by tests, and I would not have found it by running my own scenarios - because my own scenarios were built around the rules I already believed in.&lt;/p&gt;

&lt;h2&gt;
  
  
  The generalizable bit
&lt;/h2&gt;

&lt;p&gt;If you're building an agent that acts on a system of record, the harness&lt;br&gt;
pattern that made this trustworthy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Store the rules as data, diff in code, let the model explain.&lt;/strong&gt; The
safety-critical invariant should never depend on a language model's
reading - models can be talked out of anything. Compute the finding
deterministically; use the model for judgement, prose, and noticing what state fields can't express.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Publish the world-builder, not just the world.&lt;/strong&gt; A demo world proves
you can pass your own test. A generator proves you'll accept anyone's.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make bad specs loud.&lt;/strong&gt; In my generator, an &lt;code&gt;omit&lt;/code&gt; pattern that matches no test is an error, not a silent no-op - a judge whose scenario quietly tests less than they intended has been misled by the harness itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Include the boring cases.&lt;/strong&gt; A fully compliant world where the agent
correctly finds &lt;em&gt;nothing&lt;/em&gt; is a required fixture. An agent that only ever raises alarms has demonstrated nothing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The repo - agent, MCP servers, fixture service, generator, and the findings log with everything above in more detail - is MIT-licensed. The agent runs hourly on Cloud Run with nobody watching; the demo buttons exist for judges, but last night's log is the real evidence.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Stack: TypeScript, LangGraph, Gemini 3.5 Flash via the Google Gen AI SDK on Vertex AI, MCP for all tool access, Cloud Run + Cloud Scheduler + Firestore.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>llm</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
