<?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: Neel Deshmane</title>
    <description>The latest articles on DEV Community by Neel Deshmane (@neel_deshmane_622415054c1).</description>
    <link>https://dev.to/neel_deshmane_622415054c1</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%2F4268444%2Fda0cd731-f40e-4b1b-bb4e-ac38f6786e9e.png</url>
      <title>DEV Community: Neel Deshmane</title>
      <link>https://dev.to/neel_deshmane_622415054c1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/neel_deshmane_622415054c1"/>
    <language>en</language>
    <item>
      <title>Introducing DriftCatch — behavioural testing Framework for AI agents</title>
      <dc:creator>Neel Deshmane</dc:creator>
      <pubDate>Fri, 27 Nov 2026 08:20:48 +0000</pubDate>
      <link>https://dev.to/neel_deshmane_622415054c1/introducing-driftcatch-behavioural-testing-framework-for-ai-agents-2ig3</link>
      <guid>https://dev.to/neel_deshmane_622415054c1/introducing-driftcatch-behavioural-testing-framework-for-ai-agents-2ig3</guid>
      <description>&lt;p&gt;An AI agent can return exactly the answer you expect while its decisions, tool usage and execution path have silently changed.&lt;/p&gt;

&lt;p&gt;A prompt tweak, a model update or a tool-schema edit can all introduce a behavioural regression that output-based testing will never catch. The answer still reads correctly, so every eval passes.&lt;/p&gt;

&lt;p&gt;Consider a change like this to a refund agent's system prompt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resolve the customer's issue.&lt;/li&gt;
&lt;li&gt;Resolve the customer's issue carefully.
One word. The replies still read perfectly well. But the agent may now escalate cases it used to refund — and if your assertions are about the answer, nothing catches it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built DriftCatch.&lt;/p&gt;

&lt;p&gt;pip install driftcatch&lt;br&gt;
import driftcatch as drift&lt;/p&gt;

&lt;p&gt;def test_refund():&lt;br&gt;
    with drift.take("refund_1182") as take:&lt;br&gt;
        my_agent("refund order 1182")&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;take.assert_tools().called_in_order("lookup_order", "issue_refund")
take.assert_invariants().hold()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;First run records. Every run after replays from disk — no network, no tokens, deterministic. It hooks httpx, so OpenAI, Anthropic, LangChain, LlamaIndex or your own loop all work with no adapter.&lt;/p&gt;

&lt;p&gt;The part I think is actually new&lt;br&gt;
Record/replay for agents already exists. What I hadn't seen is mining the rules out of the runs you've approved:&lt;/p&gt;

&lt;p&gt;$ drift learn&lt;br&gt;
Mined 13 invariant(s) from 23 approved recording(s)&lt;/p&gt;

&lt;p&gt;lookup_order always runs before check_eligibility      23/23&lt;br&gt;
  issue_refund is always the last tool                   18/18&lt;br&gt;
  escalate_to_human is offered but never called          23/23&lt;br&gt;
  issue_refund.args.order_id always equals&lt;br&gt;
    lookup_order.args.order_id                           18/18&lt;br&gt;
Nobody wrote those. The last one — the order you look up is the order you refund — is a real bug class nobody tests for. It breaks when someone reuses a loop variable.&lt;/p&gt;

&lt;p&gt;This is specification mining, which Daikon has done for ordinary programs since 2001. Agent trajectories turn out to fit it well.&lt;/p&gt;

