<?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: Rakibul Islam</title>
    <description>The latest articles on DEV Community by Rakibul Islam (@rakib_1202).</description>
    <link>https://dev.to/rakib_1202</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3818542%2Fb17ee8e1-8fd6-4b97-af9a-0469a88fc216.jpg</url>
      <title>DEV Community: Rakibul Islam</title>
      <link>https://dev.to/rakib_1202</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rakib_1202"/>
    <language>en</language>
    <item>
      <title>How I built a real-time emotional spending intervention agent with Gemini Live</title>
      <dc:creator>Rakibul Islam</dc:creator>
      <pubDate>Mon, 16 Mar 2026 18:57:55 +0000</pubDate>
      <link>https://dev.to/rakib_1202/how-i-built-a-real-time-emotional-spending-intervention-agent-with-gemini-live-41cb</link>
      <guid>https://dev.to/rakib_1202/how-i-built-a-real-time-emotional-spending-intervention-agent-with-gemini-live-41cb</guid>
      <description>&lt;p&gt;&lt;em&gt;I built this project for the Gemini Live Agent Challenge 2026.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The idea started from a simple observation: I and most of my friends &lt;br&gt;
regularly buy things we immediately regret. Not because we don't know &lt;br&gt;
our financial situation — but because the bad decision happens at 11 PM &lt;br&gt;
when we're stressed, and no tool is watching at that exact moment.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Sentience Finance&lt;/strong&gt; is a Chrome extension that detects checkout pages &lt;br&gt;
automatically, reads your emotional state through your camera, and opens &lt;br&gt;
a Gemini Live voice conversation with your own spending history loaded &lt;br&gt;
in — before you click buy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core architecture
&lt;/h2&gt;

&lt;p&gt;The extension (&lt;code&gt;content.js&lt;/code&gt;) watches for financial page patterns — &lt;br&gt;
checkout URLs, payment selectors, keywords like "bKash" and "Cash on &lt;br&gt;
Delivery" for platforms like Daraz. When it fires, it injects a HUD &lt;br&gt;
token and sends the page context to the sidepanel.&lt;/p&gt;

&lt;p&gt;The sidepanel opens a WebSocket to a FastAPI backend, which connects to &lt;br&gt;
Gemini Live using the &lt;code&gt;gemini-2.5-flash-native-audio-preview-12-2025&lt;/code&gt; &lt;br&gt;
model via v1alpha. Audio goes in as 512-frame PCM chunks (32ms latency). &lt;br&gt;
Audio comes back at 24kHz and plays through a persistent AudioContext &lt;br&gt;
with chunks scheduled sequentially — no gaps, no pops.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hardest part: making it actually feel live
&lt;/h2&gt;

&lt;p&gt;Early builds required clicking a button for every sentence. That's a &lt;br&gt;
chatbot. Making it feel like a real conversation required three fixes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Buffer size.&lt;/strong&gt; 2048 frames = 128ms before Gemini hears your first &lt;br&gt;
word. Dropping to 512 frames cut that to 32ms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OS audio processing.&lt;/strong&gt; &lt;code&gt;echoCancellation: true&lt;/code&gt; adds 40-60ms on &lt;br&gt;
older hardware. Disabled it and replaced with a JavaScript echo gate &lt;br&gt;
that reads the RMS amplitude per chunk — blocks mic audio while AI is &lt;br&gt;
speaking, lets through loud barge-in.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;End-of-turn signaling.&lt;/strong&gt; Gemini's cloud VAD waits ~600-800ms after &lt;br&gt;
silence before responding. A client-side VAD detects 600ms of silence &lt;br&gt;
and sends an explicit flush signal, cutting that wait significantly.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Vulnerability Score
&lt;/h2&gt;

&lt;p&gt;$$V_{score} = (0.4 \times F_{freq}) + (0.3 \times A_{spend}) + (0.3 \times R_{regret})$$&lt;/p&gt;

&lt;p&gt;Three signals: purchase frequency in the current emotional state (40%), &lt;br&gt;
average spend vs. baseline (30%), and self-rated regret on past purchases &lt;br&gt;
(30%). In testing, interventions at scores ≥ 7.5 produced 67% cart &lt;br&gt;
abandonment vs. 12% at ≤ 4.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;Financial behavior is psychological before it's mathematical. The &lt;br&gt;
system prompt matters as much as the API calls. And the moment of &lt;br&gt;
intervention matters more than the quality of analysis — a perfect &lt;br&gt;
insight a week later changes nothing.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/rakib120207/Sentience" rel="noopener noreferrer"&gt;https://github.com/rakib120207/Sentience&lt;/a&gt;&lt;/p&gt;

</description>
      <category>geminiliveagentchallenge</category>
      <category>ai</category>
      <category>googlecloud</category>
      <category>googleaichallenge</category>
    </item>
  </channel>
</rss>
