<?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 Siraj Mohammad on Medium]]></title>
        <description><![CDATA[Stories by Siraj Mohammad on Medium]]></description>
        <link>https://medium.com/@sirajmohammad?source=rss-a5c8534a15a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MvtgvwEK3sIepveljkPHtQ.jpeg</url>
            <title>Stories by Siraj Mohammad on Medium</title>
            <link>https://medium.com/@sirajmohammad?source=rss-a5c8534a15a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 20:03:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sirajmohammad/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[The Agentic Harness: Why the Model Isn’t the Agent]]></title>
            <link>https://medium.com/@sirajmohammad/the-agentic-harness-why-the-model-isnt-the-agent-7fe1265776a1?source=rss-a5c8534a15a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fe1265776a1</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gemini-enterprise]]></category>
            <category><![CDATA[google-gemini]]></category>
            <category><![CDATA[gemini-enterprise-agent]]></category>
            <dc:creator><![CDATA[Siraj Mohammad]]></dc:creator>
            <pubDate>Fri, 22 May 2026 18:27:55 GMT</pubDate>
            <atom:updated>2026-05-22T19:56:43.184Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve shipped a Large Language Model (LLM) applicaiton into production, you’ve already discovered the gap that nobody warned you about.</p><p>The model demos beautifully. Then you wrap it in a tool-calling loop, give it real users, and watch it lose its train of thought three turns ago, retry a failed API call seventeen times, leak an environment secret into a log line, and confidently invoke a tool that doesn’t even exist.</p><p>The model isn’t the problem. The <strong>harness</strong> is.</p><p>The single biggest source of confusion I run into is the assumption that a more powerful model inherently means a more capable agent. It doesn’t. A frontier model with a weak harness is just a demo. A mid-tier model with a strong harness is a resilient product.</p><p>Building a great agent means shifting your focus away from the prompt and onto the scaffolding around it.</p><h3>What an Agentic Harness Actually Is</h3><blockquote><strong>Agent = Model + Harness<br></strong>Everything in your system that isn’t the raw weights of the model — the system prompts, tool schemas, state orchestration, retry loops, permission checks, OpenTelemetry tracing, and context compaction — comprises the harness.</blockquote><p>A horse is powerful, but a horse without a harness is a liability. The harness makes the horse’s strength directable, safe, and useful. Concretely, a production agent harness must solve five engineering problems the model cannot solve for itself:</p><ol><li><strong>Constrain the action space:</strong> The harness defines which tools exist, handles validation schemas, and catches when the model hallucinates a non-existent endpoint.</li><li><strong>Manage state across turns:</strong> A massive token context window is not memory. The harness decides what stays in immediate context, what gets compressed, and what gets pushed to long-term retrieval.</li><li><strong>Enforce permissions pre-action:</strong> Deciding whether an agent can refund a customer is an infrastructure IAM question, not an LLM routing question.</li><li><strong>Handle failure gracefully:</strong> APIs timeout. A real harness catches 500 errors and retries intelligently without entering infinite loops.</li><li><strong>Optimize cost and latency:</strong> Every redundant turn and uncompacted historical log shows up directly on your cloud bill.</li></ol><p><strong>The Agentic Architectural Blueprint:</strong></p><p>Following the latest ecosystem updates at Google I/O 2026, the build-vs-buy calculus for agent infrastructure has completely shifted. You now have three distinct paths for the harness layer, depending on your need for infrastructure control versus speed-to-market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2LDSyYh3Q_afvM4QfqlGw.png" /></figure><h3>1. Custom Orchestration: ADK + Agent Engine</h3><p>When your architecture demands custom multi-agent topologies or deep enterprise integrations, stitching together the <strong>Agent Development Kit (ADK)</strong> and deploying to the <strong>Gemini Enterprise Agent Platform (Agent Engine)</strong> gives you maximum control.</p><ul><li><strong>Granular Memory Layers:</strong> <strong>Sessions</strong> manage the immediate conversational state, while the <strong>Memory Bank</strong> API handles long-term, persistent user facts and preferences.</li><li><strong>Advanced Governance:</strong> Run your agent with a native <strong>IAM Agent Identity</strong>, easily restricting it to read-only access on specific BigQuery datasets without inventing your own auth model.</li><li><strong>Deep Observability:</strong> Deployed to the Agent Engine, your harness automatically exports full OpenTelemetry span trees to Cloud Trace and uses the built-in <strong>Evaluation Service</strong> to monitor behavior at scale.</li></ul><p><a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/runtime/deploy-an-agent">Deploy an agent | Gemini Enterprise Agent Platform | Google Cloud Documentation</a></p><h3>2. Managed Agents API (Harness-as-a-Service)</h3><p>Introduced as the fastest path to production, the <strong>Managed Agents API</strong> collapses weeks of infrastructure setup into a single API call. It moves the agent runtime directly into Google’s platform.</p><ul><li><strong>Ephemeral Linux Sandboxes:</strong> Each interaction provisions a secure, remote Linux environment powered by <strong>Gemini 3.5 Flash</strong> and the new <strong>Antigravity agent</strong>. The agent can natively reason, use tools, write code, and execute scripts in isolation.</li><li><strong>Persistent State:</strong> Instead of manually maintaining session states, your environment and multi-turn states persist seamlessly between follow-up calls.</li><li><strong>Markdown Customization:</strong> You can define and extend agent behaviors using file-system-native configurations (AGENTS.md and SKILL.md) right inside your workspace.</li></ul><p><a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/build/managed-agents">Managed Agents API on Agent Platform overview | Gemini Enterprise Agent Platform | Google Cloud Documentation</a></p><h3>3. The Antigravity SDK (Google’s Internal Harness, Your Infrastructure)</h3><p>For teams that need to host the execution model themselves due to compliance, data residency, or VPC constraints, the <strong>Antigravity SDK</strong> provides a Python library with programmatic access to the identical runtime powering Google’s own ecosystem.</p><ul><li><strong>Rich Lifecycle Hooks:</strong> The SDK provides concrete, programmable hook points — classified into <em>Inspect</em> (observation), <em>Decide</em> (blocking policies), and <em>Transform</em> (modifying data for error recovery) — allowing you to steer every single tool call.</li><li><strong>Built-in Tooling:</strong> Every agent starts with a complete built-in toolset ready at initialization (file I/O, code editing, shell execution, sub-agent delegation).</li><li><strong>Governed Extensibility:</strong> Apply declarative safety policies to lock down tools (e.g., denying shell access by default or requiring a human-in-the-loop).</li></ul><p><a href="https://antigravity.google/blog/introducing-google-antigravity-sdk">https://antigravity.google/blog/introducing-google-antigravity-sdk</a></p><h3>Where Engineering Teams Go Wrong</h3><p>If you are building an agent strategy today, watch out for these anti-patterns:</p><ul><li><strong>Prompt Stuffing:</strong> Shoving 8,000 tokens of strict behavioral constraints into a system prompt is a context engineering problem, not a prompting problem. Move stable instructions to a dedicated static context layer or a versioned SKILL.md file.</li><li><strong>The “God Agent”:</strong> An agent with 47 tools and a massive system prompt will inevitably lose its planning capabilities. Decompose it into sharp, single-purpose sub-agents.</li><li><strong>No Retry Strategy:</strong> “It usually works” is not a production posture. Use tool error recovery hooks to intelligently self-heal API failures.</li></ul><h3>The Takeaway</h3><p>The next wave of impactful enterprise AI systems won’t be defined by who uses the largest model. It will be won by whoever builds the most reliable harness around whichever model they pick.</p><p>Models are rapidly converging on reasoning capabilities, but harnesses are where actual product reliability is built. Whether you choose the hands-off simplicity of <strong>Managed Agents</strong>, build locally with the <strong>Antigravity SDK</strong>, or orchestrate custom graphs on the <strong>Gemini Enterprise Agent Platform</strong>, stop focusing solely on the engine. Focus on the car.</p><p><strong>The agent is not the model. The agent is the harness.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fe1265776a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step by Step : Setup Google quality Generative AI website search using Vertex AI Agent Builder in…]]></title>
            <link>https://medium.com/@sirajmohammad/step-by-step-setup-google-quality-generative-ai-website-search-using-vertex-ai-agent-builder-in-a1b9b1fc593f?source=rss-a5c8534a15a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1b9b1fc593f</guid>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[vertex-ai]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Siraj Mohammad]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 19:17:09 GMT</pubDate>
            <atom:updated>2024-12-01T19:17:09.184Z</atom:updated>
            <content:encoded><![CDATA[<h3>Step by Step : Setup Google quality Generative AI website search using Vertex AI Agent Builder in just a few minutes!</h3><p>Boost your website’s performance with Google-quality search and generative answers that drive increased engagement, conversions, and customer satisfaction. Site search is an offering from Vertex AI Search for your customer facing websites.</p><p><strong>Step 1: Create </strong><a href="https://cloud.google.com/use-cases/site-search?hl=en"><strong>Vertex AI Agent Builder website search App</strong></a></p><p>Log in to Google Cloud console and search for “Agent Builder” . Click on CREATE APP. Now under Search and Assistant category select “Search for your website” and hit create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ZA8ainKOR7ENUqA7hd2FQ.png" /></figure><p><strong>Step2: Create Website search app</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKGRhgBAtyAZQeSrSxAM6w.png" /></figure><p><strong>Step 3: Create data source for indexing</strong></p><p>Select website content, this will automatically crawl public website content from a list of URL patterns you define.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_jWie9sOGUkoniZz2AvIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WCDcFf0NH8Ig41LFQgKbkQ.png" /></figure><p><em>Note: Make sure Advanced website indexing is selected for Generative Summarization and follow-ups</em></p><p>Specify public website URL to be indexed. Specify your data store name and hit create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbiiI5MBzzqu4DrK9amzBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rh1Meux_DNiyz601igr4rA.png" /></figure><p>Once data store is created, go to the Data store page.</p><p>If you see the following screen with the message “ <strong>You need to verify the ownership of the domain</strong>” you need click on <strong>Verify</strong> and go to Google Search console and verify the domain by following the steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJrdIVkOnuecYPjSjbEumA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*4AP7Trozz4ygXdl6tvKMZQ.png" /></figure><p><strong><em>Note : Once the domain is verified the indexing may take from 2–4 hours or more depending on the content of the website.</em></strong></p><p>Once indexing is finished, data store will look like the following :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4nGpPgAmPeBKAuT7fA4EWg.png" /></figure><p>Your website search is now ready to go!!</p><p><strong>Step 4: Preview search results</strong></p><p>You can navigate to the preview and enter a search query to get the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWFhpkVg9fVTRCMf12cyhg.png" /></figure><p><em>Note: You can see the generative summary that is produced by Google’s Large language model (LLM)</em></p><p><strong>Step 5: Let’s verify Generative AI configuration for search app.</strong></p><p>Go to search app Configuration page and go to UI. Under UI page you can find the setting to configure the LLM for summarization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PwA8HE_Osnsw4qOfdrgjLg.png" /></figure><p><strong>Step 6: Setup Firebase hosting to deploy simple website to show search integration.</strong></p><p>I am going to create a website on firebase, which is super easy to setup. However, search widget can be integrated to any web based platform.</p><p>Login to Firebase console and create a Hosting Site</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TqLwT2PZZbuAWz2T_CVnUw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ih936x6Fm1h7PeSJ1REpw.png" /></figure><p>Once the site is created, follow the deployment instructions. I am going to use my Google Cloud Console to deploy my website to Firebase hosting.</p><p>Commands to install firebase tools and deploy the site to Firebase Hosting from Google Cloud Console:</p><pre>npm install -g firebase-tools<br><br>firebase login<br><br>firebase login</pre><p>Log in to Google Cloud Conole, create a directory and run the above commands</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-EDdJ-ycRJdexh-AwYzvUg.png" /></figure><p>Choose “Hosting : Configure files for Firebase Hosting and (optionally) and setup GitHub Action deploys”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_u0oy-zK8r452h0945qr9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0128lF6WcEs9pwlRqGJPKA.png" /></figure><p>This process will create few folders/files under your directory.</p><p>Open “firebase.json” file and modify with the following code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*ldv2NHWN1u_6ZNTUpgso9A.png" /></figure><p>It is time to deploy our site to Firebase by running Firebase Deploy command!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFgOd9H6SI-0lu1_rHGXww.png" /></figure><p>If you visit the URL at this point you should see the Firebase default HTML page. In later section we will update this page to show the search results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_TmmLJbT-gebMDcRt8RKaQ.png" /></figure><p><strong>Step 7: Integrate Vertex AI website search to the website.</strong></p><p>Navigate to Agent Builder on Google Cloud Console and go the search app that was created in the previous steps. Go to Integration screen and add our hosting domain here. This is a required step for search results to be displayed on our public website.</p><p>Next copy the code snippet. We will insert this code snippet on our website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBSfRy0IPlJoM3TrGgGGxA.png" /></figure><p>Go back to Google Cloud console and open Cloud Shell and Click Open Editor to edit the website and insert the code snippet.</p><p>Now paste the code snippet you copied from your search app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*np-YSdJhaMvSZYjtFKbYfw.png" /></figure><p>Great, now let’s deploy this updated site to Firebase hosting by running the firebase hosting command from Google Cloud Shell</p><pre>firebase deploy --only hosting:travel2europe</pre><p>Browse the URL again andthis time you will see the search box !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xAfxE7Vldm5IHxn1TKuUGQ.png" /></figure><p>Type your query to get the search results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vlJqeC3KxK8oyxuf8WaGw.png" /></figure><p><strong>Resources</strong>:</p><ul><li><a href="https://travel2europe.web.app/">Demo URL</a></li><li><a href="https://cloud.google.com/products/agent-builder?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=na-US-all-en-dr-bkws-all-all-trial-e-dr-1707554&amp;utm_content=text-ad-none-any-DEV_c-CRE_706196044739-ADGP_Hybrid+%7C+BKWS+-+MIX+%7C+Txt-AI+and+Machine+Learning-Agent+Builder-KWID_43700080502290554-kwd-2327285297755&amp;utm_term=KW_google+vertex+ai+agent+builder-ST_google+vertex+ai+agent+builder&amp;gad_source=1&amp;gclid=Cj0KCQiAr7C6BhDRARIsAOUKifjQOMU0WTE9SwyLgp1eq3vo8X5jEZCRQpALSWpqSDSBNGiWZ7tuZkoaAj4KEALw_wcB&amp;gclsrc=aw.ds&amp;hl=en">Vertex AI Agent Builder</a></li><li><a href="https://cloud.google.com/generative-ai-app-builder/docs/website-search-checklist?indexing=advanced">Website search checklist</a></li><li><a href="https://firebase.google.com/docs/hosting">Firebase Hosting</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1b9b1fc593f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Q&A with CSV file using Gemini on Vertex AI]]></title>
            <link>https://medium.com/@sirajmohammad/q-a-with-csv-file-using-gemini-on-vertex-ai-6baefae5f705?source=rss-a5c8534a15a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6baefae5f705</guid>
            <dc:creator><![CDATA[Siraj Mohammad]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 18:51:29 GMT</pubDate>
            <atom:updated>2024-11-18T18:51:29.906Z</atom:updated>
            <content:encoded><![CDATA[<p>While Gemini API on Vertex AI currently supports various data types like text, PDFs, images, audio, and video, I recently encountered a use case requiring direct question answering on a CSV file.</p><p>Thanks to <a href="https://api.python.langchain.com/en/latest/agents/langchain_experimental.agents.agent_toolkits.pandas.base.create_pandas_dataframe_agent.html">Create_Pandas_Dataframe_agent</a> for making this task super simple and effective!</p><p><strong>Step 1: </strong>Instantiate Gemini Model on Vertex AI</p><pre>%pip install --upgrade --quiet google-cloud-aiplatform langchain langchain-core langchain_experimental langchain-google-vertexai langchain-community pandas<br>from langchain_google_vertexai import VertexAI<br>model = VertexAI(model_name=&quot;gemini-1.5-flash-002&quot;)</pre><p><strong>Step 2:</strong> Upload CSV file</p><pre>from google.colab import files<br><br>def load_csv_file():<br> &quot;&quot;&quot;Loads a CSV file into a Pandas dataframe.&quot;&quot;&quot;<br><br> uploaded_file = files.upload()<br> file_path = next(iter(uploaded_file))<br> document = pd.read_csv(file_path)<br> return document<br><br>if __name__ == &quot;__main__&quot;:<br> document = load_csv_file()<br> print(document)</pre><p><strong>Note: </strong>Sample CSV files <a href="https://drive.google.com/uc?id=1zO8ekHWx9U7mrbx_0Hoxxu6od7uxJqWw&amp;export=download">Customers-100.csv</a></p><p><strong>Step 3: </strong>Create Pandas Data frame Agent</p><pre>from langchain_experimental.agents import create_pandas_dataframe_agent<br>agent=create_pandas_dataframe_agent(model,document,allow_dangerous_code=True)<br>query=&quot;What company Sheryl Baxter works?&quot;<br>result=agent.invoke({&quot;input&quot;: {&quot;query&quot;:query}})<br>output=result.get(&quot;output&quot;)<br>output</pre><p>Code Notebook: <a href="https://github.com/sirajmogcp/Gem-AI-samples/blob/main/Gemini-sample-csv.ipynb">Gemini-sample-csv.ipynb</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6baefae5f705" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serving next generation images using Google Cloud CDN, Cloud Run and image proxy]]></title>
            <link>https://medium.com/@sirajmohammad/serving-next-generation-images-using-google-cloud-cdn-cloud-run-and-image-proxy-4d2e65d87fbc?source=rss-a5c8534a15a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d2e65d87fbc</guid>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Siraj Mohammad]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 17:13:50 GMT</pubDate>
            <atom:updated>2023-02-04T18:08:59.231Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog post, we will setup required infrastructure and services on Google Cloud platform to serve next generation images using Cloud CDN and <a href="https://imgproxy.net/">imgproxy</a>.</p><p>imgproxy enables two essential image processing use cases that aim to improve the overall performance of your website or application. <br>1. Serving images in next-gen formats, such as WEBP and AVIF, to reduce latency and footprint (between 20% to 30%) without converting existing images. <br>2. Enabling dynamic, on-the-fly transformations, including image resizing and adding watermarks.</p><p>To achieve this, let’s walk you through the steps of setting up the necessary infrastructure and services on Google Cloud Platform. By the end of this post, you’ll have a better understanding of how to setup, <a href="https://cloud.google.com/cdn/docs/overview">Google Cloud CDN</a>, <a href="https://cloud.google.com/run/docs/overview/what-is-cloud-run">Cloud Run</a>, <a href="https://cloud.google.com/storage/docs/introduction">Cloud Storage</a>, <a href="https://cloud.google.com/artifact-registry/docs/overview">Artifact Registry</a> and deploy <a href="https://imgproxy.net/">imgproxy</a> to serve images for your websites or applications</p><p><em>Note: imgproxy takes advantage of probably the most efficient open source image processing library out there — </em><a href="https://www.libvips.org/"><em>libvips</em></a><em>. It’s scary fast and comes with a very low memory footprint.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMtmjAyRHOPtdpPclqBHwQ.png" /><figcaption>Architecture diagram of the services deployed on Google Cloud</figcaption></figure><p>We will follow the steps to setup services on Google Cloud:</p><ol><li>Create Artifact Registry and push imgproxy container image.</li><li>Create Cloud Run Service to host and run imgproxy container.</li><li>Create Google Cloud Storage bucket to store and serve images files.</li><li>Grant Cloud Run service account storage object viewer role on storage bucket.</li><li>Setup Cloud CDN to deliver images with external HTTP(S) Load Balancing and Serverless backend Cloud Run.</li><li>Update DNS settings of your domain to point to your Load Balancer IP address.</li><li>Validate setup and browse next-gen images!</li><li>Additional helpful resources</li></ol><h3>1. Create Artifact Registry and push imgproxy container image to artifact registry</h3><p>Navigate to Google Cloud Console <a href="https://console.cloud.google.com/">https://console.cloud.google.com</a> , search Artifact Registry, and create Docker repository to host container images.</p><blockquote><a href="https://cloud.google.com/artifact-registry">Artifact Registry</a> is a single place for your organization to manage container images and language packages (such as Maven and npm, etc.)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjFW5rDSMRnGgNl5hB9d7w.png" /><figcaption>Create a docker repository</figcaption></figure><p>Follow the setup instructions, and run <a href="https://cloud.google.com/sdk/gcloud/reference/auth/configure-docker"><em>gcloud auth configure-docker</em></a> command on <a href="https://cloud.google.com/shell">Cloud Shell</a> or your local gcloud console to configure gcloud as the credential helper for the Artifact Registry domain associated with this repository’s location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OP_II8TO9LoF34DbK4JwRQ.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W6ltZSI3ftz-w1RfqF3zmg.png" /></figure><p>Pull the latest <a href="https://hub.docker.com/r/darthsim/imgproxy/dockerfile">imgproxy</a> container image from Docker Hub to local docker environment or in <a href="https://cloud.google.com/shell/docs">Google Cloud Shell environment</a></p><blockquote><a href="https://cloud.google.com/shell/docs/using-cloud-shell">Cloud Shell</a> is an interactive shell environment for Google Cloud that lets you learn and experiment with Google Cloud and manage your projects and resources from your web browser.</blockquote><pre>$ docker pull darthsim/imgproxy:latest\</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVXAGwqMsT2xcYG3OE3CwA.png" /></figure><p><a href="https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling#tag">Tag</a> the local imgproxy container image with the repository name. Replace &lt;GCP Project ID&gt; with your GCP Project ID and &lt;Repository Name&gt; with repository we created in previous step.</p><pre>$ docker tag darthsim/imgproxy us-south1-docker.pkg.dev/&lt;GCP Project ID&gt;/&lt;Repository Name&gt;&gt;/imgproxy<br></pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ipWo1mxFBuEfv8CTmWTAeg.png" /></figure><p>Next <a href="https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling#push-tagged">Push</a> the tagged image to Artifact Registry</p><pre>$ docker push us-south1-docker.pkg.dev/&lt;GCP Project ID&gt;/&lt;Repository Name&gt;/imgproxy</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9xuBYSIi46CnsQ36UOC-fA.png" /></figure><p>Now verify container image imgproxy has been pushed to docker repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ST3eh9CEumDVSnjPlj6W_A.png" /></figure><h3>2. Create Cloud Run Service to host and run imgproxy container</h3><blockquote><a href="https://cloud.google.com/run/docs/overview/what-is-cloud-run">Cloud Run</a> is a managed compute platform that lets you run containers directly on top of Google’s scalable infrastructure.</blockquote><p>Navigate to Google Cloud Console select Cloud Run and select imgproxy container image from Artifact Registry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Juh-c6k6LfPeaPfXLlmOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gyineX_ZDcpfa4qt" /></figure><p>Now create following environment variables on Cloud Run creation page, leave IMGPROXY_ALLOWED_SOURCES and IMGPROXY_GCS_KEY blank.</p><pre>– IMGPROXY_DOWNLOAD_TIMEOUT: 10<br>– IMGPROXY_TTL=31536000<br>– IMGPROXY_ENABLE_WEBP_DETECTION=true<br>– IMGPROXY_USE_GCS=true<br>– IMGPROXY_ALLOWED_SOURCES=<br>– IMGPROXY_GCS_KEY=</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yg-krk941TbOIG_dUscICw.png" /></figure><h3><strong>3. Create Google Cloud Storage bucket to store and serve images</strong></h3><blockquote><a href="https://cloud.google.com/storage/docs">Google Cloud Storage</a> allows world-wide storage and retrieval of any amount of data at any time. You can use Cloud Storage for a range of scenarios including serving website content, storing data for archival and disaster recovery, or distributing large data objects to users via direct download.</blockquote><p>Navigate to Google Cloud Console and Select Cloud Storage Bucket and Create a new storage bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xQOnuFB_vW6E_994" /></figure><h3>4. Grant Cloud Run service account storage object viewer role on storage bucket</h3><blockquote>A <a href="https://cloud.google.com/iam/docs/service-accounts">GCP service account </a>is a special kind of account used by an application or compute workload, such as a Compute Engine virtual machine (VM) instance, rather than a person. A service account is identified by its email address, which is unique to the account.</blockquote><p>Select Cloud Run service created in previous step, and go to revisions tab, then click on security in right pane to get service account name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HtuVi5CLta_ihvGKVqpvDg.png" /></figure><p>Now navigate to Cloud Storage bucket. Under the permissions tab, add cloud run service account and assign Storage Object Viewer role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWE8KL1ggy4uwVoqjLnepQ.png" /></figure><h3>5. Setting up Cloud CDN to deliver images with external HTTP(S) Load Balancing and Serverless backend Cloud Run</h3><blockquote><a href="https://cloud.google.com/cdn/docs/overview">Google Cloud CDN</a> (Content Delivery Network) uses Google’s global edge network to serve content closer to users, which accelerates your websites and applications.</blockquote><p>Under VPC network section, select IP addresses and Reserve an external static IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MJcz93fvgIzNfeDx" /></figure><p>Next, under the Network services on Cloud Console, select Load balancing and create a HTTP(S) load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NL3aeQRSiTppoOns" /></figure><p>Select HTTP(S) load balancing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UpYVD4Yjcl6wZgzF" /></figure><p>Select the following settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SwVaEeeLJ1k-iZrd" /></figure><p><strong>Backend Configuration</strong>: Under the backend configuration select “create a backend service”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oHm4Yyz49F-h6XPh" /></figure><p>Under New backend, click create “Serverless Network Endpoint Group”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rStM72rLQbmYJvtV" /></figure><p>Specify name and under Serverless network endpoint group type select Cloud Run</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IWPAJPpxlH6LNfVF" /></figure><p>Select the Cloud Run service created in previous step</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pzWt3216vQXOJ5kC" /></figure><p>Now select enable CDN and click create new backend service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qs-nQsTWL4NiBpYv" /></figure><p><strong>Frontend Configuration</strong>: Under Frontend configuration select protocol HTTPS, under the IP address select external IP created in previous steps</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABRA8v7dHsNUrQrDvpc_uQ.png" /></figure><p>Under Certificates select Create Certificate and specify name. In our case I am creating a Google managed SSL certificate. I already have a domain name gcpenv.com that I will use for my Google-managed SSL certificate.</p><blockquote><a href="https://cloud.google.com/load-balancing/docs/ssl-certificates/google-managed-certs">Google-managed SSL certificates</a> are Domain Validation (DV) certificates that Google Cloud obtains and manages for your domains. They support multiple hostnames in each certificate, and Google renews the certificates automatically.</blockquote><p>Note: Provisioning a Google-managed certificate might take up to <a href="https://cloud.google.com/load-balancing/docs/ssl-certificates/troubleshooting">60 minutes</a> from the moment your DNS and load balancer configuration changes have propagated across the internet. You can run following command to check the certificate status:</p><pre>gcloud compute ssl-certificates describe CERTIFICATE_NAME \<br>    --global \<br>    --format=&quot;get(name,managed.status)&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-dLeLp0KmKB5gJrI" /></figure><p>At this point, the certificate status and the domain status are PROVISIONING. After you complete the steps on this page, the statuses change to ACTIVE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uiZ06coWalkg4hrh" /></figure><p>Review and finish creation of Google Cloud Load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAjfcEUssAiqzIm0j7kcBg.png" /></figure><h3>6. Update DNS settings of your domain to point to your Load Balancer IP address</h3><p>Under DNS setting on your domain, change the A Record to point to the external IP of your Load Balancer created in previous step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhO9UhyCqVzGRXtlvTBylQ.png" /></figure><h3>7. Validate setup and browse next-gen images!</h3><p>To test this setup, browse url www.&lt;domain&gt;.com, we should see the page displaying “Hey I’m imgproxy!” This means our setup is working and imgproxy is deployed on Cloud Run!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*xCnk2THIdIrLPKmDIJX2Cw.png" /></figure><p>Next, we will use a imgproxy <a href="https://progapandist.github.io/imgproxy-form/">URL generator tool</a> to construct the URL of images that will be served by imgproxy. <br>Go to URL <a href="https://progapandist.github.io/imgproxy-form">https://progapandist.github.io/imgproxy-form</a> (open source tool) in your browser, and input your remote image URL and imgproxy host URL and click Generate URL button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpeombJ488LNkE_F6NXTfQ.png" /></figure><p>Copy and paste generated URL in browser and Voila! Your imgproxy is now serving your image!</p><p>Now let’s change the image format and test it. Our original image size is 273.4 KB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*fsiRr8hAuMson3szkJ9yCA.png" /><figcaption>Original image in Google Cloud Storage</figcaption></figure><p>Now let’s use our imageproxy URL generator and change image extension to WEBP by changing extension to WEBP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*or_WiBnHl4PY7EDpvDeZWg.png" /></figure><p>Use generated URL to browse the image in WEBP format, and inspect element to check the image size.</p><p>Without imgproxy :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WegsCizx0O_r2uQa2HtDfw.png" /></figure><p>With imgproxy and Cloud CDN, We can see image is almost 30% smaller in size and loads 50% faster!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nhzWdTiTZ_g5l-v3UjoXbA.png" /></figure><p>Similarly we can try to generate different image transforms of different sizes etc, for complete list of transforms with imgproxy check <a href="https://docs.imgproxy.net/generating_the_url">this</a>.</p><h3>8. Additional helpful resources</h3><ul><li><a href="https://medium.com/@c.nwaugha/deploy-imgproxy-to-google-cloud-run-d14a72ca4f16">https://medium.com/@c.nwaugha/deploy-imgproxy-to-google-cloud-run-d14a72ca4f16</a></li><li><a href="https://www.digitalocean.com/community/tutorials/how-to-serve-next-generation-images-with-imgproxy-using-docker">https://www.digitalocean.com/community/tutorials/how-to-serve-next-generation-images-with-imgproxy-using-docker</a></li><li>Open source image processing library <a href="https://www.libvips.org/">libvips</a></li><li><a href="https://docs.imgproxy.net/">imgproxy docs</a></li></ul><p>This wraps up the blog post. I hope that this was useful to you. If you have any questions, or additional thoughts, please drop in the comments.</p><p>Thank you for taking the time to read through.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d2e65d87fbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>