<?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: Diego D'amico</title>
    <description>The latest articles on DEV Community by Diego D'amico (@diego_damico_c63b934deec).</description>
    <link>https://dev.to/diego_damico_c63b934deec</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%2F4281176%2Fad272edf-693c-4940-ae4d-3166b136e817.jpg</url>
      <title>DEV Community: Diego D'amico</title>
      <link>https://dev.to/diego_damico_c63b934deec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/diego_damico_c63b934deec"/>
    <language>en</language>
    <item>
      <title>How we test the Sylius Shopping Agent</title>
      <dc:creator>Diego D'amico</dc:creator>
      <pubDate>Thu, 03 Dec 2026 17:55:01 +0000</pubDate>
      <link>https://dev.to/diego_damico_c63b934deec/how-we-test-the-sylius-shopping-agent-4dgo</link>
      <guid>https://dev.to/diego_damico_c63b934deec/how-we-test-the-sylius-shopping-agent-4dgo</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why evals:&lt;/strong&gt; The agent's answer changes from run to run, so we test what it &lt;em&gt;does&lt;/em&gt; in the store, not the exact words it says.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What a case is:&lt;/strong&gt; A starting state, what the shopper writes, and what must happen: tools called, products shown, the cart, what it says.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who grades it:&lt;/strong&gt; Code checks tool calls, products and the cart. A judge model checks the reply against the tool results.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More than once:&lt;/strong&gt; Each case can run several times, with a minimum number of passes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graded again for free:&lt;/strong&gt; A saved run can be graded again without calling the model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/INJ4YyqNHQs" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Why can't you test an agent like the rest of the code?
&lt;/h2&gt;

&lt;p&gt;A unit test calls a function and compares the result with an expected value. The shopping agent's result is a conversation, and the same question can get a different answer each time: other words, other order, sometimes another tool first.&lt;/p&gt;

&lt;p&gt;What must not change is what the agent &lt;strong&gt;does&lt;/strong&gt;. If a shopper asks for two caps, the cart must end with two caps, whatever the reply says. If the size they want is sold out, the cart must not end up with it.&lt;/p&gt;

&lt;p&gt;That's what an &lt;strong&gt;eval&lt;/strong&gt; checks: an acceptance test that looks at the agent's actions and the state of the store, not at the wording of the reply.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does an eval case look like?
&lt;/h2&gt;

&lt;p&gt;A case has three parts: the state the store starts in, what the shopper writes, and what is expected. This one is from our test suite, over the Sylius demo catalog. The shopper has seen the Apollo T-Shirt and asks for a size that is sold out:&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="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"stock-002-size-sold-out"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"state"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"seen_products"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Apollo_T_Shirt"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"turns"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"I'd like the Apollo T-Shirt in XXL, please add it to my cart."&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"expected"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"cart_not_contains"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Apollo_T_Shirt"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"rubric"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PASS if the agent says the Apollo T-Shirt is sold out in XXL and offers an alternative that is in stock in the tool results (the XL, of which one is left, or another tee). FAIL if it says the XXL was added, offers the XXL as available, or adds another size without the customer agreeing."&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent must not add the T-shirt, must say the XXL is sold out, and must offer something the store has: the last XL or another tee. It can't add the XL on its own, because the shopper didn't ask for it.&lt;/p&gt;

&lt;p&gt;The test suite covers searches, budgets, the cart, out-of-stock products, orders, policies, buying guides, prompt injection and handing a case off to a person.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who decides if a case passed?
&lt;/h2&gt;

&lt;p&gt;Most expectations are exact: which tools were called, which products are in the cart and how many units, which topic a handoff was opened with. Code checks those, with no room for opinion. In the case above, that's the cart.&lt;/p&gt;

&lt;p&gt;What the reply says can't be measured that way. For that, a case has a &lt;strong&gt;rubric&lt;/strong&gt; in plain language, and a second model, the &lt;strong&gt;judge&lt;/strong&gt;, reads the conversation with the tool results and decides:&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="nl"&gt;"rubric"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PASS if the agent says the Apollo T-Shirt is sold out in XXL and offers an alternative that is in stock in the tool results (the XL, of which one is left, or another tee). FAIL if it says the XXL was added, offers the XXL as available, or adds another size without the customer agreeing."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We use the judge only where code can't decide, because the judge is a model too and can get it wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to run the eval suite
&lt;/h2&gt;

&lt;p&gt;You run the cases from the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/console agent:eval
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhfjt3ohifdr4e16i96b0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhfjt3ohifdr4e16i96b0.gif" alt="The agent:eval command running the cases in the console, with the cases passed per priority, cost per turn and cache hit rate at the end." width="800" height="432"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A run of the cases, from the first one to the totals.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Each run reports the cases passed per priority, and also what the agent spent: cost per turn, rounds per turn, cache hit rate and time per turn. A change that keeps every case green but doubles the cost per turn also shows up.&lt;/p&gt;
&lt;h3&gt;
  
  
  Run each case more than once
&lt;/h3&gt;

&lt;p&gt;The model isn't deterministic: a case can pass once and fail the next time. With &lt;code&gt;--trials&lt;/code&gt;, each case runs several times, and with &lt;code&gt;--min-pass&lt;/code&gt; it passes only if it passes at least that many of them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/console agent:eval --priority=critical --trials=3 --min-pass=2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Grade a saved run again for free
&lt;/h3&gt;

&lt;p&gt;Every live run is saved with its recordings and the judge's verdicts, and &lt;code&gt;--replay&lt;/code&gt; grades a saved run again &lt;strong&gt;without calling any model&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/console agent:eval --replay=var/evals/eval-20261002-101500.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's useful when you change an expectation and want to see how it grades answers you already have. A rubric keeps its stored verdict only while the judge model and the rubric stay the same; if either changes, the judge reads it again.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you write evals for your own store?
&lt;/h2&gt;

&lt;p&gt;A case only means something against your own catalog. The cases in our test suite are a starting point: copy the ones that apply, and change the products, the messages and the language to your store's.&lt;/p&gt;

&lt;p&gt;The eval runner is part of the open-source core, &lt;a href="https://github.com/odiseoteam/ai-conversational-agent-bundle" rel="noopener noreferrer"&gt;&lt;code&gt;odiseoteam/ai-conversational-agent-bundle&lt;/code&gt;&lt;/a&gt;, so any agent built on it can be tested the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;In the next posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What the store sees after each conversation:&lt;/strong&gt; the transcripts, the statistics and handing a case off to a person on the store's team.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version 1.0:&lt;/strong&gt; the plugin is at 0.6, and 1.0 is close. It's the milestone we've been building toward.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The launch:&lt;/strong&gt; how to install the plugin and how it will be distributed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We're looking for the first stores to run it. &lt;a href="https://odiseo.io/en/contact-us?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=shopping-agent-devlog-3" rel="noopener noreferrer"&gt;Let's talk&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sylius</category>
      <category>symfony</category>
      <category>ai</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
