<?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 Feriel Kadri on Medium]]></title>
        <description><![CDATA[Stories by Feriel Kadri on Medium]]></description>
        <link>https://medium.com/@feriel.kadri_47264?source=rss-5cb9900a0254------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XZqE93OQ2y6bam5T</url>
            <title>Stories by Feriel Kadri on Medium</title>
            <link>https://medium.com/@feriel.kadri_47264?source=rss-5cb9900a0254------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:18:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@feriel.kadri_47264/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[Beyond Agent Runtime: Production Deployment Patterns for Google ADK]]></title>
            <link>https://medium.com/filter-lab/beyond-agent-runtime-production-deployment-patterns-for-google-adk-1c91fa03d817?source=rss-5cb9900a0254------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c91fa03d817</guid>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gemini-enterprise-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Feriel Kadri]]></dc:creator>
            <pubDate>Fri, 22 May 2026 14:39:22 GMT</pubDate>
            <atom:updated>2026-05-22T15:59:55.191Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XLD-a1mcTE3cvEx-TqDDjQ.png" /></figure><blockquote><strong>Note: </strong>Code examples target Python ADK SDK 1.31.1. SessionService APIs are Python-specific; ADK is also available in TypeScript, Go, and Java, with varying levels of maturity. The “Improvement Paths” section discusses features from adjacent versions (1.28 concurrency, 2.0 Beta) where relevant to deployment decisions.</blockquote><p>When building an agent with Google’s Agent Development Kit (ADK) and reaching the point of production deployment, the official documentation naturally points you in one direction: deploy everything on Gemini Enterprise Agent Platform (formerly Vertex AI Agent Platform). This is the “turnkey” option. Infrastructure, scaling, sessions, memory, and observability are all managed and interconnected seamlessly.</p><p>The Agent Runtime is an execution environment (runtime). As soon as you have a need it doesnʼt cover — custom middleware, granular networking, a specific deployment pipeline, or simply a predictable cost profile — you start fighting against the abstraction.</p><p>This article explores two alternatives to the fully managed approach that we have used and benchmarked: deploying the ADK agent on Cloud Run while keeping session management on Agent Platform (hybrid), or using Firestore as a session backend via FirestoreSessionService. Three architectures, the same ADK, very different profiles.</p><h3>Three Architectures, One ADK</h3><h4>Option A: Fully Managed (Agent Runtime)</h4><p>The client sends a message with a session_id to a FastAPI endpoint on Cloud Run. Cloud Run invokes the agent deployed on Agent Runtime. Agent Runtime natively manages integrated sessions, conversation history, and LLM calls to Gemini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3q1xHKymgXHp78fqrrCzNA.png" /></figure><h4>Option B: Hybrid (Cloud Run + Agent Platform Sessions)</h4><p>In Option B, the Agent Platform instance is still present, but it is essentially “headless”. You never deploy any code to it. You create an empty Agent Platform instance and use its identifier to authenticate calls to the Sessions API. The runtime lives on Cloud Run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMu945xN56bDxJKJUiMGXA.png" /></figure><h4>Option C: Cloud Run + Firestore Sessions</h4><p>The runtime lives on Cloud Run. Sessions are stored in Firestore via FirestoreSessionService, officially available in the Python ADK SDK. No dependency on Agent Platform quotas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nn8lCH6jhmZ0UZea8RmYRg.png" /></figure><h4><strong>The Case for Agent Runtime</strong></h4><p>Agent Runtime is a mature product. You benefit from:</p><ul><li>Managed runtime with autoscaling and a free tier.</li><li>Sub-second cold starts since the April 22, 2026 release (previously 4–5 seconds).</li><li>Support for operations lasting up to 7 days, enabling long-running agentic workflows.</li><li>Integrated sessions (short-term memory per conversation) and Agent Platform Memory Bank (long-term memory extraction).</li><li>Integrated observability, tracing, and a playground in the Cloud console.</li><li>VPC-SC, CMEK, Private Service Connect support, and HIPAA compliance.</li><li>Agent Identity (GA): unique cryptographic identity per agent (SPIFFE ID).</li><li>Agent Gateway (Preview): securing inter-agent interactions.</li><li>Agent Registry (Preview): centralized catalog of MCP servers, tools, and agents.</li><li>Agent Observability (Preview): native tracing and monitoring.</li><li>Model Armor: protection against prompt injection and data leakage.</li><li>Agent identity via IAM and threat detection via Security Command Center.</li></ul><p>For a team that wants to ship an ADK agent with zero infrastructure work, this is the right choice.</p><h4>The Tradeoffs of Going Fully Managed</h4><ul><li><strong>Cold starts</strong>: Prior to the April 22, 2026 release, cold starts of ~4–5 seconds were common. Agent Runtime now supports sub-second cold starts, which significantly reduces this concern. You can configure min_instances up to 10, but that remains a hard ceiling and a permanent cost.</li><li><strong>Runtime opacity: </strong>You don’t fully own the container. Custom middlewares, sidecars, non-Python dependencies, or atypical request handling are either complex or impossible to implement.</li><li><strong>Deployment workflow:</strong> Even with adk deploy agent_engine (and the newer agents-cli scaffold), Agent Runtime deployment provisions a “reasoning engine” resource rather than a standard container. This works, but doesn’t slot as cleanly into existing Cloud Run / GKE CI/CD pipelines built around gcloud run deploy or kubectl apply.</li><li><strong>Billing model</strong>: Agent Runtime bills by vCPU-hour and GB-hour for instances kept alive. If your traffic is irregular or low, you may prefer Cloud Run’s scale-to-zero and per-request billing.</li></ul><h3>The Hybrid Approach: Cloud Run Runs, Agent Platform Stores</h3><p>ADK is designed with interchangeable session backends. Locally, you use InMemorySessionService. In production, you can plug in DatabaseSessionService (Postgres, MySQL, SQLite) or <strong>VertexAiSessionService,</strong> exactly the same managed service used by Agent Runtime.</p><p>The key point is: you don’t need to deploy to Agent Runtime to use its Sessions. You only need an Agent Platform instance ID. Creating an empty instance is a one-liner:</p><pre>import vertexai<br><br>client = vertexai.Client(project=PROJECT_ID, location=LOCATION)<br>agent_engine = client.agent_engines.create()<br>print(agent_engine.api_resource.name.split(&quot;/&quot;)[-1])  # ← Your instance ID</pre><p>Then, on Cloud Run, configure the ADK Runner to communicate with it:</p><pre>from google.adk import Runner<br>from google.adk.sessions import VertexAiSessionService<br><br><br>session_service = VertexAiSessionService(<br>    project=PROJECT_ID,<br>    location=LOCATION,<br>    agent_engine_id=AGENT_ENGINE_ID,<br>)<br>runner = Runner(<br>    agent=root_agent,<br>    app_name=APP_NAME,<br>    session_service=session_service,<br>)</pre><p>Wrap the runner in FastAPI, containerize it, and deploy.</p><h3>The Third Path: Cloud Run + Firestore</h3><p>FirestoreSessionService is officially available in the Python ADK SDK. Instead of relying on the Agent Platform Sessions API (and its quotas), sessions are stored directly in Firestore. Setup is equally straightforward:</p><pre>from google.adk import Runner<br>from google.adk.sessions import FirestoreSessionService<br><br><br>session_service = FirestoreSessionService(<br>    project=PROJECT_ID,<br>)<br>runner = Runner(<br>    agent=root_agent,<br>    app_name=APP_NAME,<br>    session_service=session_service,<br>)</pre><p>This approach eliminates the Session Event Append Requests per minute quota that is the bottleneck of the hybrid approach. Firestore is serverless, scale-to-zero, billed per operation, and most importantly: its throughput ceiling is bounded by your database, not by an administrative quota on Google’s side.</p><h3>Crash Test Results</h3><p>We benchmarked all three approaches by implementing a multi-agent orchestrator performing RAG (Retrieval Augmented Generation) with ADK for 20 and 25 concurrent users over 10 conversation turns.</p><h4>Scenario 1: Orchestrator-only Questions (25 Users, 10 Turns)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8xGgz8xI7Ue188iIwMHVg.png" /></figure><blockquote>*The hybrid’s high RPM (300.7) is misleading: it reflects requests that fail fast, not real throughput. Firestore processes 759 requests with only 2 failures.</blockquote><h4>Scenario 2: Multi-Agent RAG (20 Users, 10 Turns)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lU8mZn7an2U9C4H5jKjyxQ.png" /></figure><h4>Interpretation</h4><p><strong>1.The hybrid isn’t slow — it’s quota-limited. </strong>On requests that do succeed, the hybrid’s median latency (8,518 ms) is competitive with the managed option (9,300 ms). The problem isn’t intrinsic performance; it’s the failure rate that spikes as soon as the Session Event Append quota is saturated.</p><p><strong>2. Firestore solves the quota problem. </strong>With 716 requests processed and a single failure (0.1%), Firestore demonstrates that by eliminating the quota bottleneck, the Cloud Run architecture holds the load. Median latency (7,806 ms) is the best of the three options.</p><p><strong>3. Managed remains reliable but slower at p95. </strong>Agent Runtime shows a p95 of 78,000 ms, well beyond both Cloud Run alternatives. For complex requests (multi-step RAG), tail latency is significant.</p><h3>Observed Errors</h3><pre>HTTP 429 RESOURCE_EXHAUSTED (hybrid only): Session Event Append Requests per minute quota exceeded. Dominant and systemic error.<br>HTTP 503 UNAVAILABLE: &quot;This model is currently experiencing high demand.&quot; Observed sporadically, independent of architecture.</pre><h3>Why the Hybrid Collapses</h3><p>Google’s documentation on Agent Platform quotas gives the session sizing formula:</p><pre>Peak quota = U × X × Y</pre><p>Where:</p><ul><li><em>U: concurrent users</em></li><li><em>X: requests per minute per user</em></li><li><em>Y: session events per request</em></li></ul><p>In a RAG or multi-agent flow, Y is never equal to 1. Every tool call, every streaming chunk, every reasoning step generates an event. Google cites Y=12 for “a complex chain involving multiple tool calls”, for example.</p><p><strong>In managed mode: </strong>these events stay within Agent Runtime’s internal perimeter. Communication paths are sized for the traffic the runtime itself emits.</p><p><strong>In hybrid mode: </strong>every event becomes an HTTP call to reasoningengines.googleapis.com. Your consumption of the Session Event Append Requests per minute quota is proportional to Y, and Y easily reaches tens of events as soon as multiple agents are involved.</p><p>With our Scenario 2 load (20 users, ~2 requests/minute, Y≈12), the formula gives 480 event calls per minute just for baseline traffic, before retries or streaming. Scenario 1 at 25 users pushes this to 600/min. The default Session Event Append quota is exceeded within seconds in either case, triggering cascading <strong>429 errors</strong>.</p><p><strong>503 errors</strong> on the model are a second symptom, whose cause is less clearly documented. The most likely hypothesis: Agent Runtime benefits from higher-priority or better-pooled model capacity than a Cloud Run client making direct calls to the Gemini API.</p><p>The hybrid architecture turns an in-process operation into an API call limited by quota. For a true single-event-per-turn agent, this is invisible. For anything involving retrieval, tool calls, or multi-step reasoning, it’s a blocker — even at modest concurrency.</p><h3>What Each Architecture Gives You, and Costs You</h3><h4>Option A: Fully Managed (Agent Runtime)</h4><p><strong>You gain: </strong>Zero infrastructure to manage. Sessions, Agent Platform Memory Bank, observability, security (VPC-SC, CMEK, IAM, SCC), Code Execution sandbox, Example Store, A2A support, Agent Identity, Agent Gateway, Agent Registry, Agent Observability, Model Armor: all integrated. Support for long-running operations up to 7 days.</p><p><strong>You lose: </strong>Control over the runtime. Cold starts (substantially reduced as of April 2026). Deployment via SDK. Billing per vCPU-hour + $0.25/1,000 session events. min_instances capped at 10.</p><h4>Option B: Cloud Run + AP Sessions (Hybrid)</h4><p><strong>You gain: </strong>Full runtime control (middleware, auth, etc.). Scale-to-zero. Standard CI/CD. Horizontal scaling without state loss.</p><p><strong>You lose:</strong> Subject to Session Event Append quotas — a blocker for multi-agent/RAG workloads. Dual billing (Cloud Run + AP sessions). Managed features lost: Code Execution, Example Store, Agent Identity, Threat Detection, A2A, Model Armor. Observability at your expense.</p><h4>Option C: Cloud Run + Firestore Sessions</h4><p><strong>You gain: </strong>Everything Cloud Run offers, plus no Session Event Append quota. Throughput bounded by Firestore, not an administrative quota. Per-operation Firestore billing, predictable and granular.</p><p><strong>You lose: </strong>The session visualization UI in the Agent Platform console. The same managed features as the hybrid. You must manage your own Firestore database (but overhead is low, as Firestore is serverless).</p><h3>When to Choose Which Option</h3><h4>Choose Managed (Agent Runtime) if:</h4><ul><li>Your agent is complex and you want predictable reliability without managing quotas or infra.</li><li>You need native security: VPC-SC, CMEK, agent identity IAM, SCC, Model Armor.</li><li>You use managed features: Agent Platform Memory Bank, Code Execution, Example Store, A2A, Agent Gateway, Agent Registry, Agent Observability.</li><li>You need long-running agentic operations (up to 7 days).</li></ul><h4>Choose Hybrid (Cloud Run + AP Sessions) if:</h4><ul><li>Your agent is simple: few events per turn, no heavy orchestration.</li><li>You value the session UI in the Agent Platform console.</li><li>You are prepared to monitor and proactively request quota increases.</li></ul><h4>Choose Firestore (Cloud Run + Firestore Sessions) if:</h4><ul><li>Your agent is complex (multi-agent, RAG) and you need the freedom of the Cloud Run runtime.</li><li>Session volume is high and the Session Event Append quota would be a bottleneck.</li><li>You want purely usage-based billing with no administrative quota.</li><li>The absence of Agent Platform Memory Bank and console UI is not a blocker.</li></ul><blockquote><strong>Summary: </strong>Choose managed (Agent Runtime) for maximum security (VPC-SC) and exclusive features like Memory Bank, Code Execution sandbox, or Agent Gateway. Choose hybrid (Cloud Run + AP Sessions) for simple agents where session visualization in the Google console is a business requirement. Choose Cloud Run + Firestore Sessions for any complex production agent (RAG, multi-agent) requiring stable latency and friction-free scaling. A SQL-backed DatabaseSessionService (Postgres/MySQL) is a drop-in alternative when Firestore isn’t available.</blockquote><p><strong>ADK demonstrates its strength here: a single agent codebase, but total flexibility over the session infrastructure.</strong></p><h3>Improvement Paths and ADK v2.0 Developments</h3><p>The ADK SDK continues to evolve to offer more flexibility. Key developments for 2026 deployments:</p><h4>1. Simplification via the adk deploy CLI</h4><p>No more need to manually wrap your agent in FastAPI. ADK now offers:</p><pre>adk deploy cloud_run - agent_engine_id=YOUR_INSTANCE_ID</pre><p>This command automates hybrid mode configuration, greatly simplifying CI/CD.</p><h4>2. The SQL Alternative for Compliance</h4><p>For environments where Firestore is not an option, DatabaseSessionService now supports Postgres and MySQL with advanced concurrency management (optimistic locking) introduced in v1.28.</p><h4>3. Graph-Based Orchestration (ADK 2.0 Beta)</h4><p>ADK 2.0 introduces Workflows and BaseNodes. This approach allows building agents as state graphs (reflection cycles). The more complex your graph, the more the Firestore option becomes essential, since each node in the graph can trigger additional session events.</p><h4>4. Deployment on Google Kubernetes Engine (GKE)</h4><p>For sovereignty needs or compute-intensive workloads (GPU for post-processing), ADK now officially supports GKE. This provides Kubernetes robustness while using Firestore for quota-free session persistence.</p><h3>Conclusion</h3><p>Agent Runtime, Cloud Run + AP Sessions, and Cloud Run + Firestore aren’t competing solutions — they’re three positions on a deployment control spectrum. The ADK codebase stays identical across all three; what changes is purely the session backend.</p><p>Our benchmarks make the tradeoffs clear. Firestore is the pragmatic default for any Cloud Run deployment the moment your agent moves beyond trivial request-response patterns. It pairs Cloud Run’s runtime ownership with session persistence that scales on Firestore’s terms, not on an administrative quota ceiling. Agent Runtime remains the right call for teams prioritizing zero infrastructure overhead and deep integration with its exclusive feature set. Hybrid AP Sessions remains relevant for simple agents that benefit from the session UI in the console.</p><h3>Sources</h3><p><strong>Quotas and System Limits :</strong><a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/resources/agent-quotas"> https://docs.cloud.google.com/gemini-enterprise-agent-platform/resources/agent-quotas</a></p><p><strong>ADK Official Documentation</strong> The technical documentation has moved from GitHub Pages to a dedicated domain:</p><ul><li><strong>Official ADK site:</strong><a href="https://adk.dev/"><strong> </strong>https://adk.dev</a></li><li><strong>Session Management (Python):</strong><a href="https://adk.dev/sessions/session/"> https://adk.dev/sessions/session/</a></li></ul><p><strong>Deployment and Migration</strong> Guides for moving from managed mode to Cloud Run or GKE:</p><ul><li><strong>Cloud Run deployment via CLI:</strong><a href="https://adk.dev/deploy/cloud-run/"><strong> </strong>https://adk.dev/deploy/cloud-run/</a></li><li><strong>Session migration guide:</strong><a href="https://adk.dev/sessions/session/migrate/"> https://adk.dev/sessions/session/migrate/</a></li></ul><p><strong>Source Code and Releases (GitHub)</strong> To track ADK v2.0 Beta developments and new SQL connectors:</p><ul><li><strong>GitHub Repository:</strong><a href="https://github.com/google/adk-python"><strong> </strong>https://github.com/google/adk-python</a></li><li><strong>Changelog / Releases:</strong><a href="https://github.com/google/adk-python/releases"> https://github.com/google/adk-python/releases</a></li></ul><p><strong>Co-written with [Manil Bendali] (</strong><a href="https://medium.com/@manil.bendali"><strong>https://medium.com/@manil.bendali</strong></a><strong>)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c91fa03d817" width="1" height="1" alt=""><hr><p><a href="https://medium.com/filter-lab/beyond-agent-runtime-production-deployment-patterns-for-google-adk-1c91fa03d817">Beyond Agent Runtime: Production Deployment Patterns for Google ADK</a> was originally published in <a href="https://medium.com/filter-lab">Filter.Lab by Converteo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>