<?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: Janani Gunasekaran</title>
    <description>The latest articles on DEV Community by Janani Gunasekaran (@janani_gunasekaran_ca12a1).</description>
    <link>https://dev.to/janani_gunasekaran_ca12a1</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%2F4018003%2F1bb1cddd-f80b-4643-9d5d-ba57bb94beac.png</url>
      <title>DEV Community: Janani Gunasekaran</title>
      <link>https://dev.to/janani_gunasekaran_ca12a1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/janani_gunasekaran_ca12a1"/>
    <language>en</language>
    <item>
      <title>Why We Stopped Using Stateless AI Agents for Enterprise Sustainability Scoring</title>
      <dc:creator>Janani Gunasekaran</dc:creator>
      <pubDate>Mon, 06 Jul 2026 15:36:36 +0000</pubDate>
      <link>https://dev.to/janani_gunasekaran_ca12a1/why-we-stopped-using-stateless-ai-agents-for-enterprise-sustainability-scoring-g02</link>
      <guid>https://dev.to/janani_gunasekaran_ca12a1/why-we-stopped-using-stateless-ai-agents-for-enterprise-sustainability-scoring-g02</guid>
      <description>&lt;h1&gt;
  
  
  I Built a Shopping Assistant That Refuses to Forget You Hate Fast Fashion
&lt;/h1&gt;

&lt;p&gt;I've used a dozen "AI shopping assistants" that treat every conversation like the first time we've ever met. Ask about a product, get a generic answer, close the tab, ask again tomorrow, get the same generic answer. None of them ever get &lt;em&gt;better&lt;/em&gt;. They just repeat.&lt;/p&gt;

&lt;p&gt;I wanted to see what happens if an agent actually remembers what you tell it — and what happens to your API bill when you stop paying full price for every single question. That's EcoWorthyAI: a sustainability shopping assistant built on &lt;a href="https://github.com/vectorize-io/hindsight" rel="noopener noreferrer"&gt;Hindsight&lt;/a&gt; for persistent agent memory and &lt;a href="https://github.com/lemony-ai/cascadeflow" rel="noopener noreferrer"&gt;cascadeflow&lt;/a&gt; for runtime cost control.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;You describe a product, EcoWorthyAI evaluates its sustainability — materials, supply chain, certifications — and gives you a recommendation. Nothing revolutionary so far. The interesting part is what happens across a &lt;em&gt;session&lt;/em&gt;, not within a single question.&lt;/p&gt;

&lt;p&gt;Here's a real exchange from testing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interaction 1&lt;/strong&gt; — a new session, user &lt;code&gt;demo_123&lt;/code&gt; asks about a product:&lt;br&gt;
USER: "Can you tell me about the Aura Cotton Tee?"&lt;br&gt;
[Hindsight: Recall] Retrieving context for user_demo_123...&lt;br&gt;
-&amp;gt; Retrieved priorities and recent decisions.&lt;br&gt;
[Cascadeflow: Routing] Query detected as MODERATE complexity.&lt;br&gt;
[Cascadeflow: Audit] Model: llama-3.1-8b-instant | Cost: $0.000006 | Latency: 522ms&lt;br&gt;
ECOWORTHY AI RESPONSE:&lt;br&gt;
The Aura Cotton Tee is a sustainable apparel choice made of 100% Organic Cotton.&lt;br&gt;
[Hindsight: Retain] Saving memory for user_demo_123...&lt;/p&gt;

&lt;p&gt;Fine, generic, correct. Nothing has been learned yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interaction 2&lt;/strong&gt; — same session, the user volunteers a preference and a decision:&lt;br&gt;
USER: "Actually, I also saw the TrendVibe Polyester Tee for $8. But I prefer&lt;br&gt;
to avoid fast fashion and prefer organic materials, so I'll pass on TrendVibe."&lt;br&gt;
[Hindsight: Retain] Saving memory for user_demo_123...&lt;br&gt;
-&amp;gt; Logged decision: Rejected TrendVibe Polyester Tee due to fast fashion&lt;br&gt;
and synthetic materials.&lt;/p&gt;

&lt;p&gt;This is the moment that matters. The agent didn't just answer a question — it retained a &lt;em&gt;decision&lt;/em&gt; and the &lt;em&gt;reasoning&lt;/em&gt; behind it, tied to this specific user.&lt;/p&gt;

&lt;p&gt;Fast-forward to a later interaction, a completely different product, no mention of fast fashion in the question at all:&lt;br&gt;
USER: "The Velocity Sneakers by SwiftRuns are priced at $40.00."&lt;br&gt;
[Cascadeflow: Budget] Warning: Nearing session budget. Remaining: $0.000140&lt;br&gt;
[Cascadeflow: Routing] Query detected as HARD complexity.&lt;br&gt;
[Cascadeflow: Routing] Escalation blocked due to budget. Forcing fallback&lt;br&gt;
to cheap model. Cascade requires 2+ models but got 1. Disabling cascade.&lt;br&gt;
[Cascadeflow: Audit] Model: llama-3.1-8b-instant | Cost: $0.000050 | Latency: 520ms&lt;br&gt;
ECOWORTHY AI RESPONSE:&lt;br&gt;
The Velocity Sneakers by SwiftRuns are priced at $40.00. However, please&lt;br&gt;
note: SwiftRuns is a fast fashion vendor. These sneakers are made from&lt;br&gt;
synthetic leather and virgin plastics, and have a zero recyclability rating.&lt;br&gt;
Since you've told me you avoid fast fashion, I'm flagging this vendor even&lt;br&gt;
though it's cheaper.&lt;br&gt;
[Hindsight: Retain] Saving memory for user_demo_123...&lt;/p&gt;

