<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TransactAI: GKE Shop Assistant]]></title><description><![CDATA[TransactAI: GKE Shop Assistant]]></description><link>https://tansactai.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 11:54:15 GMT</lastBuildDate><atom:link href="https://tansactai.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building TransactAI: Natural Language Shopping with Google Cloud and AI Agents]]></title><description><![CDATA[Introduction
Ever wished you could shop online as naturally as talking to a store assistant? That's exactly what we built with TransactAI for the GKE Turns 10 Hackathon. In this blog post, I'll share how we combined Google Cloud's microservices archi...]]></description><link>https://tansactai.hashnode.dev/building-transactai-natural-language-shopping-with-google-cloud-and-ai-agents</link><guid isPermaLink="true">https://tansactai.hashnode.dev/building-transactai-natural-language-shopping-with-google-cloud-and-ai-agents</guid><category><![CDATA[GKE cluster]]></category><category><![CDATA[Python]]></category><category><![CDATA[BeautifulSoup]]></category><category><![CDATA[A2A Protocol]]></category><category><![CDATA[mcp server]]></category><dc:creator><![CDATA[Avaneendra Alugupalli]]></dc:creator><pubDate>Sun, 21 Sep 2025 15:35:29 GMT</pubDate><content:encoded><![CDATA[<hr />
<h2 id="heading-introduction">Introduction</h2>
<p>Ever wished you could shop online as naturally as talking to a store assistant? That's exactly what we built with TransactAI for the GKE Turns 10 Hackathon. In this blog post, I'll share how we combined Google Cloud's microservices architecture with AI agents to create a conversational e-commerce experience.</p>
<h2 id="heading-the-vision">The Vision</h2>
<p>Imagine typing "I need a stylish but affordable gift for my mom" and having an AI understand your intent, suggest relevant products, and handle the entire purchase process seamlessly. That's TransactAI - a bridge between natural human communication and e-commerce infrastructure.</p>
<h2 id="heading-technical-architecture">Technical Architecture</h2>
<h3 id="heading-the-building-blocks">The Building Blocks</h3>
<ol>
<li><p><strong>Orchestrator AI Agent</strong></p>
<ul>
<li><p>Built with Google's Gemini Pro</p>
</li>
<li><p>Handles natural language understanding</p>
</li>
<li><p>Coordinates between services</p>
</li>
<li><p>Provides a Streamlit-based UI</p>
</li>
</ul>
</li>
<li><p><strong>Order Agent (MCP Protocol)</strong></p>
<ul>
<li><p>Manages product catalog</p>
</li>
<li><p>Handles order placement</p>
</li>
<li><p>Integrates with Google's Online Boutique</p>
</li>
<li><p>Implements Model Context Protocol for service discovery</p>
</li>
</ul>
</li>
<li><p><strong>Payment AI Agent (A2A Protocol)</strong></p>
<ul>
<li><p>Processes payments naturally</p>
</li>
<li><p>Implements Agent-to-Agent communication</p>
</li>
<li><p>Validates transactions</p>
</li>
<li><p>Provides secure payment handling</p>
</li>
</ul>
</li>
<li><p><strong>Google Cloud Infrastructure</strong></p>
<ul>
<li><p>Online Boutique running on GKE</p>
</li>
<li><p>Kubernetes for scalability</p>
</li>
<li><p>Microservices architecture</p>
</li>
<li><p>Real-time inventory management</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-the-innovation-ai-agent-protocols">The Innovation: AI Agent Protocols</h2>
<p>One of our key innovations was implementing two different AI agent communication protocols:</p>
<h3 id="heading-model-context-protocol-mcp">Model Context Protocol (MCP)</h3>
<pre><code class="lang-python"><span class="hljs-meta">@app.get("/.well-known/mcp")</span>
<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_mcp_manifest</span>():</span>
    <span class="hljs-keyword">return</span> {
        <span class="hljs-string">"tools"</span>: [
            {
                <span class="hljs-string">"name"</span>: <span class="hljs-string">"listProducts"</span>,
                <span class="hljs-string">"description"</span>: <span class="hljs-string">"List available products"</span>,
                <span class="hljs-string">"parameters"</span>: {}
            },
            {
                <span class="hljs-string">"name"</span>: <span class="hljs-string">"placeOrder"</span>,
                <span class="hljs-string">"description"</span>: <span class="hljs-string">"Place an order for a product"</span>,
                <span class="hljs-string">"parameters"</span>: {
                    <span class="hljs-string">"product_id"</span>: <span class="hljs-string">"string"</span>,
                    <span class="hljs-string">"quantity"</span>: <span class="hljs-string">"integer"</span>
                }
            }
        ]
    }
