<?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>Forem: Vinayak Maskar</title>
    <description>The latest articles on Forem by Vinayak Maskar (@vinayak_maskar_5e6d6c60c2).</description>
    <link>https://forem.com/vinayak_maskar_5e6d6c60c2</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%2F3827911%2F1c051688-fe91-4171-a1e3-bf489861f4f2.jpg</url>
      <title>Forem: Vinayak Maskar</title>
      <link>https://forem.com/vinayak_maskar_5e6d6c60c2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vinayak_maskar_5e6d6c60c2"/>
    <language>en</language>
    <item>
      <title>Building a Real-Time Multilingual Voice Agent with Gemini Live API on Google Cloud</title>
      <dc:creator>Vinayak Maskar</dc:creator>
      <pubDate>Mon, 16 Mar 2026 18:33:57 +0000</pubDate>
      <link>https://forem.com/vinayak_maskar_5e6d6c60c2/building-a-real-time-multilingual-voice-agent-with-gemini-live-api-on-google-cloud-2jfh</link>
      <guid>https://forem.com/vinayak_maskar_5e6d6c60c2/building-a-real-time-multilingual-voice-agent-with-gemini-live-api-on-google-cloud-2jfh</guid>
      <description>&lt;h1&gt;
  
  
  Building a Voice-Powered Loan Assistant with Gemini Live API and Google Cloud
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Created for the #GeminiLiveAgentChallenge hackathon&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;In India, over 800 million people access the internet primarily through their phones — and a significant number are not comfortable typing in English. Traditional loan application forms create a massive friction point: small text inputs, confusing field formats (PAN numbers, date formats), and English-only interfaces exclude a huge portion of the population.&lt;/p&gt;

&lt;p&gt;What if users could just &lt;strong&gt;talk&lt;/strong&gt; to fill out their loan application — in their own language?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: InstaMoney
&lt;/h2&gt;

&lt;p&gt;InstaMoney is a real-time, multilingual voice assistant that fills out loan application forms through natural speech. Users click a microphone button and simply talk. The AI listens, understands, extracts form field values, and auto-fills the form — all in real time with zero typing.&lt;/p&gt;

&lt;h3&gt;
  
  
  What makes it special:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Truly live&lt;/strong&gt; — No "record and send." Audio streams bidirectionally between the user and Gemini in real time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;10 Indian languages&lt;/strong&gt; — Hindi, Marathi, Tamil, Telugu, Bengali, Gujarati, Kannada, Malayalam, Punjabi, and English. Switch languages mid-conversation and the bot follows immediately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Barge-in&lt;/strong&gt; — Users can interrupt the bot mid-speech, just like a real conversation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart form filling&lt;/strong&gt; — Gemini uses function calling (&lt;code&gt;fill_form_field&lt;/code&gt;) to extract structured data with confidence scores.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How We Built It with Google AI and Google Cloud
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Gemini Live API — The Core
&lt;/h3&gt;

&lt;p&gt;The entire experience is powered by &lt;strong&gt;Gemini 2.5 Flash Native Audio&lt;/strong&gt; through the &lt;strong&gt;Google GenAI SDK&lt;/strong&gt;. We use the &lt;code&gt;bidiGenerateContent&lt;/code&gt; Live API for true bidirectional audio streaming.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;google.genai&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;live&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gemini-2.5-flash-native-audio-latest&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;response_modalities&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AUDIO&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tools&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;fill_form_field_tool&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_audio_transcription&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output_audio_transcription&lt;/span&gt;&lt;span class="sh"&gt;"&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="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key architectural decisions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Raw PCM over WebSocket&lt;/strong&gt; — Audio flows as binary PCM (16-bit, 24kHz, mono) directly from the browser microphone to Gemini and back. No base64 encoding overhead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tool calling for structured output&lt;/strong&gt; — Instead of parsing free-text, Gemini's native function calling ensures reliable field extraction:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="nf"&gt;fill_form_field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;field_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fullName&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Vinayak Maskar&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;high&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Continuous background receiver&lt;/strong&gt; — An &lt;code&gt;asyncio.create_task&lt;/code&gt; loop reads from the Gemini session continuously, enabling true real-time streaming without blocking.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Google Cloud Run — Production Hosting
&lt;/h3&gt;

&lt;p&gt;The backend runs on &lt;strong&gt;Cloud Run&lt;/strong&gt; with &lt;strong&gt;Daphne&lt;/strong&gt; (ASGI server) for WebSocket support. We automated the entire deployment with a single script:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Build&lt;/strong&gt; builds the Docker container&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secret Manager&lt;/strong&gt; stores API keys securely&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Run&lt;/strong&gt; serves the ASGI app with auto-scaling (0 to 3 instances)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Frontend
&lt;/h3&gt;

&lt;p&gt;Built with &lt;strong&gt;React Native (Expo)&lt;/strong&gt; for cross-platform support. Features a glassmorphism UI with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animated voice button with ripple effects&lt;/li&gt;
&lt;li&gt;Real-time waveform bars during recording&lt;/li&gt;
&lt;li&gt;Fields that light up green with checkmarks as the bot fills them&lt;/li&gt;
&lt;li&gt;Toast notifications for each auto-filled field&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AI Model&lt;/td&gt;
&lt;td&gt;Gemini 2.5 Flash Native Audio&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI SDK&lt;/td&gt;
&lt;td&gt;Google GenAI SDK (&lt;code&gt;google-genai&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backend&lt;/td&gt;
&lt;td&gt;Django Channels + Daphne&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hosting&lt;/td&gt;
&lt;td&gt;Google Cloud Run&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Secrets&lt;/td&gt;
&lt;td&gt;Google Secret Manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Build&lt;/td&gt;
&lt;td&gt;Google Cloud Build&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frontend&lt;/td&gt;
&lt;td&gt;React Native (Expo)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Audio&lt;/td&gt;
&lt;td&gt;Web Audio API (PCM 24kHz)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Challenges We Faced
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PKCE and JWT auth over WebSocket&lt;/strong&gt; — WebSockets don't support HTTP headers, so we pass the JWT token as a WebSocket subprotocol during the handshake.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multilingual tool calling&lt;/strong&gt; — Gemini needed to extract Latin-script values from Hindi/Marathi speech. We solved this with detailed system prompt engineering and validation layers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Barge-in handling&lt;/strong&gt; — When the user interrupts, we need to stop audio playback immediately on the frontend while the backend handles the interruption event from the Live API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auto-reconnection&lt;/strong&gt; — The Live API session can disconnect. We built a 3-retry auto-reconnect system with exponential backoff that's transparent to the user.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ul&gt;
&lt;li&gt;Add more form stages (employment, income, documents)&lt;/li&gt;
&lt;li&gt;Camera-based PAN card reading using Gemini's vision capabilities&lt;/li&gt;
&lt;li&gt;Deploy on mobile (iOS/Android) using the same Expo codebase&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/vinayakmaskar/instamoney-voice-assistant" rel="noopener noreferrer"&gt;github.com/vinayakmaskar/instamoney-voice-assistant&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;This blog post was created for the purposes of entering the Gemini Live Agent Challenge hackathon. #GeminiLiveAgentChallenge&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built by Vinayak Maskar&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This article was created for the purposes of entering the Gemini Live Agent Challenge hackathon. #GeminiLiveAgentChallenge&lt;/p&gt;

</description>
      <category>gemini</category>
      <category>googlecloud</category>
      <category>ai</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