&lt;p&gt;Nobody told the agent about fast fashion in this message. It pulled that constraint from a decision made several turns earlier and applied it, unprompted, to a brand-new product. That's the whole pitch of persistent memory in one interaction: the fifth question gets a materially different answer than the first, because of what happened in between.&lt;/p&gt;

&lt;h2&gt;
  
  
  The other half: not paying full price for every question
&lt;/h2&gt;

&lt;p&gt;Every one of those calls above went through cascadeflow's routing layer before hitting a model. The logic is simple and the payoff is not: classify the query's complexity, send easy questions ("what's this made of?") to a small, cheap model, and only escalate to something stronger when the question genuinely requires it — a multi-product lifecycle comparison, a tradeoff analysis, something with real reasoning depth.&lt;/p&gt;

&lt;p&gt;What I didn't expect was how well the budget enforcement held up under pressure. In the run above, the session was approaching its cost ceiling right as a HARD-complexity query came in — exactly the kind of query that should escalate to a stronger model. Instead of blowing the budget or crashing, cascadeflow blocked the escalation, forced a fallback to the cheap model, and logged &lt;em&gt;why&lt;/em&gt;:&lt;br&gt;
[Cascadeflow: Routing] Escalation blocked due to budget. Forcing fallback&lt;br&gt;
to cheap model. Cascade requires 2+ models but got 1. Disabling cascade.&lt;/p&gt;

&lt;p&gt;That line is the audit trail doing its job. Every decision — which model, why, at what cost, at what latency — gets logged, not just the final answer. If you're trying to run agents in anything resembling production, that log is the difference between "the AI did something" and "I can tell you exactly what the AI did and why."&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflection: turning history into a profile
&lt;/h2&gt;

&lt;p&gt;Raw interaction history is not the same as understanding a user. After 10 interactions, EcoWorthyAI runs a reflection pass over the session:&lt;br&gt;
[Hindsight: Reflect] Running reflection loop for user_demo_123...&lt;br&gt;
-&amp;gt; Analyzing 10 past interactions...&lt;br&gt;
-&amp;gt; Reflection complete. Generated distilled preference profile.&lt;br&gt;
Updated Distilled Preference Profile:&lt;br&gt;
User is highly conscious of material origins and supply chain ethics.&lt;br&gt;
They actively boycott fast fashion and prioritize organic, certified&lt;br&gt;
materials. Recommendation strategy: Highlight certifications, origin&lt;br&gt;
of materials, and long-term durability. Flag any products linked to&lt;br&gt;
fast fashion or poor labor practices.&lt;/p&gt;

&lt;p&gt;Instead of re-reading ten raw interactions every time, future sessions can recall this compressed profile directly — cheaper to retrieve, and a genuinely useful summary rather than a transcript dump.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd do differently
&lt;/h2&gt;

&lt;p&gt;A few things I'd change if I kept building this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FastEmbed wasn't installed initially&lt;/strong&gt;, and the retrieval step silently fell back to a slower path. Worth pinning dependencies explicitly rather than discovering it mid-demo (&lt;code&gt;pip install fastembed&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The budget-blocked escalation needs a user-facing signal&lt;/strong&gt;, not just a log line. Right now a HARD query silently downgrades to a cheap model — that's the correct behavior for cost control, but a real product should probably surface "I'm using a faster/cheaper model right now because we're near budget" so it's not invisible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reflection frequency (every 10 interactions) is a guess.&lt;/strong&gt; I'd want to tune this against how often user preferences actually shift versus how much it costs to keep re-summarizing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory needs an expiry or override path.&lt;/strong&gt; A rejected product from six months ago shouldn't necessarily carry the same weight forever — preferences change, and the recall layer should let a user explicitly overwrite past decisions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The routing complexity classifier is doing a lot of work&lt;/strong&gt; and I'd want to see its false-positive rate at scale — sending a genuinely hard query to a cheap model quietly degrades answer quality in a way that's easy to miss unless you're checking the audit log.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why this combination specifically
&lt;/h2&gt;

&lt;p&gt;Memory and cost control solve different problems, but they compound. &lt;a href="https://vectorize.io/what-is-agent-memory" rel="noopener noreferrer"&gt;Hindsight's agent memory&lt;/a&gt; is what makes the agent worth returning to — it gets more useful the more you use it. Cascadeflow's routing is what makes that sustainable to actually run — you're not paying premium-model prices for "what's this made of?" every single time. Neither one alone would have made for an interesting demo. Together, the delta between interaction 1 and interaction 5 is the whole story.&lt;/p&gt;

&lt;p&gt;If you're building an agent that's supposed to accumulate value over a relationship rather than reset every session, I'd start with &lt;a href="https://hindsight.vectorize.io/" rel="noopener noreferrer"&gt;Hindsight's docs&lt;/a&gt; for the memory layer and &lt;a href="https://docs.cascadeflow.ai/" rel="noopener noreferrer"&gt;cascadeflow's docs&lt;/a&gt; for the routing and budget side. They're built to be dropped into an existing agent loop rather than requiring a rewrite, which is the only reason I had this working in an afternoon instead of a week.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>llm</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
