<?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: Demba Fofana</title>
    <description>The latest articles on DEV Community by Demba Fofana (@demba09).</description>
    <link>https://dev.to/demba09</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%2F4037416%2Ff826bdcf-106c-4e00-8d70-36e5245e8c71.png</url>
      <title>DEV Community: Demba Fofana</title>
      <link>https://dev.to/demba09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/demba09"/>
    <language>en</language>
    <item>
      <title>I Built an Agent That Refuses to Act — Here's Why Qwen Made It Possible</title>
      <dc:creator>Demba Fofana</dc:creator>
      <pubDate>Mon, 20 Jul 2026 19:31:54 +0000</pubDate>
      <link>https://dev.to/demba09/i-built-an-agent-that-refuses-to-act-heres-why-qwen-made-it-possible-ce0</link>
      <guid>https://dev.to/demba09/i-built-an-agent-that-refuses-to-act-heres-why-qwen-made-it-possible-ce0</guid>
      <description>&lt;p&gt;Monday, 9am. Conversion drops 3.2%. The PM pings Slack: &lt;em&gt;"What happened?"&lt;/em&gt;&lt;br&gt;
A data engineer queries the warehouse. A data analyst slices dashboards — segment&lt;br&gt;
by segment, device by device. Four hours later: maybe they found it. Maybe the&lt;br&gt;
drop was systemic and they just burned a morning chasing ghosts.&lt;br&gt;
At $200/hour for a data engineer + analyst pair, that's &lt;strong&gt;~$900 per&lt;br&gt;
investigation&lt;/strong&gt;. This happens 2-3 times a week at any SaaS company with&lt;br&gt;
meaningful traffic. That's &lt;strong&gt;$3,200/week&lt;/strong&gt; — over $150K/year — spent answering&lt;br&gt;
one recurring question: "why did this metric move?"&lt;br&gt;
I built an agent that does the same job in 2 seconds for &lt;strong&gt;$0.004&lt;/strong&gt;.&lt;br&gt;
Powered by Qwen.&lt;/p&gt;




&lt;h2&gt;
  
  
  What a data team does. Automated.
&lt;/h2&gt;

&lt;p&gt;When a metric drops, here's what your data engineer and analyst actually do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Query the data.&lt;/strong&gt; Engineer pulls two snapshots from the warehouse — last
week vs. this week, segmented by dimensions. 30 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build segment breakdowns.&lt;/strong&gt; Analyst computes per-segment rates,
contribution shares, significance thresholds. 2 hours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluate significance.&lt;/strong&gt; Is that drop on the paid channel real, or is the
sample too small? 30 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check for confounding.&lt;/strong&gt; Did the rate actually change, or did the
population mix shift? Another 30 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decide.&lt;/strong&gt; Act or escalate? 30 minutes.
&lt;strong&gt;Total: ~4.5 hours. $900. And no guarantee they got it right.&lt;/strong&gt;
Here's what prove-or-abstain does with that same data:
POST /investigate { "panel": "clean" }
→ 2 seconds
→ ASSERT segment=paid (p &amp;lt; 0.001)
→ EXECUTE: webhook fires, campaign paused
Same raw data. Same conclusion. &lt;strong&gt;22,500 times faster. 50,000 times cheaper.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  How it knows when to act — and when to shut up
&lt;/h2&gt;

&lt;p&gt;This isn't a prompt you ask nicely. The agent routes every candidate dimension&lt;br&gt;
(device, country, channel, plan...) through four mathematical gates. All four&lt;br&gt;
must pass before it's allowed to ASSERT a cause:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Material&lt;/strong&gt; — the drop is at least 2%. Noise isn't worth a human's time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Localized&lt;/strong&gt; — one segment accounts for ≥55% of the drop. If every channel
dipped equally, no single action fixes it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Significant&lt;/strong&gt; — a real two-proportion z-test, p ≤ 0.01. Same perfectly
concentrated drop passes on 6,000 users, fails on 60. Your analyst would
do the same check — the agent just does it instantly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean&lt;/strong&gt; — rate and mix effects aren't entangled. No confusing a
composition shift with a real rate change.
Any gate fails → &lt;strong&gt;ABSTAIN&lt;/strong&gt;. The agent escalates to a human with the exact
failing condition named. Not "I don't know." &lt;em&gt;"Interaction share 0.63 &amp;gt; 0.50 —
rate and mix effects are entangled; this needs a human."&lt;/em&gt;
&lt;strong&gt;This is the cost-saving mechanism.&lt;/strong&gt; An ABSTAIN means: &lt;em&gt;I just saved you from
acting on a wrong diagnosis.&lt;/em&gt; The PM doesn't roll back a deploy. The engineer
doesn't revert a feature flag. No one builds a dashboard for a phantom problem.
That's where the real money is — not the investigation time, but the &lt;strong&gt;false
action prevented&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Why Qwen
&lt;/h2&gt;

