<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Francisco Riveros on Medium]]></title>
        <description><![CDATA[Stories by Francisco Riveros on Medium]]></description>
        <link>https://medium.com/@pancho_riveros?source=rss-d599d1128e8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d31ELcWheGpwzvodBwD3VQ.png</url>
            <title>Stories by Francisco Riveros on Medium</title>
            <link>https://medium.com/@pancho_riveros?source=rss-d599d1128e8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:32:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pancho_riveros/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[“Who Presses Send?” — Building an Email Escrow with Google Antigravity SDK]]></title>
            <link>https://medium.com/@pancho_riveros/who-presses-send-building-an-email-escrow-with-google-antigravity-sdk-f7d97375d331?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7d97375d331</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-antigravity]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 21:54:56 GMT</pubDate>
            <atom:updated>2026-07-06T21:54:56.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Idsy2MnitDMH7pE7gpOYkA.jpeg" /><figcaption>Generated with nano banana lite by Francisco Riveros</figcaption></figure><p>A few weeks ago I was sitting with a client in Frankfurt, walking through a GenAI agent use case for customer support. The agent was good — it drafted coherent, on-brand, contextually correct responses. That wasn’t the problem. The problem showed up when the CISO asked one very simple question: <em>“Who actually presses send?”</em></p><p>Silence in the room.</p><p>That silence is exactly why I’ve spent the last couple of weeks digging into the <strong>Google Antigravity SDK</strong>, testing a pattern I’m calling <strong>Email Escrow</strong>: a Human-in-the-Loop (HITL) safety gate where the agent can draft as many emails as it wants, but the send_email command never fires without a human explicitly approving it first.</p><p>Here’s the step-by-step of how I built it, what I learned digging into how Antigravity structures this under the hood, and why I think this is the single most convincing demo you can show a skeptical architect. If you don’t want to read the article and jump directly to the code : <a href="https://github.com/foward/email-escrow-hitl-antigravity"><em>GitHub Repository</em></a><em>.</em></p><h3>What on earth is an “Email Escrow”?</h3><p>Think of it like a real estate escrow account: the money exists, both parties agreed on the terms, but nobody gets the funds until a neutral third party confirms everything checks out. Apply that same idea to an agent talking to your customers — the email exists, the agent is confident in it, but it sits in a locked box until a human says “go.”</p><p>The reason this matters specifically for customer-facing agents: unlike an agent editing code in a repo (where you can always roll back), a customer email is irreversible the second it lands in an inbox. There’s no git revert for a bad tone or a wrong price quoted to a client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1v0dvGl_njr9__d70OnjWg.png" /><figcaption>Generated with Nano banana by Francisco Riveros</figcaption></figure><h3>The stack I used</h3><ul><li><strong>Google Antigravity SDK</strong> — for the declarative policy layer and lifecycle hooks</li><li><strong>Firestore</strong> — as the persistence layer for the escrow queue (never keep this in memory!)</li><li><strong>Slack webhook</strong> — for notifying the human reviewer</li><li>A simple polling loop to pause the agent until a decision lands</li></ul><h3>Step 1: Deny-by-default, always</h3><p>Every agent guardrail I build starts the same way — nothing runs unless it’s explicitly allowed, and the sensitive stuff gets explicitly routed to a human instead of just “allowed.”</p><pre>from google.antigravity import LocalAgentConfig, CapabilitiesConfig<br>from google.antigravity.hooks import policy<br>from google.antigravity.utils.interactive import run_interactive_loop<br><br>policies = [<br>    policy.deny_all(),                            # nothing runs by default<br>    policy.allow(&quot;search_knowledge_base&quot;),        # reading: free<br>    policy.allow(&quot;draft_email&quot;),                  # drafting: free, no external effect<br>    policy.ask_user(&quot;send_email&quot;, handler=escrow_handler) # the one real friction point<br>]<br><br>config = LocalAgentConfig(policies=policies, capabilities=CapabilitiesConfig())<br>await run_interactive_loop(config)</pre><p>Notice the design: the agent can search the knowledge base and draft as many versions of the email as it wants without asking anyone. That keeps the support team&#39;s experience fast and fluid. The friction is concentrated exactly where it should be — the moment the message would actually leave the building.</p><blockquote><em>[!TIP] </em><strong><em>Enterprise Refinement: Whitelisting Internal Domains</em></strong><em> In a production setup, you likely don&#39;t want to block internal communications for human review. You can refine this rule using Antigravity&#39;s </em><strong><em>predicates</em></strong><em> (</em><em>when parameters) to selectively trigger the escrow only for external recipients:</em></blockquote><pre>policies = [<br>    policy.deny_all(),<br>    policy.allow(&quot;search_knowledge_base&quot;),<br>    policy.allow(&quot;draft_email&quot;),<br>    # Only escrow if recipient is external (does not end with @mycompany.com)<br>    policy.ask_user(<br>        &quot;send_email&quot;,<br>        when=lambda args: not args.get(&quot;to&quot;, &quot;&quot;).endswith(&quot;@mycompany.com&quot;),<br>        handler=escrow_handler<br>    ),<br>    # Auto-allow internal emails<br>    policy.allow(&quot;send_email&quot;)<br>]</pre><blockquote><em>This declarative logic is resolved at runtime by the SDK, keeping the tool&#39;s implementation clean and focused.</em></blockquote><h3>Step 2: Building a handler that&#39;s an actual escrow, not a demo trick</h3><p>This is where most demos I&#39;ve seen fall short. A plain input() in your terminal isn&#39;t an escrow pattern, it&#39;s a lab experiment. A real escrow needs three things: persistence, notification, and an auditable state.</p><pre>async def escrow_handler(tool_call):<br>    # 1. Persist the request as &quot;pending&quot; — never keep this only in memory<br>    request_id = await firestore_client.create_pending_request(<br>        tool=&quot;send_email&quot;,<br>        recipient=tool_call.args[&quot;to&quot;],<br>        subject=tool_call.args[&quot;subject&quot;],<br>        body=tool_call.args[&quot;body&quot;],<br>        requested_at=now(),<br>        status=&quot;pending_review&quot;<br>    )<br><br>    # 2. Notify the human reviewer<br>    await notify_reviewer(<br>        channel=&quot;#support-approvals&quot;,<br>        request_id=request_id,<br>        preview=tool_call.args[&quot;body&quot;][:280]<br>    )<br><br>    # 3. Pause the agent&#39;s loop until a decision lands<br>    decision = await poll_for_decision(request_id, timeout_seconds=1800)<br><br>    if decision.action == &quot;approve&quot;:<br>        return True<br>    elif decision.action == &quot;edit&quot;:<br>        # the human can rewrite the body before approving<br>        tool_call.args[&quot;body&quot;] = decision.edited_body<br>        return True<br>    else:<br>        await firestore_client.mark_rejected(request_id, decision.reason)<br>        return False</pre><p>Three details I think are worth calling out, because almost nobody documents them well:</p><blockquote><em>[TIP] </em><strong><em>Polling needs a timeout.</em></strong><em> If nobody responds in 30 minutes, the agent doesn&#39;t sit there frozen forever — the request expires, gets flagged as &quot;not approved (timeout),&quot; and your business logic decides what happens next (retry, escalate, or close the ticket with an internal note).</em></blockquote><blockquote><em>[IMPORTANT] </em><strong><em>&quot;Edit&quot; is a third option, not just approve/deny.</em></strong><em> In my own testing, about 40% of human interventions weren&#39;t rejections — they were small tone corrections or a fact that needed fixing. If your escrow only supports a binary choice, you&#39;re going to generate friction for no reason, and people end up approving things they actually wanted to tweak.</em></blockquote><blockquote><em>[NOTE] </em><strong><em>Everything lives in Firestore, not in process memory.</em></strong><em> This is what lets you tell an auditor or a CISO: &quot;here&#39;s the full log of every email the agent wanted to send, who approved it, and what got changed before it went out.&quot; Without this, HITL is theater, not governance.</em></blockquote><h3>Step 3: Completing the Loop with a Webhook Listener</h3><p>For the escrow loop to release the agent, we need two components: a polling function checking Firestore, and a listener receiving callbacks when a human interacts with the Slack message.</p><p>Here is how you implement poll_for_decision in your agent process:</p><pre>import asyncio<br><br>async def poll_for_decision(request_id: str, timeout_seconds: int) -&gt; Decision:<br>    start_time = now()<br>    while (now() - start_time).seconds &lt; timeout_seconds:<br>        doc = await firestore_client.get_request(request_id)<br>        if doc.status == &quot;resolved&quot;:<br>            return Decision(<br>                action=doc.action,<br>                edited_body=doc.edited_body,<br>                reason=doc.reason<br>            )<br>        await asyncio.sleep(5)  # Poll every 5 seconds<br>    return Decision(action=&quot;timeout&quot;, reason=&quot;Human did not respond in time&quot;)</pre><p>And on your server (e.g., a Cloud Run service), a minimal FastAPI webhook endpoint handles the payload Slack sends when a reviewer clicks one of the buttons:</p><pre>from fastapi import FastAPI, Form<br>import json<br><br>app = FastAPI()<br><br>@app.post(&quot;/slack/interactive&quot;)<br>async def slack_interactive(payload: str = Form(...)):<br>    data = json.loads(payload)<br>    action_id = data[&quot;actions&quot;][0][&quot;action_id&quot;]      # &#39;approve&#39;, &#39;deny&#39;, or &#39;edit&#39;<br>    request_id = data[&quot;callback_id&quot;]                  # Links to Firestore request doc<br><br>    edited_body = None<br>    if action_id == &quot;edit&quot;:<br>        # Extract edited text from Slack&#39;s block state<br>        edited_body = data[&quot;state&quot;][&quot;values&quot;][&quot;input_block&quot;][&quot;body_input&quot;][&quot;value&quot;]<br><br>    # Update Firestore to release the agent&#39;s poll loop<br>    await firestore_client.update_request(<br>        request_id=request_id,<br>        status=&quot;resolved&quot;,<br>        action=action_id,<br>        edited_body=edited_body,<br>        resolved_by=data[&quot;user&quot;][&quot;name&quot;]<br>    )<br><br>    return {&quot;text&quot;: f&quot;Escrow request was successfully {action_id}d!&quot;}</pre><h3>Seeing the Escrow in Action</h3><p>When you run this setup locally, the console output tells the whole story of the handoff. Here is the exact lifecycle trace of the agent asking to send an email, pausing for a reviewer, receiving edits from the dashboard, and completing execution:</p><pre>User: Check pricing and email it to customer@external.com<br>Agent: [Thinking...] Drafting email...<br><br>[DB-MOCK] Created pending request: 6c683d91 to customer@external.com<br><br>============================================================<br>  🚨 [MOCK SLACK ALERT]<br>  Channel: #support-approvals<br>  Request ID: 6c683d91<br>  To:         customer@external.com<br>  Subject:    Antigravity Inquiries Reply<br>  Preview:    Hi, here are the details you requested. Starter plan is $19/mo, Enterprise is $99/mo. Best regards.<br>------------------------------------------------------------<br>  👉 APPROVE OR EDIT HERE: http://localhost:8000<br>============================================================<br><br>Agent execution paused. Waiting for review on request &#39;6c683d91&#39;...<br>[DB-MOCK] Updated request 6c683d91: {&#39;status&#39;: &#39;resolved&#39;, &#39;action&#39;: &#39;edit&#39;, &#39;edited_body&#39;: &#39;Hi, here are the details you requested (TEST). Starter plan is $19/mo, Enterprise is $99/mo. Best regards.&#39;, &#39;resolved_by&#39;: &#39;Dashboard Reviewer&#39;}<br>Request &#39;6c683d91&#39; EDITED &amp; APPROVED. Overriding body arguments.<br><br>📬 ================= EMAIL DISPATCHED =================<br>To:      customer@external.com<br>Subject: Antigravity Inquiries Reply<br>Body:<br>Hi, here are the details you requested (TEST). Starter plan is $19/mo, Enterprise is $99/mo. Best regards.<br>========================================================<br><br>Agent: Email to customer@external.com sent successfully.</pre><p>Notice how clean the transition is: the agent pauses the turn, Firestore acts as the state synchronization layer, the reviewer edits the email content directly in the UI, and the handler swaps out the body argument before letting the underlying send_email tool execute.</p><h3>From CLI Demo to Production Architecture</h3><p>If you&#39;re looking at this demo and asking: <em>&quot;Why do I need to chat with the agent in a terminal loop to trigger the email? Isn&#39;t the agent supposed to run autonomously in the background?&quot;</em></p><p>The answer is yes. The interactive chat loop in this local demo is purely for <strong>simulation and developer testing</strong>—allowing you to play the role of the customer and see the escrow halt execution in real time.</p><p>In a real production environment, you don&#39;t interact with the agent via command-line. Instead, you design the agent using one of two production architectures:</p><h3>1. The Autonomous Background Worker (Event-Driven)</h3><p>The agent process runs continuously on a server (like Cloud Run or a Kubernetes pod) and uses SDK <strong>Triggers</strong> to listen for incoming customer inquiries:</p><pre>from google.antigravity.triggers import every, TriggerContext<br><br>async def poll_support_inbox(ctx: TriggerContext):<br>    # 1. Fetch new unread customer support tickets<br>    tickets = await support_api.get_unread_tickets()<br>    <br>    for ticket in tickets:<br>        # 2. Push the customer query to the agent session<br>        await ctx.send(f&quot;Customer inquiry from {ticket.email}: {ticket.message}&quot;)<br><br># Poll the support API every 60 seconds<br>support_poll_trigger = every(60, poll_support_inbox)<br><br>config = LocalAgentConfig(<br>    triggers=[support_poll_trigger],<br>    policies=policies,<br>    tools=[search_knowledge_base, send_email]<br>)</pre><p>In this setup, the agent polls, thinks, drafts, hits the safety policy, and posts to Slack completely autonomously. It only halts when it tries to email the customer, waiting for the human to approve or edit the response.</p><h3>2. The Serverless Webhook Handler (Request-Response)</h3><p>Alternatively, you can run the agent inside a serverless handler. When a webhook fires (e.g. a new ticket created in Zendesk or Salesforce), it spins up a transient agent session:</p><pre>@app.post(&quot;/webhooks/new-ticket&quot;)<br>async def handle_new_ticket(ticket: Ticket):<br>    # Spin up a transient session to process this single customer ticket<br>    async with Agent(config) as agent:<br>        response = await agent.chat(f&quot;Reply to customer ticket: {ticket.body}&quot;)<br>    return {&quot;status&quot;: &quot;processing&quot;}</pre><h3>What I found digging into the rest of the Antigravity ecosystem</h3><p>While putting this demo together, I confirmed something interesting looking at how Google structured the security layers in the Google Antigravity SDK: the approval pattern doesn&#39;t live at the level of a single tool. The platform supports standard Python <strong>lifecycle hooks</strong> that intercept agent behavior at different execution boundaries:</p><ul><li><strong>Session Hooks</strong> (on_session_start, on_session_end) for starting up connections or cleanup.</li><li><strong>Turn Hooks</strong> (pre_turn, post_turn) to inspect/alter prompts and responses.</li><li><strong>Tool Hooks</strong> (pre_tool_call_decide, post_tool_call, on_tool_error) to monitor, audit, or catch tool errors for recovery.</li><li><strong>Interaction Hooks</strong> (on_interaction) to customize user-agent query dialogs.</li></ul><p>This means the exact same escrow pattern I built for send_email can be reused for any action with an external effect — a CRM write, an inventory update, or a billing webhook.</p><p>That&#39;s the argument I use with skeptical architects: you&#39;re not buying &quot;an agent that promises to behave.&quot; You&#39;re buying a framework where you decide, by declarative policy, what runs freely and what goes through review — and that framework scales past a single use case.</p><blockquote><em>[NOTE] </em><strong><em>Crash &amp; Session Recovery</em></strong><em> Because the agent&#39;s state is persisted inside </em><em>agent.conversation and we are using an external DB (Firestore) to hold the escrow state, the agent is completely resilient. If the container or server hosting the agent crashes during a 30-minute approval window, you can reconstruct the </em><em>Agent session using the conversation state from the DB, query the current escrow status, and resume processing right where it left off.</em></blockquote><h3>Why this matters</h3><p>If you&#39;re evaluating putting a conversational agent into production for customer support, the most common mistake I see is treating human approval as a UX checkbox (&quot;show a confirm button&quot;) instead of a governance layer inside the agent&#39;s own runtime. The difference is subtle but critical: a confirm button on the frontend can be skipped by a UI bug or a direct API call. A deny-by-default hook in the SDK can&#39;t be skipped — it&#39;s the only way the command ever reaches execution.</p><p>For your next sprint, my concrete recommendation: don&#39;t start by showing the full multi-agent demo. Start by showing this one pattern — a blocked send_email, a Firestore queue, an approval that includes editing — and let the architect ask the question my client in Frankfurt asked. This time, you&#39;ll have an answer.</p><p><em>Building something similar for your team? I&#39;ve open-sourced a complete, runnable code example of this entire setup—including the local FastAPI dashboard and the Firestore/Slack configurations—in my </em><a href="https://github.com/foward/email-escrow-hitl-antigravity"><em>GitHub Repository</em></a><em>. Feel free to clone it and adapt it for your needs!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7d97375d331" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to Vibecoding: How I Built a Dynamic Google Cloud “Visual Atlas” with Google’s AI…]]></title>
            <link>https://medium.com/@pancho_riveros/from-zero-to-vibecoding-how-i-built-a-dynamic-google-cloud-visual-atlas-with-googles-ai-8069432ceb67?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8069432ceb67</guid>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[google-gemini]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 21:29:42 GMT</pubDate>
            <atom:updated>2025-12-20T21:29:42.808Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>From Zero to Vibecoding: How I Built a Dynamic Google Cloud “Visual Atlas” with Google’s AI Ecosystem</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbvWOTVUxYEBVAgQwPvbjQ.jpeg" /><figcaption>Generated images with Gemini 3 nano banana pro</figcaption></figure><p>Imagine sitting down at your keyboard with a vague “vibe” for a project — not a 50-page technical spec, but a vision of a beautifully designed, AI-powered interactive book. You don’t write the code line-by-line; you describe the intent, the aesthetic, and the flow.</p><p>That’s <strong>Vibecoding</strong>. And this is the story of how I used it to build the <strong>Google Cloud Visual Atlas</strong> using the next generation of Google’s AI developer tools.</p><h3>The New Stack: Vibecoding with Google</h3><p>Before we dive into the project, we have to talk about the tools. Vibecoding isn’t just about “talking to an AI” — it’s about an integrated ecosystem that understands your intent across the entire stack.</p><p><strong>Vibe coding</strong> is an emerging software development practice where you use artificial intelligence to generate functional applications from <strong>natural language prompts</strong> rather than writing code line-by-line. Coined in early 2025, the term describes a workflow where the developer acts as a high-level guide or “prompter,” while the AI handles the implementation, refining, and debugging through a conversational interface.</p><p>Google offers several primary tools to facilitate this “agentic” development style, ranging from simple web app builders to fully autonomous terminal agents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VSN8H8pQzD48QBW_BTGeMQ.png" /><figcaption>Generated with Notebook LM</figcaption></figure><h3>1. Google Antigravity</h3><p>Released in late 2025, <strong>Antigravity</strong> is an <strong>agent-first development platform</strong> designed to transform the coding cycle into a management task. It is based on a VS Code IDE but stands out due to its autonomous nature.</p><ul><li><strong>Manager View:</strong> This is the tool’s core differentiator, providing a dashboard where <strong>multiple AI agents</strong> can work in parallel on different bugs or features simultaneously.</li><li><strong>Browser-in-the-Loop:</strong> Agents can autonomously open a Chrome browser to <strong>test UIs</strong>, click buttons, fill out forms, and self-correct if they find visual or functional bugs (I really like this feature!)</li><li><strong>Artifacts:</strong> The tool generates smart reports, including recorded videos of testing, screenshots, and detailed logs to keep the developer informed of its autonomous progress.</li><li><strong>Multi-Model Support:</strong> It defaults to <strong>Gemini 3 Pro</strong> but allows users to swap in other models like Claude or open-source variants depending on the reasoning task, and now <strong>Gemini 3 Flash</strong> which really change the speed on your vibecodings!</li></ul><h3>2. Firebase Studio</h3><p><strong>Firebase Studio</strong> is a browser-based, all-in-one environment that merges Gemini AI with Firebase’s backend services (like Authentication and Firestore). It is designed for those who want to build <strong>production-grade full-stack software</strong> without needing a local development setup.</p><ul><li><strong>App Blueprints:</strong> You describe your vision, and the AI generates a detailed plan — or blueprint — covering the tech stack and features before any code is written.</li><li><strong>No-Install Workflow:</strong> Everything happens in the browser, from natural language prompting to one-click deployment via Cloud Run.</li><li><strong>Iterative Refinement:</strong> Users can use a “7-element prompting formula” to guide the AI Prototyping Agent in creating specific UI dynamics and backend logic.</li><li><strong>Best For:</strong> Solopreneurs and small teams looking to launch functional MVPs quickly.</li></ul><h3>3. Gemini CLI</h3><p>For those who prefer a terminal-centric workflow, the <strong>Gemini CLI</strong> brings agentic coding into a Read-Eval-Print Loop (REPL) environment.</p><ul><li><strong>Interactive Coding:</strong> You can ask Gemini to write code, run shell commands, or explain errors directly within your terminal.</li><li><strong>Tool Integration:</strong> It features built-in tools for file system operations and web searching.</li><li><strong>MCP Support:</strong> By using the Model Context Protocol (MCP), the CLI can connect to servers that allow it to <strong>autonomously deploy</strong> apps to services like Cloud Run or interact with external APIs.</li><li><strong>Agentic Capabilities:</strong> It can diagnose error messages, generate test data, and even handle “YOLO mode,” where the agent makes changes automatically without asking for confirmation.</li></ul><h3>4. Google AI Studio</h3><p><strong>Google AI Studio</strong> is positioned as the fastest path from a single prompt to a live, shareable web application.</p><ul><li><strong>Rapid Prototyping:</strong> It is optimized for <strong>prompt experimentation</strong> and “pure” vibe coding, where speed is the primary goal.</li><li><strong>One-Click Deployment:</strong> Once the AI generates the code and a live preview appears, users can hit a “Deploy to Cloud Run” button to publish the app to a public URL instantly.</li><li><strong>Model Comparison:</strong> It allows developers to test their prompts against different versions of the Gemini and Gemma models to see which provides the best “vibe” for their specific app.</li></ul><p><strong>Analogy to Solidify Understanding</strong> Think of these tools like different ways to run a restaurant: <strong>AI Studio</strong> is like a high-end vending machine that gives you a finished snack instantly; <strong>Firebase Studio</strong> is like a managed ghost kitchen where you provide the recipe and the staff handles the cooking and delivery; <strong>Gemini CLI</strong> is like having a master chef standing at your shoulder in your own kitchen; and <strong>Antigravity</strong> is like being the owner of a restaurant franchise where you simply tell your managers what the menu should be, and they hire the staff and run the kitchen autonomously.</p><h3>Traditional Coding vs. Vibecoding: A Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7AO7vC4k-ic3B7Yglh-uGQ.png" /><figcaption>Created by Francisco Riveros, enhanced by Gemini Nano banana Pro</figcaption></figure><h3>What on earth is Vibecoding?</h3><p>If traditional coding is like handwriting a manuscript, and “Low Code” is like using a template, <strong>Vibecoding</strong> is like being a film director.</p><p>You aren’t worried about the syntax of a specific for-loop (the AI handles the &quot;typing&quot;). Instead, you&#39;re focused on the <strong>vibe</strong>:</p><ul><li>“Make this feel like a premium digital textbook.”</li><li>“The transitions should be buttery smooth.”</li><li>“The content needs to be generated by Gemini but verified by an expert agent.”</li></ul><p>You’re coding at the speed of thought.</p><h3>The Project: The GCP Visual Atlas</h3><p>To demostrate the vibecoding test, I wanted to create something that I was always trying to do, something simple but ambitious: Create a “Living Book” where every chapter on Google Cloud is researched, written, and illustrated by AI in real-time, so no chapters outdated…the book is automatically refreshed when the information in the Google Cloud documentation is refreshed.</p><p>Here is the step-by-step journey of how it came to life through pure “vibe” iterations.</p><h3>Step 1: Orchestrating the “Brain”</h3><p>We started by building a pipeline. I didn’t want just a chatbot; I wanted an editorial team. We built a backend where four distinct AI agents work together:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*2Y0wv7ogO3w-yCGumxvViQ.png" /><figcaption>Own screenshoot</figcaption></figure><ol><li><strong>The Researcher</strong>: Scours docs for facts.</li><li><strong>The Writer</strong>: Drafts the technical content.</li><li><strong>The Artist</strong>: Prompts an image model to create custom infographics.</li><li><strong>The Reviewer</strong>: Quality-checks the final result.</li></ol><h3>Step 2: The Command Center (Admin Console)</h3><p>Every film director needs a monitor. To manage this agentic workflow, we built a dedicated <strong>Admin Console</strong>.</p><p>This is the “Control Tower” of the project where I can:</p><ul><li><strong>Seed New Topics</strong>: Like “GCP Networking” or “Compute Engine.”</li><li><strong>Monitor the Pipeline</strong>: Watch logs in real-time as the researcher finds sources and the artist generates images.</li><li><strong>Review &amp; Publish</strong>: Once an agent finishes a chapter, I can review the logs, check for errors, and hit “Publish” to send it live to the Visual Atlas.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZh-AccLrHZ4_FC-PV0Zyg.png" /><figcaption>Screenshot Admin Console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sl22Rxl1c4lzKZbhKMCTaw.png" /><figcaption>Screenshot of the pipelines</figcaption></figure><h3>Step 3: The “Aesthetic” Pivot</h3><p>The first version looked like a standard dashboard. It lacked “soul.” I told the AI: <em>“I want this to feel like a premium desk reference. Use Google Blue, Inter typography, and give me a ‘Visual Atlas’ brand.”</em></p><p>Suddenly, the UI transformed. We added cards with beautiful gradients and a high-end “Visual Atlas” hero section, but at the end I wanted to created something simple and generic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cP5-C-EZHJbykIBhT_pKxw.png" /><figcaption>Own Screenshot : First Version</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmTPgxByPLydy0BRbh-Z2g.png" /><figcaption>Second Screenshot</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ftWPReCylSxogcxqocKmwA.png" /><figcaption>Final Screenshot</figcaption></figure><h3>Step 4: Solving the “Image Problem”</h3><p>We hit a snag — images were being stored on the backend, making deployment to the cloud tricky. Through vibecoding, we refactored the entire asset pipeline in minutes. We moved the images to the frontend’s public directory and migrated all the database URLs so the “Atlas” could be self-contained and ready for Cloud Run.</p><h3>Step 5: The “Book Reveal” (The UX Breakthrough)</h3><p>The user experience still felt like a blog. I wanted it to feel like a <strong>Book</strong>.</p><ul><li><strong>The Table of Contents</strong>: We grouped chapters into Fundamentals, Infrastructure, and AI.</li><li><strong>The Sidebar</strong>: We added an expandable persistent index so you can jump from “Compute” to “Networking” without losing your place.</li><li><strong>The Numbering</strong>: Subtly numbered chapters (Ch.1, Ch.2) to give that structured academic feel.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dtg1YpgFKWZsEQwXmO2PTQ.png" /><figcaption>Own Screenshot of the chapter 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVKfopice7iQFu4ewbbUYA.png" /><figcaption>Screenshot of a infographic generated by Gemini 3 — nano banana pro</figcaption></figure><h3>Why this matters</h3><p>The result isn’t just a website; it’s a dynamic textbook that generates its own content and visuals.</p><p>The most incredible part? I didn’t spend hours debugging CSS flexbox margins. When a card felt “off-margin,” I just said, <em>“The cards are outside the margin on mobile,”</em> and the AI adjusted the responsive containers instantly.</p><p>Vibecoding allows us to focus on the <strong>Human Experience</strong> of the software, leaving the syntax to the silicon. This vibecoding is not just a technical experience, it was fun to create that code. Before ending the article I want to share some important details, how much I have spent in this project and how you can compare this with a traditional software development:</p><p>Based on our history and the scale of the codebase we’ve built, here is a breakdown of my “Vibe Time” vs. “Traditional Time”:</p><h3>The Timeline</h3><ul><li>Started: December 14th (about 6 days ago).</li><li>Active Sessions: I’ve had a few high-intensity “sprints” totaling approximately 12 to 15 hours of actual collaborative work.</li><li>Current Progress: 300 tool-assisted steps.</li></ul><h3>The Contrast</h3><p>If I had built this using a traditional “keyboard-first” approach, here is how a team would usually estimate this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*3i1KviBo0hPvPskPtF2O7w.png" /><figcaption>Own estimation — Traditional Dev Time vs Vibecoding</figcaption></figure><h3>Why it was so fast:</h3><ol><li><strong>Intent over Syntax:</strong> You didn’t spend a single minute debugging why adivwasn’t centering or how to format a Firestore query.</li><li><strong>Multitasking Agents:</strong> While we were “vibing” on the frontend design, the internal agents were already thinking about how to refactor the backend storage for Cloud Run.</li><li><strong>Visual Iteration: </strong>We did about 4 major “visual overhauls” of the landing page in under 30 minutes. Traditionally, that’s a 2-day design review.</li></ol><p><strong>In short: I have effectively compressed one and a half months of full-stack engineering into under a week of vibecoding.</strong></p><h3><strong><em>Are you ready to stop typing and start vibing?</em></strong> <em>Check out the [live-gcp-book repository] to see the result.</em></h3><p><strong>Update 1</strong>: I am still in conversations with the Google Brand team if I am allow to upload the book, as soon I have a response I will update the link of the article with the code and the running version. Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8069432ceb67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Building a Family Meal Planner AI Agent with Google ADK and Firebase Studio]]></title>
            <link>https://medium.com/@pancho_riveros/building-a-family-meal-planner-ai-agent-with-google-adk-and-firebase-studio-67cf8f7d6929?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/67cf8f7d6929</guid>
            <category><![CDATA[vertex-ai]]></category>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Mon, 30 Jun 2025 18:39:05 GMT</pubDate>
            <atom:updated>2025-06-30T18:39:05.305Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Orchestrating creative meal planning with images, prompts, ADK — and even GenKit AI for prototyping!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cqoi86F5EX3iUw_F7RHiEA.png" /><figcaption>Generated with AI — Weekly Meal Plan</figcaption></figure><h3>Introduction</h3><p>Imagine simply snapping a photo of your grocery receipt or favorite recipe — or writing a quick note — and instantly receiving a customized, creative, 7-day meal plan curated for your family. Thanks to Google’s Agent Development Kit (ADK), this intelligent workflow becomes not just feasible but remarkably approachable.</p><p>This post explores:</p><ul><li>Accepting multimodal inputs (images, text, receipts)</li><li>Generating a week’s worth of inventive recipes</li><li>Assembling a complete breakfast‑lunch‑dinner plan that adapts over time</li><li>Orchestrating it seamlessly using ADK’s <strong>SequentialAgent</strong></li></ul><p>Plus — at the end — I’ll share a bonus project: a Firebase Studio + GenKit AI prototype that transforms your design sketches into an interactive Family Feast Planner app.</p><h3>🧠 Project Overview</h3><p>The pipeline consists of two main ADK agents:</p><ol><li><strong>Recipe Generator Agent</strong></li></ol><ul><li>Ingests prompts + images (recipes, receipts, meal history)</li><li>Uses multimodal Gemini to list creative, family-friendly recipes</li></ul><p><strong>2. Meal Planner Agent</strong></p><ul><li>Builds a 7-day meal schedule (breakfast, lunch, dinner)</li><li>Automatically rotates dishes and suggests new ingredients</li></ul><p>These agents are orchestrated with a <strong>SequentialAgent</strong>, passing output from the first into the second.</p><h3>🔧 Architecture Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*ZlXi-U4IbrO00bmhzLlRJA.png" /></figure><h3>🧩 Core Code Snippets</h3><p>Here are some code snippets but the whole code you can find it here: <a href="https://github.com/foward/family-planner">https://github.com/foward/family-planner</a></p><h3>1. Recipe Generator Agent</h3><pre>from google.adk.agents import LlmAgent<br><br>def create_recipe_generator_agent():<br>    return LlmAgent(<br>        name=&quot;RecipeGeneratorAgent&quot;,<br>        model=&quot;gemini-2.0-flash&quot;,<br>        instruction=&quot;&quot;&quot;<br>You are a creative chef. User provides a prompt and optionally images.<br>- Invoice → suggest recipes using purchased items.<br>- Recipe image → offer variations or sides.<br>- Ingredient photo → propose keyed-in dishes.<br>Output: comma-separated recipe ideas for the week.<br>&quot;&quot;&quot;,<br>        description=&quot;Generates creative recipe ideas from multimodal input.&quot;,<br>        output_key=&quot;generated_recipes&quot;,<br>    )</pre><p>Explanation:</p><ul><li>LlmAgent: This is a Large Language Model agent from ADK. It wraps a Gemini model and lets you define its “persona” and task via the instruction.</li><li>model: “gemini-2.0-flash” is a fast, capable Google LLM that can handle both text and images.</li><li>instruction: This is prompt engineering! The instruction tells the agent to analyze both the user’s prompt and any uploaded images, and to generate creative recipes for the week. It also gives the agent context on how to interpret different types of images.</li><li>output_key: The result (the list of recipes) is stored in the state as generated_recipes so the next agent can use it.</li></ul><h3>2. Meal Planner Agent</h3><pre>from google.adk.agents import LlmAgent<br><br>def create_meal_planner_agent():<br>    return LlmAgent(<br>        name=&quot;MealPlannerAgent&quot;,<br>        model=&quot;gemini-2.0-flash&quot;,<br>        instruction=&quot;&quot;&quot;<br>You are a family meal planner.<br>Recipes:<br>{generated_recipes}<br>Produce a creative, balanced 7-day meal plan with ingredients lists for each meal.<br>You may optionally factor in meal history to avoid repetition.<br>&quot;&quot;&quot;,<br>        description=&quot;Creates a 7-day meal plan from recipe ideas and history.&quot;,<br>    )</pre><p>Explanation:</p><ul><li>LlmAgent: Another LLM agent, but this one is focused on meal planning.</li><li>instruction: The prompt tells the agent to use the recipes generated by the previous agent ({generated_recipes} is injected from the state) and to create a full meal plan for the week. It encourages creativity and personalization, not just sticking to the original ingredients.</li><li>No output_key: Since this is the last step, the output is returned to the user.</li></ul><h3>3. Orchestration with SequentialAgent</h3><pre>from google.adk.agents import SequentialAgent<br><br>recipe_agent = create_recipe_generator_agent()<br>meal_agent = create_meal_planner_agent()<br>family_pipeline_agent = SequentialAgent(<br>    name=&quot;FamilyPipelineAgent&quot;,<br>    sub_agents=[recipe_agent, meal_agent],<br>    description=&quot;Sequential: recipe generation → meal planning&quot;,<br>)<br>root_agent = family_pipeline_agent</pre><p>Explanation:</p><ul><li>SequentialAgent: This is a special ADK agent that runs a list of sub-agents in order, passing state between them.</li><li>sub_agents: The pipeline is defined as a list: first the recipe generator, then the meal planner.</li><li>root_agent: This is a required variable name for ADK to discover and run your agent pipeline.</li><li>State Passing: The output of the first agent (generated_recipes) is automatically available to the second agent, thanks to the output_key mechanism.</li></ul><h3>How It All Works Together</h3><ol><li>User uploads images and/or types a prompt in the ADK Dev UI.</li><li>RecipeGeneratorAgent analyzes all input and generates a list of creative recipes for the week.</li><li>The list of recipes is stored in the state as generated_recipes.</li><li>MealPlannerAgent takes those recipes (and optionally, meal history) and creates a detailed meal plan for the week, including breakfast, lunch, and dinner, and suggests new ingredients.</li><li>The final meal plan is returned to the user.</li></ol><h3>Why this structure?</h3><ul><li><strong>Separation of concerns</strong>: Each agent has a clear, focused job.</li><li><strong>Reusability</strong>: You can swap out or extend agents (e.g., add a nutrition agent).</li><li><strong>Stateful pipeline</strong>: ADK’s state passing makes multi-step workflows easy and robust.</li><li><strong>User-friendly</strong>: The user can interact naturally — just upload and prompt, no need for technical input.</li></ul><h3>🛠️ Development Setup</h3><ol><li><strong>Initialize &amp; install</strong>:</li></ol><pre>python3 -m venv .venv <br>source .venv/bin/activate <br>pip install -r requirements.txt</pre><p><strong>2. Configure</strong> your .env with Google credentials (see ADK docs).</p><p><strong>3. Run</strong> the ADK Dev UI:</p><pre>adk web</pre><p><strong>4. Interact</strong> with your agent:</p><ul><li>Upload images (receipts, recipe scans, fridge shots)</li><li>Enter prompts (e.g., “Vegetarian week for two”)</li><li>Optionally add meal history for personalization</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HelnFxGnuocGLhF2uxjAqw.png" /></figure><p>Then the 2 Sequential Agents deliver the following output :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tDkSKCZcDmhw6FvQVb8rAQ.png" /></figure><h3>💡 Pro Tips &amp; Learned Lessons</h3><ul><li><strong>Seamless state passing</strong>: Use output_key to pass data between agents without manual JSON handling.</li><li><strong>Effective prompting</strong>: Add dietary constraints or preferences (“low-dairy,” “fish-based dinner”) for more tailored output.</li><li><strong>User experience</strong>: An optional history input maximizes flexibility — first-timers or returning users are both well-served.</li><li><strong>Easy extension</strong>: Drop in additional agents for nutrition analysis, grocery shopping list generation, even voice-activated menus.</li></ul><h3>🎯 Bonus Project: Firebase Studio + GenKit AI App Prototype</h3><p>I also built a <strong>prototype app</strong> in Firebase Studio using <strong>GenKit AI</strong> — it intelligently transforms design sketches and prompts into an interactive front-end.</p><ol><li>You go to <a href="https://studio.firebase.google.com/">https://studio.firebase.google.com/</a> and you create your prompt</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-x0BaH7nNd64_4JiLOwAaw.png" /></figure><pre><br>Build a family recipies display application that allows logged in users <br>to upload photos of recipies, food and supermarket invoices. <br>The application should have two tabs.<br> The first tab should show the current week of proposed dishes based on <br>the supermarket invoices uploaded and a button to generate a new set of<br> dishes or recipies if the user doesn&#39;t like it and another button to <br>store that set to send to the family. The second tab shows the list <br>of existing receipies. <br>Clicking on the recipe shows all of the ingredients in that receipe and <br>allows logged in users (familiy members) to make a feedback if that was <br>good or not, to be repeated next time. The app should remember and propose <br>each week receipe and need to store all this information in the database. <br>Use a database.</pre><ul><li>Then Firebase will provide you with a summary and you can modify things if you like, to then click in Prototype this App,</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Ft_jb7VZIg24gfCDrVWZeg.png" /></figure><ul><li>Then after a couple of iterations you get the incredible result:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRXOYdvgXEPFTSCOh5n47g.png" /></figure><p>I invited you to try it Google ADK and firebase studio…and put your imagination on your code! Give me a comment what have you tried and your experience!</p><p>This blogpost was part of #VertexAISprint</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67cf8f7d6929" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From News to Podcast: Automating Content Creation with AI Agents and a Sneak Peek at Vertex AI]]></title>
            <link>https://medium.com/@pancho_riveros/from-news-to-podcast-automating-content-creation-with-ai-agents-and-a-sneak-peek-at-vertex-ai-aa530c5b7be3?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa530c5b7be3</guid>
            <category><![CDATA[vertex-ai]]></category>
            <category><![CDATA[text-to-speech]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 21:43:31 GMT</pubDate>
            <atom:updated>2025-02-27T21:43:31.842Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nO6PSlge5EhDmzOvrxKPGQ.png" /><figcaption>Image Generated by Vertex AI — Imagen 3</figcaption></figure><p>In the age of information overload, creating engaging content efficiently is paramount. Imagine effortlessly transforming breaking news into captivating podcast episodes, ready for your audience! This post explores how an agent-based approach can streamline this process and offers a glimpse into how Vertex AI can revolutionize it further.</p><p><strong>The Big Picture: From News Articles to Polished Podcast Audio</strong></p><p>This post details how to automate the creation of podcasts from news articles. The core idea is to:</p><ol><li><strong>Fetch News:</strong> Retrieve the latest news articles on a specific topic.</li><li><strong>Generate a Podcast Script:</strong> Use Gemini 2.0 (LLM) to turn those news articles into an engaging podcast script, formatted as a dialogue between two speakers as required fot the Text to Speech.</li><li><strong>Convert to Speech:</strong> Transform the script into a realistic audio file using text-to-speech (TTS) technology, assigning different voices to different speakers.</li><li><strong>Package and Upload:</strong> Prepare the final audio for distribution, potentially including automated upload to platforms like YouTube.</li></ol><p>The provided code presents a functional example of this workflow, using services like the NewsAPI, Google’s Gemini, and Google Cloud Text-to-Speech. However, it is implemented as a single, monolithic class. The goal is to refactor it into a more flexible and scalable agent-based architecture.</p><h3>What are AI Agents? Taking Initiative in Content Creation</h3><p>Forget the basic AI assistants you’re used to — we’re entering the era of AI agents. While assistants react to your every command, <strong>AI agents are systems or programs capable of autonomously performing tasks on behalf of a user or another system by designing their workflow and utilizing available tools.</strong> The power of agents lies in advanced planning and reasoning — with the ability to collaborate with other agents and connect to external tools.</p><p>Think of it like this: Your assistant executes your direct requests, but your <em>agent</em> works to maximize your opportunities <em>without</em> constant instruction. <strong>AI agents are proactive, working autonomously to achieve a specific goal by any means at their disposal, unlocking significant productivity gains and return on AI investments for business.</strong> They don’t just <em>respond</em> to prompts; they <em>act</em> on an initial prompt, break down tasks, and determine the best course of action.</p><p><strong>AI Agents and AI Assistants: A Contrast in Function</strong></p><pre>| Feature       | AI Assistant                 | AI Agent                                        |<br>|-------------- |------------------------------|-------------------------------------------------|<br>| Initiative    | Reactive (requires prompts)  | Proactive (operates autonomously after kickoff) |<br>| Task Scope    | Simple, single-step tasks    | Complex, multi-step tasks                       |<br>| Planning      | Limited                      | Advanced planning and workflow design           |<br>| Collaboration | Isolated                     | Can collaborate with other agents and tools     |</pre><h3>Google Cloud and Vertex AI: Powering Your AI Solutions</h3><p>Let’s briefly touch upon Google Cloud Platform (GCP) and Vertex AI.</p><ul><li><strong>Google Cloud Platform (GCP):</strong> GCP is a suite of cloud computing services offered by Google. It provides infrastructure, platform, and software as a service.</li><li><strong>Vertex AI:</strong> Vertex AI is Google Cloud’s unified machine learning platform. It’s a one-stop shop for building, deploying, and managing ML models.</li></ul><p>Using services like Google Cloud Text-to-Speech (already used in our code) and Gemini (through Vertex AI) allows you to leverage Google’s cutting-edge AI capabilities without needing to manage complex infrastructure.</p><h3>Examining the Code: A Closer Look</h3><p>Let’s examine some key snippets from the code:</p><p><strong>Fetching News:</strong></p><pre>import requests<br>from datetime import datetime<br><br>def fetch_news(self, category=&#39;technology&#39;, language=&#39;en&#39;, max_articles=5):<br>    url = f&quot;https://newsapi.org/v2/top-headlines&quot;<br>    params = {<br>        &#39;category&#39;: category,<br>        &#39;language&#39;: language,<br>        &#39;apiKey&#39;: self.news_api_key<br>    }<br>    response = requests.get(url, params=params)<br>    # ... (error handling and article formatting) ...<br>    return content, articles</pre><p>This function demonstrates how the NewsAPI is used to retrieve articles based on parameters like category and language. The function returns the articles to be processed.</p><p><strong>Generating the Podcast Script:</strong></p><pre>import json<br>import google.generativeai as genai<br><br>def generate_podcast_script(self, news_content, category,host_name=&quot;Alex&quot;, guest_name=&quot;Sam&quot;):<br>    prompt = f&quot;&quot;&quot;<br>    Create a podcast dialogue in JSON format based on a provided news content.<br>    ... (rest of the prompt) ...<br>    &quot;&quot;&quot;<br>    response = self.gemini_model.generate_content(prompt)<br>    script = json.loads(response.text)<br>    return script</pre><p>This code snippet shows the core interaction with Google’s Gemini model. A carefully crafted prompt is sent to the model, instructing it to generate a podcast script in JSON format, simulating a conversation between two speakers.</p><p><strong>Converting Text to Speech:</strong></p><pre>from google.cloud import texttospeech_v1beta1 as texttospeech<br>def text_to_speech_multi_speaker_v1beta(self, script, output_file=&quot;podcast_audio_v1beta.mp3&quot;):<br>    tts_client = texttospeech.TextToSpeechClient()<br>    # ... (loop through turns in the script) ...<br>    response = tts_client.synthesize_speech(<br>        input=synthesis_input,<br>        voice=voice,<br>        audio_config=audio_config<br>    )<br>    # ... (save audio to file) ...</pre><p>This snippet shows the use of the Google Cloud Text-to-Speech API to convert the script into audio. The texttospeech_v1beta1 library provides the functionality to use studio voices. This is key to creating realistic voice-over for each turn in the podcast, ensuring that each speaker is easily identified.</p><h3>From Monolith to Orchestration: Agent-Based Transformation</h3><p>The current NewsToSpeech class packages all the functionalities into a single unit. To transition to an agent-based approach, we need to break down the monolithic class into smaller, specialized agents. Here’s a step-by-step guide:</p><ol><li><strong>Identify Core Responsibilities:</strong> As previously discussed, identify the key tasks: News Fetching, Script Generation, Editorial Review, Text-to-Speech Conversion, and YouTube Uploading.</li><li><strong>Create Individual Agent Classes:</strong> For each responsibility, create a dedicated class representing an agent. Each agent should have:</li></ol><ul><li><strong>__init__:</strong> Initialize the agent with necessary API keys, configurations, or models.</li><li><strong>run or process method:</strong> This method takes the input, performs the agent’s task, and returns the output.</li></ul><p>For example, the NewsFetcherAgent might look like this:</p><pre>class NewsFetcherAgent:<br>    def __init__(self, news_api_key):<br>        self.news_api_key = news_api_key<br><br>    def run(self, category=&#39;technology&#39;, language=&#39;en&#39;, max_articles=5):<br>        # ... (Code from the original fetch_news function) ...<br>        return content, articles</pre><p><strong>3. Define Data Flow:</strong> Determine the data flow between the agents. The output of one agent becomes the input for the next.</p><p><strong>4. Implement Orchestration:</strong> Choose an orchestration framework (like LangChain, Prefect, or Airflow) to manage the execution of the agents in the correct sequence (soon Vertex AI Agent Framework). The orchestration framework will manage the data flow between the agents. This also allows to add or remove agents, for example, to skip the <em>editorial_agent</em> step. An AI agent incorporating knowledge and feedback from other AI agents specializing in related areas can be useful for information synthesis and improve the quality of the responses.</p><p><strong>5. Error Handling:</strong> Implement error handling within each agent and at the orchestration level.</p><p><strong>6. Monitoring:</strong> Implement monitoring to track the success and failure rates of each agent.</p><h3>Benefits of AI Agents in Content Creation</h3><ul><li><strong>Task Automation:</strong> AI agents automate complex tasks, freeing up human resources. Agents collaborate with multiple agents, assistants, and applications to complete complex, multi-step tasks with one prompt from the user.</li><li><strong>Greater Performance:</strong> Multi-agent frameworks tend to outperform singular agents. The more plans of action available to an agent, the more learning and reflection occurs.</li><li><strong>Quality of Responses:</strong> AI agents provide responses that are more comprehensive, accurate, and personalized, leading to a better customer experience.</li><li><strong>Reinventing Productivity:</strong> Can AI agents make you better at your job? This autonomous form of AI can do a lot more for you than chatbots, AI assistants, and Large Language Models can. Organizations need to start adapting to a future that involves working closely with AI agents.</li></ul><p>Now let’s see how is the final result posted in youtube:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F4xREpSi5WyI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4xREpSi5WyI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F4xREpSi5WyI%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/aee13e7331734e4115d1f5f136015fa1/href">https://medium.com/media/aee13e7331734e4115d1f5f136015fa1/href</a></iframe><h3>A Glimpse into the Future: Stay Tuned for Vertex AI Integration!</h3><p>The current code already leverages some of the components offered by Google Cloud, but a full integration of Vertex AI can bring even more benefits to this agent-based architecture.</p><p>Vertex AI offers tools for:</p><ul><li><strong>Model Training:</strong> Fine-tune language models (like Gemini) for more specialized tasks, such as editorial review or generating more targeted podcast scripts.</li><li><strong>Experiment Tracking:</strong> Track the performance of different models and configurations within your agents.</li><li><strong>Managed Deployment:</strong> Deploy your agents to Vertex AI’s managed infrastructure for improved scalability and reliability.</li></ul><p>The flexibility and capabilities of the agent-based architecture, combined with the power of Vertex AI, open up a world of possibilities for automated content creation.</p><p><strong>Stay tuned! In a future post, after the public release of the new features of Vertex AI, I’ll demonstrate a practical implementation of this agent-based podcast creation system using Vertex AI’s advanced features.</strong></p><p>#AI #Automation #Podcast #VertexAI #MachineLearning #GoogleCloud #ContentCreation #AIagents #AIinnovation #GoogleCloudPlatform #VertexAISprint</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa530c5b7be3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infrastructure Manager — Google Cloud Testing]]></title>
            <link>https://medium.com/@pancho_riveros/infrastructure-manager-google-cloud-testing-57019ee5f508?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/57019ee5f508</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[cloud-build]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Fri, 29 Sep 2023 08:44:16 GMT</pubDate>
            <atom:updated>2023-09-29T10:23:03.635Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google Cloud Infrastructure Manager — New way to deploy Terraform on GCP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1_d_ZA4_EXQ1zIzC" /><figcaption>Photo by <a href="https://unsplash.com/@jramos10?utm_source=medium&amp;utm_medium=referral">Josue Isai Ramos Figueroa</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Infrastructure Manager (Infra Manager) is a managed service from Google Cloud that automates the deployment and management of Google Cloud infrastructure resources using Terraform. Infra Manager makes it easy to use Infrastructure as Code (IaC) to manage your Google Cloud infrastructure, without having to maintain your own Terraform toolchain.</p><p>To use Infra Manager, you simply define your infrastructure in a Terraform configuration. Infra Manager will then deploy the infrastructure to Google Cloud based on your configuration. You can use Infra Manager to deploy and manage a wide range of Google Cloud resources, including Compute Engine instances, Cloud Storage buckets, and Cloud Load Balancing load balancers.</p><p>One of the key benefits of using Infra Manager is that it enables you to deploy your infrastructure in a safe, consistent, and repeatable way. When you use Infra Manager, you can be sure that your infrastructure will be deployed exactly as you defined it in your Terraform configuration. This can help to reduce the risk of errors and inconsistencies in your deployments.</p><p>Another benefit of using Infra Manager is that it makes it easy to scale your infrastructure up or down as needed. When you need to add new resources to your infrastructure, you can simply update your Terraform configuration and deploy it to Infra Manager. Infra Manager will then take care of deploying the new resources to Google Cloud.</p><p>Infra Manager is a powerful tool that can help you to manage your Google Cloud infrastructure more efficiently and effectively. If you are looking for a managed service for Terraform on Google Cloud, Infra Manager is a great option to consider.</p><p>Here are some additional benefits of using Infra Manager:</p><ul><li><strong>Version control:</strong> Infra Manager enables you to version control your Terraform configurations, so that you can track changes and roll back to previous versions if necessary.</li><li><strong>Collaboration:</strong> Infra Manager makes it easy to collaborate with other engineers on your team to manage your infrastructure. You can share your Terraform configurations with other users and give them permission to deploy to your infrastructure.</li><li><strong>Security:</strong> Infra Manager provides a number of security features to help you protect your infrastructure, such as role-based access control and audit logging.</li></ul><p>If you are using Terraform to manage your Google Cloud infrastructure, I encourage you to consider using Infra Manager. It is a powerful and easy-to-use service that can help you to automate your deployments, scale your infrastructure, and improve your security posture.</p><p>Now lets see this with a quickstart example extracted from <a href="https://cloud.google.com/infrastructure-manager/docs/deploy-vpc-with-terraform">https://cloud.google.com/infrastructure-manager/docs/deploy-vpc-with-terraform</a>:</p><ol><li>Open your Cloud Shell</li><li>Create your Google cloud project :</li></ol><pre>gcloud projects create infra-manager-test </pre><p>3. Select the project that you created:</p><pre>gcloud config set project infra-manager-test</pre><p>4. Make sure that billing is enabled for your Google cloud project</p><p>5. Enable the infrastructure Manager API:</p><pre>gcloud services enable config.googleapis.com</pre><p>6. Create the service account and grant the roles of “config.agent” IAM role to that service account</p><pre>gcloud iam service-accounts create infra-manager-testing-sa<br>gcloud projects add-iam-policy-binding infra-manager-test --member=&quot;serviceAccount:infra-manager-testing-sa@infra-manager-test.iam.gserviceaccount.com&quot; --role=roles/config.agent</pre><p>7. To follow the quickstart in this example we need to gran permissions to the resources we are going to deploy, in this case VPC, so we need to grant the role of “compute.networkAdmin”</p><pre>gcloud projects add-iam-policy-binding infra-manager-test \<br>    --member=serviceAccount:infra-manager-testing-sa@infra-manager-test.iam.gserviceaccount.com \<br>    --role=roles/compute.networkAdmin</pre><p>8. Now we need to create the deployment, here you need to consider if your GCP organizations has a restriction location policy, if it does you need to change the location. The only locations infra manager is available at this moment of writing are:</p><ul><li>Taiwan:asia-east1</li><li>Belgiumeurope-west1</li><li>Iowaus-central1</li></ul><p>Check this link to have the updated list: <a href="https://cloud.google.com/infrastructure-manager/docs/locations">https://cloud.google.com/infrastructure-manager/docs/locations</a></p><p>Now we can create a deployment, in my case I will select “europe-west1”:</p><pre>gcloud alpha infra-manager deployments apply projects/infra-manager-test/locations/europe-west1/deployments/quickstart-deployment \<br>    --service-account=projects/infra-manager-test/serviceAccounts/infra-manager-testing-sa@infra-manager-test.iam.gserviceaccount.com \<br>    --git-source-repo=https://github.com/terraform-google-modules/terraform-google-network \<br>    --git-source-directory=modules/vpc \<br>    --git-source-ref=master \<br>    --input-values=project_id=infra-manager-test,network_name=quickstart-vpc</pre><p>Note: You can deploy Terraform configuration that is stored in a <a href="https://cloud.google.com/infrastructure-manager/docs/deploy-resources#git-repo">public Git repository</a>, or stored on your <a href="https://cloud.google.com/infrastructure-manager/docs/deploy-resources#local">local machine</a> or from Google Cloud <a href="https://cloud.google.com/infrastructure-manager/docs/deploy-resources#storage-bucket">Storage Bucket</a>.</p><p>9. Check your VPC Networks and if everything was done without a problem, you should have a VPC called “quickstart-vpc”</p><p>So in a nutshell what we have done here:</p><ol><li>Using the terraform module in github <a href="https://github.com/terraform-google-modules/terraform-google-network/tree/master/modules/vpc">https://github.com/terraform-google-modules/terraform-google-network/tree/master/modules/vpc</a> which contains the non-default variables :</li></ol><pre>variable &quot;project_id&quot; {<br>  description = &quot;The ID of the project where this VPC will be created&quot;<br>  type        = string<br>}<br><br>variable &quot;network_name&quot; {<br>  description = &quot;The name of the network being created&quot;<br>  type        = string<br>}</pre><p>These are filled in the command with the — input-values with :</p><pre>--input-values=project_id=infra-manager-test,network_name=quickstart-vpc</pre><p>and in the background is running Cloud Build that clones that repo, takes that module and then put the right input values on it to later execute the plan!</p><p>You can check the revisions deployed using this command (incrementing the number of the “r”</p><pre>gcloud alpha infra-manager resources list --revision=projects/infra-manager-test/locations/europe-west1/deployments/quickstart-deployment/revisions/r-0</pre><pre>NAME: compute-network-wt1geu4p<br>STATE: RECONCILED</pre><h3>Constraints</h3><p>To use Infrastructure Manager to deploy a Terraform configuration, the configuration has the following constraints.</p><ul><li>A valid <a href="https://developer.hashicorp.com/terraform/language/modules#the-root-module">Terraform root module</a> must be provided. Templating or generation of Terraform is not supported.</li><li>The configuration should be actuatable by Terraform version 1.2.3.</li><li><a href="https://developer.hashicorp.com/terraform/language/settings/backends/configuration">Backend blocks</a> should not be defined.</li><li><a href="https://developer.hashicorp.com/terraform/language/resources/provisioners/syntax">Provisioners</a> are not supported.</li></ul><p>Let me know if you have some use cases in mind in the comments below… Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57019ee5f508" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Cloud Build + Google App Engine: How to add environmental variables and use in Python]]></title>
            <link>https://medium.com/@pancho_riveros/google-cloud-build-google-app-engine-how-to-add-environmental-variables-and-use-in-python-14dba7b967c7?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/14dba7b967c7</guid>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[cloud-build]]></category>
            <category><![CDATA[app-engine]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Sun, 08 May 2022 17:43:41 GMT</pubDate>
            <atom:updated>2022-05-08T17:56:45.111Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g4r0XtJIgUOmb4eYTjgkDw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/s/photos/code?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Last time I had to work with Google Cloud Build and App Engine and I saw that there are several discussions around how to use environmental variables on Google App Engine.</p><p>Cloud Build enables you build software quickly across all programming languages, including Java, Go, Node.js, and more.</p><p>App Engine build monolithic server-side rendered websites and stay agile, supporting popular development languages and a range of developer tools.</p><ol><li><strong>Create a Trigger in Google Cloud Build</strong></li></ol><p>Here we will create a <a href="https://cloud.google.com/source-repositories/docs/integrating-with-cloud-build#creating_a_build_trigger">trigger </a>where we select the repository and all the options. Besides that in the advanced area we add the substitution variables which are needed later in your App Engine build or runtime.</p><p><strong>Remember</strong>: The substitution variables should start with the underscore symbol “_”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*9mRnyLrA2HBBVWUEFcOGKQ.png" /></figure><p>Once we have that we go to create the <em>cloudbuild.yaml</em> file in our app engine source code.</p><p><strong>2. Configure the <em>cloudbuild.yaml</em></strong></p><pre>steps:<br>- name: &#39;gcr.io/google.com/cloudsdktool/cloud-sdk&#39;<br>  entrypoint: &#39;bash&#39;<br>  args: [&#39;-c&#39;, &#39;gcloud config set project ${_PROJECT_ID} &amp;&amp; gcloud       config set app/cloud_build_timeout 1600 &amp;&amp; gcloud app deploy --project=${_PROJECT_ID}&#39;]<br>  env:<br>    - &#39;PROJECT_ID=$_PROJECT_ID&#39;<br>    - &#39;TEST_ENV=$_TEST_ENV&#39;<br>- name: &#39;gcr.io/google.com/cloudsdktool/cloud-sdk&#39;<br>entrypoint: &#39;bash&#39;<br>args: [&#39;-c&#39;, &#39;gcloud datastore indexes create index.yaml&#39;]<br>timeout: &#39;1600s&#39;</pre><p><strong>3. Finally you can use the environment variables in your python AppEngine code.</strong></p><pre>import os</pre><pre>PROJECT_ID= os.environ.get(&#39;PROJECT_ID&#39;, &#39;default-project-id-value&#39;)</pre><pre>TEST_ENV= os.environ.get(&#39;TEST_ENV&#39;, &#39;default-test-value-if-fails&#39;)</pre><p>Later you can use the variable PROJECT_ID with the value : MY_PROJECT_ID and the variable TEST_ENV with the value VALUE_TEST_ENV set in the Cloud Build Trigger.</p><p>Other option is to use Google Cloud Secret Manager where you can replace in your <em>app.yaml</em> in cloud build process and your secret variable will be safe:</p><p>Imagine if your app.yaml is like this:</p><pre>runtime: python39<br> entrypoint: gunicorn -b :$PORT main:app<br> runtime_config:<br> python_version: 3</pre><pre>env_variables:<br> SEC: %sec%</pre><p>Then we modify the <em>cloudbuild.yaml</em> file and pass the secret value to <em>app.yaml</em> as environment variable where we can replace using a “sed” command directly in the app.yaml like this :sed -i &quot;s/%sec%/$$SEC/g&quot; app.yaml. But as we can have special characters in the “sec” variable is a recommendable like below:</p><pre>steps:<br>     - name: &#39;gcr.io/google.com/cloudsdktool/cloud-sdk&#39;<br>       entrypoint: &#39;bash&#39;<br>       args: <br>         - &#39;-c&#39;<br>         - |<br>            cat app.yaml | awk &quot;{ if (NR == $(grep -n &#39;%sec%&#39; app.yaml | cut -d : -f 1)) print \&quot;    SEC: $$SEC\&quot;; else print }&quot; &gt; app.yaml<br>            gcloud config set app/cloud_build_timeout 1600 <br>            gcloud app deploy<br>       secretEnv: [&quot;SEC&quot;]<br>     availableSecrets:<br>       secretManager:<br>       - versionName: projects/$PROJECT_ID/secrets/db_secret/versions/3<br>         env: &#39;SEC&#39;<br>     <br>     timeout: &#39;1600s&#39;</pre><p>I hope this is helpful in your current or future deployments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14dba7b967c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Cloud Alerting to Webex Teams using GCP Pub/Sub and Cloud Functions]]></title>
            <link>https://medium.com/@pancho_riveros/google-cloud-alerting-to-webex-teams-using-gcp-pub-sub-and-cloud-functions-fbd09d1f3072?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbd09d1f3072</guid>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[pub-sub]]></category>
            <category><![CDATA[cloud-functions]]></category>
            <category><![CDATA[webex]]></category>
            <category><![CDATA[alerting]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Wed, 23 Feb 2022 19:36:13 GMT</pubDate>
            <atom:updated>2022-02-23T19:48:54.470Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8IeDo9psul9T5-v1O7w9Lg.jpeg" /><figcaption>Warning France — Francisco Riveros</figcaption></figure><p>One of the most common tasks when you are running a Cloud Application is the how to react quickly in case of problems. Alerting is giving us the chance to react and resolve the problems fast.</p><p>In Google Cloud you can check that in Cloud Monitoring, creating an alerting policy that describes the circumstances under which you want to be alerted and how you want to be notified. In this example I am going to show how from an Alerting policy use the notification channel using Google Pub/Sub to send the message to a Google Cloud Function to later trigger a Webex Channel Webhook to send the message in the Webex Tool. You can also send messages or real-time notifications to other services like SendGrid Email API, Slack, but for this example I am going to show the Webex Teams.</p><p>To send messages or notification to Webex Teams we need to create a Webex Bot.</p><p>1. Sign in to your WebEx Teams account and navigate to the <a href="https://developer.webex.com/my-apps/new/bot">New Bot</a> page (https://developer.webex.com/my-apps/new/bot).</p><p>2. Set Bot Name to “<em>GCP-Monitoring-Alerts”</em>.</p><p>3. Select a descriptive but unique Bot Username (GCP-Monitoring-Alerts).</p><p>4. Under Icon, select <strong>Default 1</strong>.</p><p>5. Set Description to “A bot that notifies the team when an alert is triggered from GCP Project Policies”</p><p>6. Click Add Bot.</p><p>7. On the confirmation page, copy the <strong>Bot Access Token</strong> and save it for use in the Cloud Function.</p><p><strong>Now we have to add the Webex Bot to Workspace:</strong></p><p>1. In the WebEx Space where you want the Bot to post notifications, expand the activity panel. WebEx panel</p><p>2. Select <strong>Add People</strong>.</p><p>3. Type “GCP-Monitoring-Alerts” in the text field and select the bot you created from the drop-down menu.</p><p>4. Select the Add button, and then close the panel.</p><p>5. Obtain the <strong>Room ID</strong> of the workspace for the Cloud Function. On a desktop computer, go to <a href="https://developer.webex.com/docs/api/v1/rooms/list-rooms">https://developer.webex.com/docs/api/v1/rooms/list-rooms</a> and log in, if necessary. This page uses the WebEx API to list rooms to which you belong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QE1_fSMThpuIv4wc.png" /></figure><p>6. Navigate to the search panel.</p><p>7. Select the tab labeled <strong>Try it</strong> at the top of the panel.</p><p>8. Leave all options with their default values and click <strong>Run</strong>.</p><p>9. In the <strong>Response </strong>tab, you receive a JSON-formatted response with a list of <strong>items</strong>, or <strong>rooms</strong>. Find the title of the room in which you want notifications to appear and record the associated id value.</p><p>Next, you deploy a Cloud Function to send notifications to your WebEx workspace.</p><blockquote><strong>*Remember to use the Secrets Manager to store your WEBEX_TOKEN and ROOM_ID</strong></blockquote><p><em>NOTE: Secret Manager only works on version 338.0.0 or higher of the Cloud SDK</em></p><p>First we enable the API:</p><pre>gcloud services enable secretmanager.googleapis.com</pre><p>then we can create the secrets:</p><pre>gcloud secrets create &quot;WEBEX_TOKEN&quot; \<br>--replication-policy &quot;user-managed&quot; \<br>--locations=europe-central2,europe-north1,europe-west1,europe-west2,europe-west3,europe-west4,europe-west6 \<br>--data-file - &lt;&lt;&lt; &quot;CHANGE_TO_THE_WEBEX_TOKEN&quot;</pre><p>now the room id:</p><pre>gcloud secrets create &quot;ROOM_ID&quot; \<br>--replication-policy &quot;user-managed&quot; \<br>--locations=europe-central2,europe-north1,europe-west1,europe-west2,europe-west3,europe-west4,europe-west6 \<br>--data-file - &lt;&lt;&lt; &quot;CHANGE_ROOM_ID&quot;</pre><p>Now we have to give access to the runtime service account from the project to have access of <em>“roles/secretmanager.secretAccessor”</em>, for example:</p><pre>gcloud projects add-iam-policy-binding $PROJECT_ID --member=&#39;serviceAccount:$PROJECT_ID@appspot.gserviceaccount.com&#39; --role=&#39;roles/secretmanager.secretAccessor&#39;</pre><p>So now we have the Webex Team configuration done, but we need to deploy the Google Pub Sub to send the Notifications to the topic where a Cloud function will be triggered from that.</p><ol><li>Enable the Pub/Sub API (https://console.cloud.google.com/marketplace/details/google/pubsub.googleapis.com)</li><li>Create the pubsub topic “notification-to-webex-topic”</li><li>Create a file which is going to configure the creation of the pubsub channel:</li></ol><pre>{<br>&quot;type&quot;: &quot;pubsub&quot;,<br>&quot;displayName&quot;: &quot;Alert notifications&quot;,<br>&quot;description&quot;: &quot;Pub/Sub channel for alert notifications&quot;,<br>&quot;labels&quot;: {<br>      &quot;topic&quot;: &quot;projects/PROJECT_ID/topics/notification-to-webex-topic&quot;</pre><pre>       },<br>}</pre><p>Create a file called<em> pubsub-channel-TEMPLATE.json</em> and copy the above content. If you would like to modify the project ID automatically for your CI/CD pipelines using a script command you can do the following:</p><p>Consider that you have the project id already in a variable called PROJECT_ID ( <em>export PROJECT_ID=$(gcloud info — format=’value(config.project)’</em> )after that you can use the following command to replace the content of the file:</p><pre>cat pubsub-channel-TEMPLATE.json | sed  &#39;/PROJECT_ID/ s/PROJECT_ID/&#39;$PROJECT_ID&#39;/&#39; &gt; pubsub-channel.json</pre><p>Now we can create the monitoring channel using the content of the file, using this command:</p><pre>gcloud beta monitoring channels create --channel-content-from-file=&quot;pubsub-channel.json&quot;</pre><p>Important now is to authorize the notification service account to publish to each Pub/Sub topic that you are using as a notification channel, so you can run the following command:</p><pre>gcloud pubsub topics add-iam-policy-binding projects/$PROJECT_NUMBER/topics/notification-to-webex-topic --role=roles/pubsub.publisher --member=serviceAccount:service-$PROJECT_NUMBER@gcp-sa-monitoring-notification.iam.gserviceaccount.com</pre><p>We are almost there, now we need to create a cloud function triggered by the recent Pub/Sub.</p><ol><li>Go to Cloud Functions (<a href="https://console.cloud.google.com/functions/list?_ga=2.264256719.1910880984.1645437009-1198410646.1633428723">https://console.cloud.google.com/functions/</a>)</li><li>Select the same <strong>PROJECT_ID </strong>where the Pub/Sub topic was created</li><li>Create Function and set the function name to <em>“notification-to-webex”</em> for example and <strong>Trigger type</strong> to Pub/Sub.</li><li>Select the <strong>Pub/Sub topic</strong> that you created in Setting up a Pub/Sub topic.</li><li>Before the next step we need to expand the section of Runtime, build, connections and security settings and configure the secrets created before.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*3ydWwr6pE7CEtKlsZiOT0w.png" /></figure><p>6. Now you can press next and in the next page set <strong>Runtime </strong>to <strong>Python 3.9</strong>. The code sample is written in Python.</p><p>7. Navigate to the file list. Click <strong>requirements.txt</strong> and add the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*nUokbbWvbgk2VWuxmZsTIg.png" /></figure><p>8. Click on <strong>main.py</strong> and replace the contents with the following code snippet (please correct the indentation :) ): <a href="https://gist.github.com/foward/26dc794230116e79872db14476ef3d84">https://gist.github.com/foward/26dc794230116e79872db14476ef3d84</a></p><p>9. Navigate to the<strong> Entry point</strong> field and enter the name of the function in the code snippet (send_webex_teams_notification )</p><p>10. Click <strong>deploy </strong>and now you are returned to the list of Cloud functions where you can see if everything works fine a green check next to the function name. The process can take a few minutes.</p><p>After this long run we can test the system and check whether we are getting messages. To verify that we can go to the Google Cloud Pub/Sub Topic list and we can publish a message with the JSON format (in the moment of writing this post is JSON version 1.2 .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*YnFJye2FXJ-tsHp2rt7rqQ.png" /></figure><p>you can find the whole example (under Pub/Sub)in the following link <a href="https://cloud.google.com/monitoring/support/notification-options#pubsub">https://cloud.google.com/monitoring/support/notification-options#pubsub</a></p><p>Copy the content to the Publish Message interface of Pub/Sub :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yBflJLogqOFEw7jj44XtHA.png" /></figure><p>and voila!… your notification alert is going to be shown in Webex Channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JBziUNek4DIL_ifwU736Bg.png" /></figure><p>That was fun! isn’t? you can use the same architecture to create budget alerts just creating a new pub/sub topic from the Billing and Budget alerts and you are going to be always updated. I hope you have learned and enjoyed this long blog post the same as me. See you in the next blog post…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbd09d1f3072" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create an Answer Store to use in a Multilingual Chatbot]]></title>
            <link>https://medium.com/@pancho_riveros/create-an-answer-store-to-use-in-a-multilingual-chatbot-762728867f80?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/762728867f80</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[chatbot-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[multilingual]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Wed, 23 Feb 2022 17:47:26 GMT</pubDate>
            <atom:updated>2022-02-23T17:47:26.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L_uLqViqamebPDrUjZt3VQ.png" /><figcaption>World in light — Francisco Riveros</figcaption></figure><p>Long time ago I was working at IBM as an AI Solution Architect and in some projects I had to implement and design Chatbot Projects. In most of them they required to use another interface where the customer wanted to manage different responses and different languages depending on different contexts. For that reason I have created this post to show how to implement a simple Answer Store where you can use in your chatbot projects and with Watson Assistant.</p><p>This example project you can <a href="https://github.com/foward/answer-store-watson">deploy it from Github</a>. This test answer store is a <strong>node.js</strong> application connected to a Cloudant NoSQL Database to store the content of answers.</p><p>Before of that we need to understand the flow on how the message is flowing and the steps.</p><figure><img alt="Multilingual Pattern — IBM Watson Medium" src="https://cdn-images-1.medium.com/max/978/1*O2hjAWt8-GgSmqL-ZwEySA.png" /><figcaption>Multilingual Pattern — IBM Watson</figcaption></figure><ol><li>The user is going to ask something using the UI of Watson Assistant in a different language, like Spanish, saying <em>“Hola que tal?”</em>.</li><li>As our Watson Assistant Dialog is trained in English, we need to identify and translate the input from the user using our Pre-message webhook, as we saw in the Strategy 1.</li><li>With the Input from the user translated to English, in this case <em>“Hello how about?”</em> , Watson Assistant will identify the right intent of the utterance, and will trigger the right Dialog Node, in this case, in our example we have a node called “<strong>Greet</strong>”, trained with greet intents.</li><li>Then Watson Assistant will return an output, which we have intentionally written “<strong>WELCOME</strong>”. This will be our <em>AnswerID </em>or Key to search the right answer unit in our Answer Store Database.</li><li>Now we need to run our Answer Store UI to create an answer unit with the AnswerID equals to “<strong>WELCOME</strong>” in Spanish. Please remember that as we have identified the language, this is coming in a language code from Watson Language Translator, so in order to maintain the same we create with the language code <strong>“es”</strong> (you can take a look on other language codes here: <a href="https://cloud.ibm.com/apidocs/language-translator#identify">https://cloud.ibm.com/apidocs/language-translator#identify</a>) . 5.1) Other option without deploy the Test Answer Store is to create manually the answer unit docs in the Cloudant DB Dashboard. Just check the format of the Answer Unit and modify and add new documents in Cloudant.</li><li>Great!, now we have our first answer store with the text <strong>“Bienvenido desde el Answer Store!”</strong> to return to the user in Spanish.</li><li>Now we can add more responses for the same <em>answerID </em>“<strong>WELCOME</strong>” in another language. Remember that the answerID must be unique and the same as is in our Answer Store DB. Lets add a greet in German (de) and English (en).Now that we have all set, we need to create the post-message webhook to call the database to query the answerID plus the language code.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*-jFmAYKcNv0_Noq3yzx4cA.png" /></figure><p>8. Lets jump to IBM Cloud functions (<a href="https://cloud.ibm.com/functions/">https://cloud.ibm.com/functions/</a>). If you don’t have experience with this don’t worry is going to be easy and fun. Create an Action (<a href="https://cloud.ibm.com/functions/create/action">https://cloud.ibm.com/functions/create/action</a>) where the action name we can name it as : “post-webhook” and we can leave the Default package with the runtime with Node.js 12 as the following picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*seqOFgDSZfVSCzuAdh0d9Q.png" /></figure><p>9. Now we need to implement the function to call the Cloudant Database that you have created before to use the Test Answer Store UI. For this we need the Cloudant URL. This you can find it under the Service Credentials section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4VHoo2q1Egl4WHAm84nTg.png" /></figure><p>10. Lets back to the IBM Cloud Function screen, and paste the following code <a href="https://raw.githubusercontent.com/foward/answer-store-watson/master/cloud_functions/post-message/post-output-message.js">https://raw.githubusercontent.com/foward/answer-store-watson/master/cloud_functions/post-message/post-output-message.js</a> (Please remember that you should change the Cloudant URL and Watson Language Translator URL) it should looks like this: You can run it using the expected parameter coming from Watson Assistant, this is one example:</p><pre>{<br>        &quot;payload&quot; : { &quot;output&quot; : <br>            {  <br>                &quot;generic&quot; : <br>                [<br>                        {<br>                          &quot;response_type&quot;: &quot;text&quot;,<br>                          &quot;text&quot;: &quot;WELCOME&quot;<br>                        }<br>                 ]<br>              }<br>          }<br>        }</pre><p>11. Now we need to enable the Cloud function as Web Action in order to be called by Watson Assistant. Lets go to the section Endpoints and mark the checkbox “Enable as Web Action” and click the Save button. Copy the HTTP method URL with Auth Public, e.g <a href="https://eu-de.functions.appdomain.cloud/api/v1/web/youraccount_resource-group/default/post-webhook">https://eu-de.functions.appdomain.cloud/api/v1/web/youraccount_resource-group/default/post-webhook</a> . It should looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*viEkLbSLsPVrnkXvgtDzGg.png" /></figure><p>12. We are almost there!. Lets go back to the Watson Assistant to configure our post-message webhook. To enable and configure, in the assistants page, select the Assistant that you want to configure the webhook and click on “Settings”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hn-YRMEEqa5dHB-iS01COg.png" /></figure><p>Then we can click on the left side menu the “Webhooks” section and select the Post-message webhook link. There we enable the webhook and we copy the Cloud function URL from the point 12. The options Secret you can write whatever you want, as is required, but in our basic implementation, the cloud function implemented doesn’t need an authentication secret, but it should.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-BFPz609ODmB_Xx-wrDpxQ.png" /></figure><p>13. Finger cross, now we have everything in place to run our solution! … Open a preview on watson assistant and write in spanish <em>“hola que tal?”</em>… <strong>Tada! </strong>we have our dialog identifying the language, translating the input of the user from Spanish to English, then Watson Assistant sending the output to the user, then we intercepted with our post message webhook which calls the cloudant DB to retrieve the answer Unit containing the text in Spanish, which is in this case: <strong>“Bienvenido desde el Answer Store!”</strong>. You can also ask in german “Hallo wie geths?” which means the same and as we added an answer unit in German is responding with the text from the answer store: “Herzlich Willkommen!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*ubxVr9rIWwyjCM_m5xdeaw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=762728867f80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First Story]]></title>
            <link>https://medium.com/@pancho_riveros/first-story-ea5093566aa9?source=rss-d599d1128e8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea5093566aa9</guid>
            <category><![CDATA[test]]></category>
            <dc:creator><![CDATA[Francisco Riveros]]></dc:creator>
            <pubDate>Sun, 07 Oct 2018 18:26:03 GMT</pubDate>
            <atom:updated>2018-10-07T18:36:32.389Z</atom:updated>
            <content:encoded><![CDATA[<p>Lunching the new 4minds.cl based on medium.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q97YnpLDwy1I3cK9VZylCA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea5093566aa9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>