</code></pre>
<h3 id="heading-agent-to-agent-a2a-protocol">Agent-to-Agent (A2A) Protocol</h3>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AgentMessage</span>(<span class="hljs-params">BaseModel</span>):</span>
    sender: str
    intent: str
    payload: dict
    conversation_id: Optional[str]
</code></pre>
<h2 id="heading-challenges-and-solutions">Challenges and Solutions</h2>
<h3 id="heading-1-html-parsing-vs-rest-apis">1. HTML Parsing vs. REST APIs</h3>
<p>The Online Boutique doesn't expose a traditional REST API. Instead of giving up, we built a robust HTML parser:</p>
<pre><code class="lang-python"><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_products</span>():</span>
    <span class="hljs-keyword">async</span> <span class="hljs-keyword">with</span> aiohttp.ClientSession() <span class="hljs-keyword">as</span> session:
        <span class="hljs-comment"># Fetch and parse product listings</span>
        response = <span class="hljs-keyword">await</span> session.get(<span class="hljs-string">f"<span class="hljs-subst">{BOUTIQUE_API_URL}</span>/"</span>)
        soup = BeautifulSoup(<span class="hljs-keyword">await</span> response.text(), <span class="hljs-string">'html.parser'</span>)

        <span class="hljs-comment"># Extract product details</span>
        products = []
        <span class="hljs-keyword">for</span> product <span class="hljs-keyword">in</span> soup.find_all(<span class="hljs-string">'h2'</span>):
            <span class="hljs-keyword">if</span> <span class="hljs-string">"You May Also Like"</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> product.text:
                <span class="hljs-comment"># Extract price and description</span>
                price = extract_price(product)
                desc = extract_description(product)
                products.append({
                    <span class="hljs-string">"name"</span>: product.text.strip(),
                    <span class="hljs-string">"price"</span>: price,
                    <span class="hljs-string">"description"</span>: desc
                })
</code></pre>
<h3 id="heading-2-session-management">2. Session Management</h3>
<p>E-commerce requires maintaining state. We implemented a robust session management system:</p>
<pre><code class="lang-python"><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">place_order</span>(<span class="hljs-params">order: Dict</span>):</span>
    <span class="hljs-keyword">async</span> <span class="hljs-keyword">with</span> <span class="hljs-keyword">await</span> get_session() <span class="hljs-keyword">as</span> session:
        <span class="hljs-comment"># Add to cart with session cookie</span>
        cart_response = <span class="hljs-keyword">await</span> session.post(
            <span class="hljs-string">f"<span class="hljs-subst">{BOUTIQUE_API_URL}</span>/cart"</span>,
            data={<span class="hljs-string">"product_id"</span>: order[<span class="hljs-string">"product_id"</span>]},
            headers={<span class="hljs-string">"Content-Type"</span>: <span class="hljs-string">"application/x-www-form-urlencoded"</span>}
        )

        <span class="hljs-comment"># Extract and use session cookie</span>
        session_cookie = extract_session_cookie(cart_response)