&lt;p&gt;The hard part isn't mining, it's not mining garbage. Four filters: minimum support of 5 runs, a confidence gate of 1 - 0.5^support, the value has to actually vary across runs (two constants that match aren't a relationship), and transitive rules get dropped. That took 19 mined rules down to 15.&lt;/p&gt;

&lt;p&gt;Rules are proposed as pending. A human enforces them, or doesn't.&lt;/p&gt;

&lt;p&gt;When it fails, it names the cause&lt;br&gt;
$ drift bisect refund_1182 --previous&lt;/p&gt;

&lt;p&gt;golden:    lookup_order -&amp;gt; check_eligibility -&amp;gt; issue_refund&lt;br&gt;
  candidate: lookup_order -&amp;gt; check_eligibility -&amp;gt; escalate_to_human&lt;/p&gt;

&lt;p&gt;ROOT CAUSE: the system prompt.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- issue.
+ issue carefully.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Four inputs are fingerprinted separately — system prompt, model id, tool schemas, matcher config — so drift gets attributed instead of shrugged at.&lt;/p&gt;

&lt;p&gt;The rest&lt;br&gt;
Behaviour coverage — which tools, paths and error branches you've actually tested, plus suggested scenarios for the gaps&lt;br&gt;
What-if — swap a recorded event at replay time to drive failure and retry paths, without recording anything new&lt;br&gt;
Determinism scoring — run N times live, group by trajectory, get 80% path A / 20% path B instead of a meaningless "4/5 passed"&lt;br&gt;
Tool contracts — declared schemas vs real use. On the demo corpus it flagged a parameter sent in every single request that no model ever used.&lt;br&gt;
Approval gate — recordings start PENDING. A recorded run can be wrong; if "recorded" meant "correct", your first bad run becomes the enforced contract.&lt;br&gt;
CLI, pytest plugin, local UI, and a read-only MCP server for Cursor / Claude Code&lt;br&gt;
One honest limitation&lt;br&gt;
Replay cannot catch the model changing underneath you. A recording holds what the model said then, not what it would say now. That's physics, not a missing feature — which is why there's a separate live mode that makes real calls.&lt;/p&gt;

&lt;p&gt;Any tool claiming to catch model drift from a cached response is claiming something impossible.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/NEEL7127" rel="noopener noreferrer"&gt;
        NEEL7127
      &lt;/a&gt; / &lt;a href="https://github.com/NEEL7127/driftcatch" rel="noopener noreferrer"&gt;
        driftcatch
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Catch the moment your AI agent's behaviour changes. Record once, replay deterministically, fail the build on drift.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/NEEL7127/driftcatch/assets/logo.svg"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2FNEEL7127%2Fdriftcatch%2FHEAD%2Fassets%2Flogo.svg" width="96" alt=""&gt;&lt;/a&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;DriftCatch&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Learns what your AI agent always does — then tells you the moment it stops.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pypi.org/project/driftcatch/" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/8a229f8663a701770efb97fcee6474035381e553839e8e31bc32b6f191d71615/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f64726966746361746368" alt="PyPI"&gt;&lt;/a&gt;
&lt;a href="https://github.com/NEEL7127/driftcatch/actions/workflows/ci.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/NEEL7127/driftcatch/actions/workflows/ci.yml/badge.svg" alt="CI"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/7be01af159196bdc829f7d57b0730752dd4c741892eb0462b33708f24fda301a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d332e3131253230253743253230332e3132253230253743253230332e31332d626c7565"&gt;&lt;img src="https://camo.githubusercontent.com/7be01af159196bdc829f7d57b0730752dd4c741892eb0462b33708f24fda301a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d332e3131253230253743253230332e3132253230253743253230332e31332d626c7565" alt="python"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/a478ce6f5351673b3e452501c9ef7a43124cc7d3a8476cb47ab354177c6d982c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d34303725323070617373696e672d627269676874677265656e"&gt;&lt;img src="https://camo.githubusercontent.com/a478ce6f5351673b3e452501c9ef7a43124cc7d3a8476cb47ab354177c6d982c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d34303725323070617373696e672d627269676874677265656e" alt="tests"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/983d4359659e5a2c96c77d98d5ef94b6b62d718a4a78082edf59726cc3a1903f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e"&gt;&lt;img src="https://camo.githubusercontent.com/983d4359659e5a2c96c77d98d5ef94b6b62d718a4a78082edf59726cc3a1903f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e" alt="license"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/NEEL7127/driftcatch/assets/drift-demo.gif"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fraw.githubusercontent.com%2FNEEL7127%2Fdriftcatch%2FHEAD%2Fassets%2Fdrift-demo.gif" width="760" alt="A passing replay, then a regression caught and its cause named."&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;0.1 pre-release.&lt;/strong&gt; The engine, CLI, pytest plugin, local UI and MCP server
are implemented and tested against the real OpenAI and Anthropic SDKs — 407
tests, &lt;code&gt;mypy --strict&lt;/code&gt; clean. Not yet on PyPI, and not yet used by anyone but
its author. If you try it and something is wrong, an issue is more useful to
me than a star.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;The problem&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;You tweak one word in a prompt. Your agent quietly stops querying the database and
starts web-searching. The answer still &lt;em&gt;looks&lt;/em&gt; right, so every eval passes. You find
out from a customer.&lt;/p&gt;
&lt;p&gt;Or worse — the trajectory is identical, every tool fires in the right order, and the
refund amount is wrong by a factor of a hundred.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Agents don't fail loudly. They drift.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;30 seconds&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="highlight highlight-source-python notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;import&lt;/span&gt; &lt;span class="pl-s1"&gt;driftcatch&lt;/span&gt; &lt;span class="pl-k"&gt;as&lt;/span&gt; &lt;span class="pl-s1"&gt;drift&lt;/span&gt;
&lt;span class="pl-en"&gt;@&lt;span class="pl-s1"&gt;drift&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/NEEL7127/driftcatch" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>ai</category>
      <category>programming</category>
      <category>opensource</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