&lt;p&gt;Your data team costs $200/hour. You can't just throw any LLM at this and expect&lt;br&gt;
it to replace them — you need one that makes reliable tool calls, never invents&lt;br&gt;
dimension names, and produces consistent behavior across model tiers.&lt;br&gt;
Qwen (via Alibaba Cloud DashScope) hit all three:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tool calling that doesn't hallucinate.&lt;/strong&gt; Qwen drives the investigation by
calling &lt;code&gt;test_dimension(device)&lt;/code&gt;, reading the gate result, then trying
&lt;code&gt;test_dimension(segment)&lt;/code&gt; — choosing &lt;em&gt;which&lt;/em&gt; dimension to test, but never
inventing one that doesn't exist. A determinism guard tests every dimension
Qwen skipped, so a lazy LLM can never produce a false "nothing to see here."
Every decision traces back to math, not model confidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model interchangeability without cost penalty.&lt;/strong&gt; Swap qwen-turbo, qwen-plus,
or qwen-max — same ASSERT/ABSTAIN verdict. Run the cheapest model, get the
same correctness. The benchmark proves it across all three. At $0.40/M input
tokens, an investigation averages ~4,500 tokens total — &lt;strong&gt;$0.004.&lt;/strong&gt; That
number isn't approximate. It's metered per request and committed in CI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mock mode proves the LLM is separable.&lt;/strong&gt; Run with &lt;code&gt;QWEN_MOCK=1&lt;/code&gt; — zero API
calls, deterministic templates. Every verdict is bit-identical. Qwen conducts
the investigation. The math decides the outcome. If you audit this agent, you
can &lt;em&gt;see&lt;/em&gt; the LLM decided nothing. That's the contract you need when you're
trusting it to replace two salaries.
The one place Qwen genuinely judges? Mapping unfamiliar CSV columns to &lt;code&gt;[metric,
dims..., n, c]&lt;/code&gt;. Ambiguous column names have no mechanically-deducible answer,
so I built a &lt;strong&gt;two-pass self-verification system&lt;/strong&gt;: Qwen proposes a mapping,
then re-examines its own work against the sample rows. If it misclassified
&lt;code&gt;Temperature&lt;/code&gt; as a dimension instead of a covariate, it corrects itself — labeled
&lt;code&gt;self_verified: false&lt;/code&gt;, auditable and transparent.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The number that should change how you think about AI agents
&lt;/h2&gt;

&lt;p&gt;I ran prove-or-abstain on 10 real public datasets — Titanic passenger manifests,&lt;br&gt;
US college majors with real employment stats, airline passenger counts, penguin&lt;br&gt;
populations, car fuel economy, the Gapminder dataset, and more.&lt;br&gt;
&lt;strong&gt;7 out of 10 produced ABSTAIN.&lt;/strong&gt;&lt;br&gt;
Because in the real world, most metric shifts are genuinely systemic. They don't&lt;br&gt;
localize to a clean, actionable segment. An agent that fabricates a cause on&lt;br&gt;
those seven is a &lt;strong&gt;financial liability&lt;/strong&gt; — it triggers actions that cost more&lt;br&gt;
than the original investigation.&lt;br&gt;
Your analyst might spend 4 hours and &lt;em&gt;still&lt;/em&gt; reach the same conclusion:&lt;br&gt;
"this is systemic, escalate." The agent reaches it in 2 seconds. For $0.004.&lt;br&gt;
And it documents exactly &lt;em&gt;why&lt;/em&gt;, with a replayable audit trail.&lt;br&gt;
The three that did ASSERT found real, unplanted truths:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Titanic survival localizes to &lt;code&gt;sex=female&lt;/code&gt; (p=0.0018) — the "women and
children first" effect, not the popular &lt;code&gt;pclass&lt;/code&gt; explanation&lt;/li&gt;
&lt;li&gt;The STEM employment gap concentrates in majority-women college majors&lt;/li&gt;
&lt;li&gt;Penguin body mass variation localizes to species&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What this means for your team
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Current cost per investigation&lt;/th&gt;
&lt;th&gt;With prove-or-abstain&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Data engineer (query + prepare)&lt;/td&gt;
&lt;td&gt;$100 (30 min)&lt;/td&gt;
&lt;td&gt;$0 (automated)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data analyst (segment + evaluate)&lt;/td&gt;
&lt;td&gt;$400 (2 hours)&lt;/td&gt;
&lt;td&gt;$0.004 (2 seconds)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;False diagnosis risk (rollback, revert)&lt;/td&gt;
&lt;td&gt;$500-5,000 per incident&lt;/td&gt;
&lt;td&gt;$0 (ABSTAIN prevents it)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total per investigation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$500-900 + risk&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.004, guaranteed&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Per month (10 investigations)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$5,000-9,000&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.04&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The agent doesn't get tired. It doesn't skip the significance check at 5pm on a&lt;br&gt;
Friday. It doesn't have a gut feeling that the mobile team shipped something&lt;br&gt;
buggy and confirmation-bias its way there. It runs the same four gates every&lt;br&gt;
time and names exactly which one failed.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;20/20 benchmark accuracy. 0% false-ASSERT. 0% false-ABSTAIN.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;$0.004 per investigation. Docker. MIT license.&lt;/strong&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bash
git clone https://github.com/Demba09/prove-or-abstain
cd prove-or-abstain &amp;amp;&amp;amp; pip install -r requirements.txt
QWEN_MOCK=1 uvicorn api.app:app
# Open http://localhost:8000 — no API key needed
Built for the Qwen Cloud Hackathon (Track 4 — Autopilot Agent).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>qwen</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