</code></pre>
<h3 id="heading-3-ai-safety-and-reliability">3. AI Safety and Reliability</h3>
<p>Working with AI models requires careful error handling:</p>
<pre><code class="lang-python"><span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">ask_gemini</span>(<span class="hljs-params">prompt: str, retries: int = <span class="hljs-number">3</span></span>):</span>
    <span class="hljs-keyword">for</span> attempt <span class="hljs-keyword">in</span> range(retries):
        <span class="hljs-keyword">try</span>:
            response = <span class="hljs-keyword">await</span> model.generate_content_async(
                prompt,
                safety_settings={
                    <span class="hljs-string">"HARASSMENT"</span>: <span class="hljs-string">"block_none"</span>,
                    <span class="hljs-string">"HATE_SPEECH"</span>: <span class="hljs-string">"block_none"</span>,
                    <span class="hljs-string">"SEXUALLY_EXPLICIT"</span>: <span class="hljs-string">"block_none"</span>,
                    <span class="hljs-string">"DANGEROUS_CONTENT"</span>: <span class="hljs-string">"block_none"</span>
                }
            )
            <span class="hljs-keyword">return</span> parse_gemini_response(response)
        <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
            <span class="hljs-keyword">if</span> attempt == retries - <span class="hljs-number">1</span>:
                <span class="hljs-keyword">raise</span> Exception(<span class="hljs-string">f"All <span class="hljs-subst">{retries}</span> attempts failed"</span>)
            <span class="hljs-keyword">continue</span>
</code></pre>
<h2 id="heading-results-and-impact">Results and Impact</h2>
<p>The final system demonstrates:</p>
<ol>
<li><p>Natural language understanding for e-commerce</p>
</li>
<li><p>Seamless integration with existing infrastructure</p>
</li>
<li><p>Robust error handling and user feedback</p>
</li>
<li><p>Scalable microservices architecture</p>
</li>
</ol>
<h2 id="heading-key-learnings">Key Learnings</h2>
<ol>
<li><p><strong>AI Integration</strong></p>
<ul>
<li><p>Prompt engineering is crucial</p>
</li>
<li><p>Error handling must be robust</p>
</li>
<li><p>Safety settings need careful tuning</p>
</li>
</ul>
</li>
<li><p><strong>Microservices</strong></p>
<ul>
<li><p>Service discovery is essential</p>
</li>
<li><p>State management requires careful design</p>
</li>
<li><p>Protocol design affects scalability</p>
</li>
</ul>
</li>
<li><p><strong>User Experience</strong></p>
<ul>
<li><p>Natural language requires context</p>
</li>
<li><p>Feedback must be immediate</p>
</li>
<li><p>Error messages should be helpful</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-future-directions">Future Directions</h2>
<ol>
<li><p><strong>Enhanced AI Capabilities</strong></p>
<ul>
<li><p>Product recommendations</p>
</li>
<li><p>Price negotiation</p>
</li>
<li><p>Multi-language support</p>
</li>
</ul>
</li>
<li><p><strong>Technical Improvements</strong></p>
<ul>
<li><p>Kubernetes auto-scaling</p>
</li>
<li><p>Enhanced caching</p>
</li>
<li><p>More payment methods</p>
</li>
</ul>
</li>
<li><p><strong>User Experience</strong></p>
<ul>
<li><p>Voice interface</p>
</li>
<li><p>Mobile app</p>
</li>
<li><p>Analytics dashboard</p>
</li>
</ul>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<p>TransactAI demonstrates how modern cloud infrastructure and AI can transform e-commerce. By combining Google Cloud's robust services with innovative AI agents, we've created a system that makes online shopping more natural and accessible.</p>
<p>The code is open source and available on GitHub. We welcome contributions and feedback from the community!</p>
<h2 id="heading-resources">Resources</h2>
<ul>
<li><p><a target="_blank" href="https://github.com/avaneendra/transact_ai">GitHub Repository</a></p>
</li>
<li><p><a target="_blank" href="your-demo-url">Demo Video</a></p>
</li>
<li><p><a target="_blank" href="https://gketurns10.devpost.com/">GKE Turns 10 Hackathon</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/GoogleCloudPlatform/microservices-demo">Google Online Boutique</a></p>
</li>
<li><p><a target="_blank" href="https://ai.google.dev/">Google Gemini AI</a></p>
</li>
</ul>
<hr />
]]></content:encoded></item></channel></rss>