<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Remigiusz Samborski</title>
    <description>The latest articles on DEV Community by Remigiusz Samborski (@rsamborski).</description>
    <link>https://dev.to/rsamborski</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2829111%2Fd4264501-e5df-440a-af46-f1549d9ecba1.jpg</url>
      <title>DEV Community: Remigiusz Samborski</title>
      <link>https://dev.to/rsamborski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rsamborski"/>
    <language>en</language>
    <item>
      <title>Agentic engineering a smart home energy system with Antigravity and Gemini 4</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Fri, 20 Nov 2026 12:45:36 +0000</pubDate>
      <link>https://dev.to/googleai/agentic-engineering-a-smart-home-energy-system-with-antigravity-and-gemini-4-53md</link>
      <guid>https://dev.to/googleai/agentic-engineering-a-smart-home-energy-system-with-antigravity-and-gemini-4-53md</guid>
      <description>&lt;p&gt;Running rooftop solar, a home battery, two electric vehicles (&lt;em&gt;EVs&lt;/em&gt;), and dynamic hourly electricity tariffs requires tight coordination. Without automation, these systems work against each other.&lt;/p&gt;

&lt;p&gt;At home, I run dual east/west solar panels feeding a hybrid &lt;strong&gt;inverter&lt;/strong&gt; with a 10 kWh battery, alongside a plug-in hybrid, an EV, and dynamic tariffs from my electricity provider. On sunny days, you should never buy grid power when solar can charge the battery for free. On dark, cloudy days, you want to buy grid power only during the cheapest hourly windows. Moreover, if you charge the home battery from the grid &lt;em&gt;before&lt;/em&gt; plugging in an EV, the car drains your charged home battery right away.&lt;/p&gt;

&lt;p&gt;Last weekend, in a couple of hours of hands-on work starting Saturday evening, I engineered &lt;strong&gt;&lt;a href="https://github.com/rsamborski/cheap-watts" rel="noopener noreferrer"&gt;cheap-watts&lt;/a&gt;&lt;/strong&gt; to automate this workflow and open-sourced it on GitHub, complete with a full offline unit test suite across more than 25 commits.&lt;/p&gt;

&lt;p&gt;The best part? I almost never touched the code myself.&lt;/p&gt;

&lt;p&gt;By pairing &lt;strong&gt;&lt;a href="https://g.dev/cloud/gemini-4-hydrogen" rel="noopener noreferrer"&gt;Gemini 4 Hydrogen&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://g.dev/cloud/gemini-4-carbon" rel="noopener noreferrer"&gt;Gemini 4 Carbon&lt;/a&gt;&lt;/strong&gt; inside &lt;strong&gt;&lt;a href="https://g.dev/ai/antigravity-rs" rel="noopener noreferrer"&gt;Google Antigravity&lt;/a&gt;&lt;/strong&gt;, I practiced &lt;strong&gt;agentic engineering&lt;/strong&gt; and stayed focused on high-level architecture. Here are the three main takeaways from the weekend build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dual-model workflow.&lt;/strong&gt; Use Gemini 4 Hydrogen for fast interactive specs and Gemini 4 Carbon for multi-file coding and testing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean hardware abstractions.&lt;/strong&gt; Isolate physical inverter and vehicle APIs behind interfaces so hardware surprises take one commit to fix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated safety gates.&lt;/strong&gt; Pair secret scanning, pull request (&lt;em&gt;PR&lt;/em&gt;) checks, and a &lt;code&gt;--dry-run&lt;/code&gt; flag so agents move fast without risking live keys or hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Split the workflow: Gemini 4 Hydrogen for specs, Gemini 4 Carbon for code
&lt;/h2&gt;

&lt;p&gt;Most developers rely on one AI model for every task. Either you wait on a heavy reasoning model while bouncing early ideas back and forth, or you ask a fast model to handle multi-file refactors where edge cases slip through.&lt;/p&gt;

&lt;p&gt;Inside Antigravity, I split my workflow across two models based on what each does best:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 4 Hydrogen for brainstorming and requirements.&lt;/strong&gt; Early architecture work is a fast conversation. You test assumptions, weigh trade-offs, and define edge cases. Hydrogen responds fast and uses quota well, which fits interactive discovery. On Saturday evening, before generating a single &lt;code&gt;.py&lt;/code&gt; file, I worked with Hydrogen to draft three planning files under &lt;code&gt;docs/planning/&lt;/code&gt;. I created an Architecture Decision Record (&lt;code&gt;adr-001-initial-architecture.md&lt;/code&gt;), a five-phase execution plan (&lt;code&gt;execution-plan.md&lt;/code&gt;), and a task backlog (&lt;code&gt;tasks.md&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 4 Carbon for coding.&lt;/strong&gt; Once the specs were ready, I switched to Carbon for implementation. Carbon is built for long-horizon software engineering. I pointed it at a phase in &lt;code&gt;tasks.md&lt;/code&gt; and &lt;code&gt;ADR-001&lt;/code&gt;. Carbon scaffolded the modules, wrote binary protocol bitmasks, generated offline JSON fixtures, and ran &lt;code&gt;pytest&lt;/code&gt; until every test passed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This split changed how I spent my weekend. Instead of debugging OAuth token rotation or counting Modbus register offsets by hand, I worked as the system architect. I defined rules, tested hardware connectivity on my local network, and reviewed PRs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inside the &lt;code&gt;cheap-watts&lt;/code&gt; system architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foa1sllqaxza0bfk4mlgl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foa1sllqaxza0bfk4mlgl.png" alt="Architecture diagram: solar forecasts, dynamic tariffs, and battery and EV state of charge feed a 30-minute planner that updates the inverter over local LAN Modbus and emails EV charging windows." width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During Saturday's brainstorming session with Gemini 4 Hydrogen, I ruled out building a web dashboard. Dashboards add frontend maintenance for a service that should run unattended in the background.&lt;/p&gt;

&lt;p&gt;Instead, I designed &lt;code&gt;cheap-watts&lt;/code&gt; as a headless Python 3.12 command-line interface (&lt;em&gt;CLI&lt;/em&gt;) managed with &lt;code&gt;uv&lt;/code&gt; and triggered every 30 minutes via &lt;code&gt;cron&lt;/code&gt;. Running 48 times per day keeps the planner responsive to weather shifts and plugged-in cars while staying under the vehicle telematics API's 50 requests/day quota per account.&lt;/p&gt;

&lt;p&gt;Reviewing the git history from Saturday night through Tuesday highlights four key architecture decisions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pivot from cloud APIs to local LAN Modbus
&lt;/h3&gt;

&lt;p&gt;In Phase 2 on Saturday evening, Gemini 4 Carbon built read-only clients for electricity provider tariffs, Open-Meteo solar forecasts, vehicle telematics, and the inverter vendor's cloud API. The solar forecast client supports dual east (-90°) and west (90°) roof planes without requiring an API key. Right after that, I added a read-only &lt;code&gt;cheap-watts probe&lt;/code&gt; CLI command to test live credentials.&lt;/p&gt;

&lt;p&gt;Running &lt;code&gt;probe&lt;/code&gt; on Sunday exposed my first hardware constraint. My inverter's Wi-Fi stick logger connects to a third-party mobile app rather than the inverter manufacturer's cloud. That platform lacked self-service developer keys and public charging schedule write endpoints.&lt;/p&gt;

&lt;p&gt;Because I had isolated inverter operations behind a Python &lt;code&gt;Protocol&lt;/code&gt; (&lt;code&gt;InverterClient&lt;/code&gt;), pivoting took a single commit. I asked Gemini 4 Carbon to build a local LAN adapter behind that same protocol. Carbon implemented a Modbus-over-TCP client over local port &lt;code&gt;8899&lt;/code&gt;. It reads live registers and writes the inverter's 6-slot charging schedule while keeping weekday and generator bitmasks intact. Local LAN control removed cloud rate limits, required zero external API keys, and left the mobile app untouched.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solar-first battery math and post-EV ordering
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fou94hxo3s6dp6vzzyrat.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fou94hxo3s6dp6vzzyrat.jpg" alt="Decision flowchart for each 30-minute cron run: sunny forecasts turn grid charging off for free solar and slow EV charging, while low-sun forecasts schedule the EV window first before locked cheap grid battery charging." width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coordinating a home battery with two EVs requires clear ordering rules in &lt;code&gt;src/engine/planner.py&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sunny forecast.&lt;/strong&gt; &lt;code&gt;cheap-watts&lt;/code&gt; turns grid-charging &lt;strong&gt;OFF&lt;/strong&gt; for the whole day, so rooftop solar fills the battery for free. If a car has low charge, it emails me a reminder to plug it in for a slow daytime charge using excess solar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudy forecast (low sun).&lt;/strong&gt; The planner calculates the grid deficit needed to cover typical daily usage plus a configurable buffer. It then turns grid-charging &lt;strong&gt;ON&lt;/strong&gt; to meet that deficit during the cheapest tariff hours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vehicles first, battery second.&lt;/strong&gt; Vehicle state of charge comes from the car manufacturer's telematics API, authorized once via an interactive OAuth 2.0 Device Code CLI flow. When the EV or plug-in hybrid is charging or needs a charging window, &lt;code&gt;cheap-watts&lt;/code&gt; blocks those hours from inverter grid-charging. It schedules the cheapest battery charging windows &lt;strong&gt;after&lt;/strong&gt; the vehicle window ends, so the car charger doesn't immediately drain grid-bought kWhs from the home battery.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prevent mid-charge churn with a sticky daily charging plan
&lt;/h3&gt;

&lt;p&gt;Once the pipeline ran every 30 minutes on live feeds, a subtle stateful scheduling bug appeared.&lt;/p&gt;

&lt;p&gt;Suppose the electricity provider publishes next-day prices and &lt;code&gt;cheap-watts&lt;/code&gt; schedules battery grid-charging from 02:00 to 04:00. At 02:30, &lt;code&gt;cron&lt;/code&gt; runs again. Because the battery now holds more charge, a stateless planner calculates a smaller deficit and rewrites the active charging plan mid-charge. Rolling the 24-hour lookahead forward also risked 25-hour wrap collisions on the inverter's 6-slot 00:00..24:00 schedule ring.&lt;/p&gt;

&lt;p&gt;I described this symptom to Antigravity without editing &lt;code&gt;planner.py&lt;/code&gt;. Gemini 4 Carbon added a sticky schedule guard, locking the daily charging plan to the electricity provider's active day-ahead tariff horizon. The schedule stays locked across 30-minute runs and unlocks early only if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An EV plugs in or creates a charging conflict (&lt;code&gt;ev_conflict_override&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The electricity provider publishes a new day-ahead price horizon (&lt;code&gt;new_tariff_horizon&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The weather forecast flips between sunny and low-sun regimes (&lt;code&gt;solar_regime_changed&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Signal-only alerts and resilient mini PC deployment
&lt;/h3&gt;

&lt;p&gt;Nobody wants 48 status emails per day. &lt;code&gt;cheap-watts&lt;/code&gt; stores its last applied schedule and alert timestamps in &lt;code&gt;data/state.json&lt;/code&gt;. It sends SMTP emails &lt;strong&gt;only&lt;/strong&gt; when the battery charging plan changes or a new EV recommendation triggers outside a 12-hour cooldown.&lt;/p&gt;

&lt;p&gt;For deployment on my home mini PC, I worked with Gemini 4 Hydrogen to compare local &lt;code&gt;uv&lt;/code&gt; runs against GitHub Container Registry (ghcr.io). I chose ghcr.io with a decoupled &lt;code&gt;crontab&lt;/code&gt; setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run optimization every 30 minutes using the cached local image:&lt;/span&gt;
*/30 * * * * docker run --rm --network host --env-file /opt/cheap-watts/.env -v /opt/cheap-watts/data:/app/data -v /opt/cheap-watts/logs:/app/logs ghcr.io/rsamborski/cheap-watts:latest run &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /opt/cheap-watts/logs/cron.log 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1

&lt;span class="c"&gt;# Pull image updates on a separate hourly schedule:&lt;/span&gt;
15 * * * * docker pull --quiet ghcr.io/rsamborski/cheap-watts:latest &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /opt/cheap-watts/logs/cron.log 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separating &lt;code&gt;docker pull&lt;/code&gt; from &lt;code&gt;docker run&lt;/code&gt; ensures a temporary internet or GitHub outage never blocks local LAN Modbus control of the inverter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep agentic engineering safe with the &lt;code&gt;romin-security&lt;/code&gt; skill and PR gates
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl8t6i3h9apbpyk0wipjk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl8t6i3h9apbpyk0wipjk.jpg" alt="Pipeline diagram: an Agent PR passes five automated checks (romin-security, Gitleaks, Ruff and Black, Pytest over 90% coverage, and Docker smoke test) before publishing a container image to GitHub Container Registry for the mini PC." width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Letting an AI coding agent move fast in a repository with utility API tokens, vehicle OAuth credentials, and physical inverter registers carries real risk. One bad commit to a public GitHub repository can expose live keys to automated scanners within seconds.&lt;/p&gt;

&lt;p&gt;Before writing a single line of application code on Saturday evening, I ran the &lt;strong&gt;&lt;a href="https://github.com/palladius/gemini-cli-palladius-public-goodies/tree/main/skills/romin-security" rel="noopener noreferrer"&gt;&lt;code&gt;romin-security&lt;/code&gt; skill&lt;/a&gt;&lt;/strong&gt;, codified by Riccardo Carlesso based on &lt;a href="https://medium.com/google-cloud/the-hackathon-security-guide-how-to-vibe-code-without-burning-down-your-project-0653cf6a82b9" rel="noopener noreferrer"&gt;Romin Irani's security guide&lt;/a&gt;. Designed to prevent secret leaks during fast agentic builds, the skill protected the repository from the start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero hardcoded secrets.&lt;/strong&gt; All credentials load from &lt;code&gt;.env&lt;/code&gt; (left blank in &lt;code&gt;.env.example&lt;/code&gt;) and wrap in Pydantic &lt;code&gt;SecretStr&lt;/code&gt; fields so keys never appear in stack traces or logs. Rotated vehicle OAuth refresh tokens use &lt;code&gt;0600&lt;/code&gt; file permissions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Gitleaks rules.&lt;/strong&gt; I added &lt;code&gt;.gitleaks.toml&lt;/code&gt; with custom patterns, including &lt;code&gt;sk-&lt;/code&gt; personal API tokens from the electricity provider. Gitleaks runs in local &lt;code&gt;pre-commit&lt;/code&gt; hooks and in GitHub Actions with &lt;code&gt;fetch-depth: 0&lt;/code&gt; to scan the full commit history.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Least-privilege CI and open-source scrub.&lt;/strong&gt; Every continuous integration (&lt;em&gt;CI&lt;/em&gt;) workflow sets &lt;code&gt;permissions: {}&lt;/code&gt; and pins third-party actions to full commit SHAs. Before opening the repository to the public I scrubbed personal data, generalized vehicle settings, and added &lt;code&gt;SECURITY.md&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Enforce quality with an &lt;code&gt;AGENTS.md&lt;/code&gt; file and protected PRs
&lt;/h3&gt;

&lt;p&gt;Once the core engine worked, I protected the &lt;code&gt;main&lt;/code&gt; branch on GitHub and codified agent rules in &lt;code&gt;AGENTS.md&lt;/code&gt;. Neither I nor Antigravity can push straight to &lt;code&gt;main&lt;/code&gt;. Every bug fix, refactor, or feature uses a branch and must pass five PR gates before merge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gitleaks:&lt;/strong&gt; Scans the full commit history for secrets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ruff:&lt;/strong&gt; Runs static Python linting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Black:&lt;/strong&gt; Verifies consistent code formatting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pytest:&lt;/strong&gt; Runs the offline fixture suite and enforces &lt;strong&gt;&lt;code&gt;&amp;gt; 90%&lt;/code&gt; branch coverage&lt;/strong&gt; (&lt;code&gt;fail_under = 90&lt;/code&gt; in &lt;code&gt;pyproject.toml&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker build and CLI smoke test:&lt;/strong&gt; Verifies the container image starts cleanly before merges publish &lt;code&gt;:latest&lt;/code&gt; to ghcr.io.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These gates keep Gemini 4 Carbon in check during autonomous runs. When a change drops test coverage below 90% or trips a linter rule, &lt;code&gt;pre-commit&lt;/code&gt; and CI block the merge. The agent fixes the failure on its own before I review the PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-world testing: Move from the dry-run flag to production
&lt;/h2&gt;

&lt;p&gt;Unit tests check math, not live weather forecasts or inverter firmware quirks. Because &lt;code&gt;cheap-watts&lt;/code&gt; writes Modbus holding registers to a 10 kW grid-tied hybrid inverter, I built &lt;code&gt;--dry-run&lt;/code&gt; as a strict hardware safety gate from the start.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;--dry-run&lt;/code&gt; mode, the container queries all live inputs: electricity provider tariffs, dual-string solar forecasts, vehicle telemetry, and local inverter Modbus registers. It runs the full planner, skips every Modbus write call, and prefixes change emails with &lt;code&gt;[DRY-RUN]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Before going live, I ran &lt;code&gt;cheap-watts&lt;/code&gt; in &lt;code&gt;--dry-run&lt;/code&gt; mode on my mini PC for several days and monitored its &lt;code&gt;[DRY-RUN]&lt;/code&gt; alerts. So far, every decision was accurate, from recommending the cheapest vehicle charging windows to sizing battery grid-charging right after the cars finished. Each time an alert arrived, I verified the plan and applied those exact settings by hand.&lt;/p&gt;

&lt;p&gt;After that testing period, I dropped &lt;code&gt;--dry-run&lt;/code&gt; from &lt;code&gt;crontab&lt;/code&gt; and switched &lt;code&gt;cheap-watts&lt;/code&gt; to production mode. Whenever I ship a major update, I turn &lt;code&gt;--dry-run&lt;/code&gt; back on first to verify nothing broke before re-enabling live inverter writes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;Ready to explore the project or try an agentic engineering workflow on your next weekend build? Here is where to go next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;View the code on GitHub.&lt;/strong&gt; Browse the &lt;a href="https://github.com/rsamborski/cheap-watts" rel="noopener noreferrer"&gt;cheap-watts repository&lt;/a&gt; to inspect the planner, adapt it to your local tariff API, or reuse the &lt;code&gt;AGENTS.md&lt;/code&gt; and CI gates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure your agentic workflow.&lt;/strong&gt; Read more about &lt;a href="https://medium.com/google-cloud/the-hackathon-security-guide-how-to-vibe-code-without-burning-down-your-project-0653cf6a82b9" rel="noopener noreferrer"&gt;Romin Irani's approach to security&lt;/a&gt;, codified by Riccardo Carlesso as the &lt;a href="https://github.com/palladius/gemini-cli-palladius-public-goodies/tree/main/skills/romin-security" rel="noopener noreferrer"&gt;&lt;code&gt;romin-security&lt;/code&gt; skill on GitHub&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learn more about Gemini 4 Carbon.&lt;/strong&gt; Check out the &lt;a href="https://g.dev/cloud/gemini-4-carbon" rel="noopener noreferrer"&gt;Gemini 4 Carbon overview&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learn more about Gemini 4 Hydrogen.&lt;/strong&gt; Check out the &lt;a href="https://g.dev/cloud/gemini-4-hydrogen" rel="noopener noreferrer"&gt;Gemini 4 Hydrogen overview&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start your own agentic engineering project.&lt;/strong&gt; Download and build with &lt;a href="https://g.dev/ai/antigravity-rs" rel="noopener noreferrer"&gt;Google Antigravity&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;I'm always curious how others are using agentic engineering in their projects. Share your setups and questions with me on social media:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>antigravity</category>
      <category>smarthome</category>
      <category>energy</category>
    </item>
    <item>
      <title>Behind the scenes, two months later: How we ship Google Agent Skills like products</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Tue, 10 Nov 2026 15:22:39 +0000</pubDate>
      <link>https://dev.to/googleai/behind-the-scenes-two-months-later-how-we-ship-google-agent-skills-like-products-b1l</link>
      <guid>https://dev.to/googleai/behind-the-scenes-two-months-later-how-we-ship-google-agent-skills-like-products-b1l</guid>
      <description>&lt;p&gt;In my previous post, I took you &lt;a href="https://dev.to/googleai/behind-the-scenes-how-we-build-test-and-scale-google-agent-skills-1am5"&gt;behind the scenes of Google Agent Skills&lt;/a&gt;, covering how the project started, how we maintain quality at scale, and how we handle governance. In this post, I'll share what we've built since then: the automated quality gates every change must pass, the AI review agent that inspects skill quality, and the lessons we learned along the way. You can adopt the same gates and review rules in your own skill repository.&lt;/p&gt;

&lt;p&gt;Since my last post, the &lt;a href="https://g.dev/ai/skills" rel="noopener noreferrer"&gt;Google Agent Skills repository&lt;/a&gt; has passed 21,000 GitHub stars, up from 15,000. It now hosts over 170 skills from teams across Google, and we distribute them across multiple AI platforms.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Furb1dm2yksueiyqlkm8z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Furb1dm2yksueiyqlkm8z.png" alt="Line chart of google/skills GitHub stars climbing past 21,000" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Building agent skills for a single developer or a small project is straightforward. You write a &lt;code&gt;SKILL.md&lt;/code&gt; file, define a few instructions, test it manually, and it works. At our scale, manual workflows stop being effective. Unvetted edits can introduce subtle bugs, and it becomes difficult to catch issues before they reach users.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core philosophy: Ship skills like products
&lt;/h2&gt;

&lt;p&gt;One key lesson from my previous post: a skill is a living product, not a one-off document. In practice, that means we ship every skill update like a product release.&lt;/p&gt;

&lt;p&gt;It's tempting to treat a skill as documentation. But documentation explains concepts to a human reader, while a skill steers an AI agent's reasoning loop, tool selection, and execution path. A misplaced phrase in a skill can cause an agent to invoke invalid command flags, enter an infinite loop, or waste tokens.&lt;/p&gt;

&lt;p&gt;That makes every instruction edit a behavioral change. You wouldn't ship a product update without testing it, and the same goes for a skill. This principle drives three core requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Strict semantic versioning:&lt;/strong&gt; Every behavioral change requires an explicit version bump.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic automated validation:&lt;/strong&gt; Linters and validators check every proposed change before a human or AI reviewer sees it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mandatory evaluation evidence:&lt;/strong&gt; Every change includes an evaluation report. It compares the skill against its previous version, or against an agent without the skill if the skill is new.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Automated conformance gates: The pull request pipeline
&lt;/h2&gt;

&lt;p&gt;In my previous post, I briefly listed the checks every skill passes on check-in: linters, link checkers, and AI-assisted checklists. Here's what's inside them, plus two gates I haven't covered before: semantic versioning and evaluation suite validation.&lt;/p&gt;

&lt;p&gt;When an author submits a change to our internal skills repository, an automated continuous integration and continuous delivery (CI/CD) pipeline triggers immediately. A skill must pass six automated gates and human approval before it's exported to GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Structural conformance:&lt;/strong&gt; Directory layout, allowed files, taxonomy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skill linters:&lt;/strong&gt; Frontmatter, folder naming, Markdown rules&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic versioning:&lt;/strong&gt; Version bump for every behavioral change&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation suite:&lt;/strong&gt; Valid eval suite and a fresh eval report&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link validation:&lt;/strong&gt; Relative links are valid&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI review agent:&lt;/strong&gt; Skill quality and design standards&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Human approval:&lt;/strong&gt; Final approval from a human reviewer (subject matter expert)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Structural conformance and skill linters
&lt;/h3&gt;

&lt;p&gt;Our automated validation suite inspects every pull request for structural and syntactical correctness. Some of the rules include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Folder name and metadata name must match&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SKILL.md&lt;/code&gt; and description length limits are enforced&lt;/li&gt;
&lt;li&gt;All required fields in the frontmatter &lt;code&gt;metadata&lt;/code&gt; are present&lt;/li&gt;
&lt;li&gt;Only a curated list of files and directories is allowed within a skill directory&lt;/li&gt;
&lt;li&gt;All Markdown files follow formatting rules&lt;/li&gt;
&lt;li&gt;The main &lt;code&gt;README.md&lt;/code&gt; and the machine-readable &lt;code&gt;index.json&lt;/code&gt; registry are up to date&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Semantic versioning
&lt;/h3&gt;

&lt;p&gt;Every skill declares a semantic version in its &lt;code&gt;SKILL.md&lt;/code&gt; frontmatter metadata:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---
&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;spanner-basics&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.1.1"&lt;/span&gt;
  &lt;span class="na"&gt;category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Databases&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"..."&lt;/span&gt;
&lt;span class="nn"&gt;---
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, our automated checks verify that the version is a quoted string. YAML parses unquoted values such as &lt;code&gt;2.0&lt;/code&gt; as numbers, which causes unexpected parsing errors in tools that expect a string.&lt;/p&gt;

&lt;p&gt;Second, the validator checks the version transition itself. New skills must start at &lt;code&gt;1.0.0&lt;/code&gt;, and any change to an existing skill's instructions, scripts, or references requires a version bump or the pull request is blocked. Standard reset rules apply: bumping &lt;code&gt;MAJOR&lt;/code&gt; (for example, &lt;code&gt;1.4.2&lt;/code&gt; to &lt;code&gt;2.0.0&lt;/code&gt;) resets &lt;code&gt;MINOR&lt;/code&gt; and &lt;code&gt;PATCH&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt;, and bumping &lt;code&gt;MINOR&lt;/code&gt; (for example, &lt;code&gt;1.4.2&lt;/code&gt; to &lt;code&gt;1.5.0&lt;/code&gt;) resets &lt;code&gt;PATCH&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Why enforce strict versioning if the agent only reads the Markdown instructions? The version number is for the developer and their package tooling, not for the model at runtime. Skills don't auto-update in the background, which means there's no network check or latency overhead each time an agent invokes a skill. Instead, explicit versions let developers compare their locally installed skills against the upstream catalog and decide when to pull changes — for example, by running &lt;code&gt;npx skills update&lt;/code&gt;. This also supports workflows where teams want to lock a critical skill to a known-good version to guarantee reproducible agent behavior across their projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evaluation suite validation
&lt;/h3&gt;

&lt;p&gt;Our continuous evaluations (evals) compare agent performance with and without each skill. Those results are only as reliable as the evaluation suites behind them. If a suite contains broken file references or compound expectations, test results become noisy and untrustworthy.&lt;/p&gt;

&lt;p&gt;Our validator parses each evaluation suite and the pull request description, then checks several strict invariants:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resolution of file-based prompts:&lt;/strong&gt; When a test prompt references a file (such as &lt;code&gt;@file:test_prompt.txt&lt;/code&gt;), the validator confirms that the target file exists and isn't empty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atomic expectations:&lt;/strong&gt; Each expectation must check exactly one criterion. The validator blocks compound expectations until authors split them. Lesson 2 later in this post shows why.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duplicate detection:&lt;/strong&gt; The validator flags duplicate test prompts and conflicting expectations within the same evaluation suite.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mandatory evaluation report:&lt;/strong&gt; Every pull request that modifies a skill must link to an evaluation report in its description.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eval staleness check:&lt;/strong&gt; Authors usually iterate on a pull request as reviewers leave feedback. The validator confirms that the linked report ran against the latest commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgo2946euaqb0uomdetzb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgo2946euaqb0uomdetzb.jpg" alt="Flowchart of the eval staleness check: a new commit makes the linked eval report stale until evals re-run on the latest commit, and only then does the eval gate pass" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Link validation
&lt;/h3&gt;

&lt;p&gt;Over 170 skills link to documentation for fast-evolving Google products, and those pages can move long after a skill passes review. Rather than waiting for users to report broken links, we validate links at two stages. Before merge, pull request checks verify all relative links, such as files in &lt;code&gt;references/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then, every Monday, a &lt;a href="https://github.com/google/skills/blob/main/.github/workflows/link-checker.yml" rel="noopener noreferrer"&gt;GitHub Actions workflow&lt;/a&gt; runs &lt;a href="https://github.com/lycheeverse/lychee" rel="noopener noreferrer"&gt;lychee&lt;/a&gt; across all external links in the public repository and routes any broken links to skill owners for remediation.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI review agent
&lt;/h3&gt;

&lt;p&gt;Linters and schema validators catch syntactic errors, but they can't evaluate overall quality. They can't tell you if an instruction is confusing, if a reference guide is too verbose, or if a task should have been a bash script instead of a large language model (LLM) instruction.&lt;/p&gt;

&lt;p&gt;To solve this, we integrated an AI review agent into our review pipeline. When a change affects a skill, the AI reviewer inspects it using a dedicated review skill. Yes, we use a skill to review skills.&lt;/p&gt;

&lt;p&gt;Here are the core rules the AI reviewer evaluates. You can adopt these rules in your own skill development workflows.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Skill suitability and the deterministic trap
&lt;/h4&gt;

&lt;p&gt;The first question our AI reviewer asks is simple: &lt;strong&gt;Does this task belong in an instruction?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We often see authors fall into the "deterministic trap." They write rigid, numbered sequences of command-line interface (CLI) commands directly into Markdown text.&lt;/p&gt;

&lt;p&gt;LLMs are probabilistic engines. If an operation requires a strict sequence of commands where a variation can cause an error, embedding those commands in the instruction text invites hallucinations.&lt;/p&gt;

&lt;p&gt;Our AI reviewer enforces a clear boundary between deterministic and probabilistic logic. Rigid CLI sequences, JSON parsers, and deployment steps must live in executable scripts under &lt;code&gt;scripts/&lt;/code&gt;. Markdown instructions are reserved for tasks that require judgment, such as choosing an architecture, diagnosing error logs, or synthesizing code.&lt;/p&gt;

&lt;p&gt;This rule complements the Model Context Protocol (MCP) guidance I shared last time: prefer remote MCP tools whenever possible. When you must fall back to CLI or API calls, wrap them in a script instead of spelling them out in the instructions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdyu4z0yns1vlvz15exqc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdyu4z0yns1vlvz15exqc.jpg" alt="Decision tree: tasks that need judgment belong in SKILL.md instructions, while exact command sequences use a remote MCP tool if one exists, or a script under scripts/ if not" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. The L1/L2/L3 modular architecture
&lt;/h4&gt;

&lt;p&gt;Context windows are valuable. Loading a 2,000-line skill into an agent consumes context and degrades reasoning.&lt;/p&gt;

&lt;p&gt;Our AI reviewer enforces a three-tier information hierarchy that follows the progressive disclosure model of Agent Skills:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Level 1 (Metadata):&lt;/strong&gt; The YAML frontmatter (&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;). The agent uses this concise summary for discovery and routing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 2 (Core instructions):&lt;/strong&gt; The main &lt;code&gt;SKILL.md&lt;/code&gt; file. The body must stay compact (under 500 lines). It provides workflow overviews, decision trees, and guardrails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 3 (Reference docs):&lt;/strong&gt; Detailed API references, schemas, and other reference tables live in a &lt;code&gt;references/&lt;/code&gt; directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our AI reviewer enforces two distinct rules for Level 3: &lt;strong&gt;flat directory structure&lt;/strong&gt; and &lt;strong&gt;single-hop indirection&lt;/strong&gt;. Keeping &lt;code&gt;references/&lt;/code&gt; flat (no subdirectories) is a repository convention that discourages sprawling documentation trees and makes file discovery simpler. More importantly for runtime performance, the reviewer blocks &lt;strong&gt;chained references&lt;/strong&gt;, where &lt;code&gt;SKILL.md&lt;/code&gt; links to a reference file that links to yet another file. Each hop requires an extra tool call, adding latency and cost, and our evaluations showed that agents frequently stop before following a second level of chained references.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3rvjyuxrvkys5idt1inr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3rvjyuxrvkys5idt1inr.jpg" alt="Whiteboard sketch of progressive disclosure: the agent scans skill names (L1), opens one SKILL.md (L2), and pulls one file from references/ (L3), using little of its context window" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Non-interactive script design
&lt;/h4&gt;

&lt;p&gt;When skills bundle helper scripts in &lt;code&gt;scripts/&lt;/code&gt;, we expect agents to execute them directly in terminal sandboxes.&lt;/p&gt;

&lt;p&gt;Our AI reviewer flags any script that blocks on interactive prompts. Every script must accept inputs through command-line flags or environment variables, provide &lt;code&gt;--help&lt;/code&gt; documentation, and include a &lt;code&gt;--dry-run&lt;/code&gt; or confirmation flag for destructive operations. Scripts also need to separate output cleanly, writing structured data (usually JSON) to standard output and actionable error messages to standard error.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example AI review checklist snippet
&lt;/h4&gt;

&lt;p&gt;The review skill also checks frontmatter for spec compliance and discovery, and turns the L1/L2/L3 architecture into concrete structure rules. Here's an excerpt from those criteria:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Front Matter &amp;amp; Discovery
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;  &lt;span class="gs"&gt;**Spec Compliance**&lt;/span&gt;: YAML front matter MUST strictly follow the Agent Skills
    Reference Specification (https://agentskills.io/specification). Use &lt;span class="sb"&gt;`&amp;gt;-`&lt;/span&gt;
    (folded strip-chomping) format for multi-line descriptions.
&lt;span class="k"&gt;- &lt;/span&gt;  &lt;span class="gs"&gt;**Name Constraints**&lt;/span&gt;: The &lt;span class="sb"&gt;`name`&lt;/span&gt; field must be &lt;span class="gs"&gt;**64 characters or less**&lt;/span&gt;,
    correspond to the product name, use kebab-case (&lt;span class="sb"&gt;`[a-z0-9-]`&lt;/span&gt;), and avoid
    vague names (&lt;span class="sb"&gt;`helper`&lt;/span&gt;, &lt;span class="sb"&gt;`utils`&lt;/span&gt;, &lt;span class="sb"&gt;`tools`&lt;/span&gt;, &lt;span class="sb"&gt;`data`&lt;/span&gt;). The &lt;span class="sb"&gt;`name`&lt;/span&gt; field must
    match the directory name where it's located (i.e. &lt;span class="sb"&gt;`skills/cloud/gcloud`&lt;/span&gt;
    directory should contain a front matter with &lt;span class="sb"&gt;`name: gcloud`&lt;/span&gt;).
&lt;span class="k"&gt;- &lt;/span&gt;  &lt;span class="gs"&gt;**Description Quality**&lt;/span&gt;: The &lt;span class="sb"&gt;`description`&lt;/span&gt; field must follow the
    [Description Guide](references/description_guide.md).

&lt;span class="gu"&gt;### Content Structure &amp;amp; Authoring Quality
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;  &lt;span class="gs"&gt;**L1/L2/L3 Architecture**&lt;/span&gt;: Enforce modular structure. The main &lt;span class="sb"&gt;`SKILL.md`&lt;/span&gt;
    body must stay under 500 lines. Move deep domain reference material to
    &lt;span class="sb"&gt;`references/`&lt;/span&gt; (see [Skill Structure](references/skill_structure.md)).
&lt;span class="k"&gt;- &lt;/span&gt;  &lt;span class="gs"&gt;**Flat References Directory**&lt;/span&gt;: &lt;span class="sb"&gt;`references/`&lt;/span&gt; must be a flat directory (one
    level deep, no nested subdirectories). References &amp;gt; 100 lines must include a
    Table of Contents with line hints (see
    [Skill Structure](references/skill_structure.md)).
&lt;span class="k"&gt;- &lt;/span&gt;  &lt;span class="gs"&gt;**Avoid Deeply-Nested References**&lt;/span&gt;: Avoid deeply-nested references (e.g.,
    &lt;span class="sb"&gt;`SKILL.md`&lt;/span&gt; -&amp;gt; &lt;span class="sb"&gt;`references/guides.md`&lt;/span&gt; -&amp;gt; &lt;span class="sb"&gt;`assets/output.tmpl`&lt;/span&gt;). Keep
    reference structures shallow (one level of indirection from &lt;span class="sb"&gt;`SKILL.md`&lt;/span&gt;)
    because agents might not load such link targets fully.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Human approval
&lt;/h3&gt;

&lt;p&gt;After passing all automated checks, every pull request must receive approval from a human reviewer. The reviewer is typically the skill's subject matter expert and, for new skills, a member of the Central Skills team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons learned from repository history
&lt;/h2&gt;

&lt;p&gt;Six months of commit history and pull request discussions reveal several practical takeaways.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Scope CI checks carefully
&lt;/h3&gt;

&lt;p&gt;Early in the project, we configured automated pull request checks with coarse directory globs.&lt;/p&gt;

&lt;p&gt;One check required an approved bug tracking ticket on every change. Because the glob matched too broadly, engineers making a one-line typo fix were blocked for missing a tracking ticket. Meanwhile, newly added skills in deeper subdirectories went uninspected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Match automated check rules to specific file operations, such as added versus modified files, and verify exact path depths. Treat minor edits to existing skills differently from new skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Atomic expectations
&lt;/h3&gt;

&lt;p&gt;When we started writing evaluation suites, we saw authors write compound expectations, such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Bad: Compound expectation
&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"The agent must create a Cloud Storage bucket in us-central1, enable
&lt;/span&gt;  &lt;span class="s"&gt;uniform bucket-level access, and apply lifecycle rules."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the agent configured the region and lifecycle rules but missed the uniform access flag, the LLM-as-a-judge scorer returned inconsistent ratings.&lt;/p&gt;

&lt;p&gt;Migrating to atomic expectations resolved this issue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Good: Atomic expectations
&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"The agent specifies us-central1 for the bucket location."&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"The agent enables uniform bucket-level access on the created bucket."&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"The agent defines a lifecycle configuration rule deleting objects
&lt;/span&gt;  &lt;span class="s"&gt;older than 30 days."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Check exactly one criterion per expectation. Atomic expectations make evaluation results clear, reliable, and debuggable.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Documentation drift happens fast
&lt;/h3&gt;

&lt;p&gt;In a multi-contributor repository, documentation tables drift within days if maintained manually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; If you publish an index or catalog, never rely on contributors to update it manually. Instead, write a generator script and enforce it with a CI unit test. That's the origin of the &lt;code&gt;README.md&lt;/code&gt; and &lt;code&gt;index.json&lt;/code&gt; check in our linters. Our &lt;code&gt;index.json&lt;/code&gt; even opens with a warning: "This file is generated. Do not edit it by hand."&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Gate expensive LLM checks behind fast deterministic ones
&lt;/h3&gt;

&lt;p&gt;Running full evaluation suites and an AI review agent on every change can get expensive fast, both in token usage and CI runtime — especially when authors push frequent small commits during review.&lt;/p&gt;

&lt;p&gt;In our pipeline, fast deterministic checks run first. Structural conformance, skill linters, and semantic versioning act as blocking gates: if any of them fail, the pipeline stops immediately and won't trigger the AI reviewer or evaluation checks until those issues are fixed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Stage your pipeline so cheap, deterministic checks block broken changes before LLM-powered gates run. When building a similar system, consider adding further cost guardrails, such as manual triggers for heavy checks (for example, a &lt;code&gt;/run-evals&lt;/code&gt; pull request comment) or only triggering automatic re-runs when the diff exceeds a specific threshold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building a scalable Agent Skills repository requires more than good prompt engineering. It requires solid developer infrastructure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ship skills like products: version, validate, and evaluate every change.&lt;/li&gt;
&lt;li&gt;Enforce semantic versioning and atomic expectations with automated CI gates.&lt;/li&gt;
&lt;li&gt;Use an AI reviewer to catch design anti-patterns, such as the deterministic trap.&lt;/li&gt;
&lt;li&gt;Check links before merge and on a weekly schedule.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links and further reading
&lt;/h2&gt;

&lt;p&gt;To get started with Google Agent Skills, check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Agent Skills repo:&lt;/strong&gt; &lt;a href="https://g.dev/ai/skills" rel="noopener noreferrer"&gt;github.com/google/skills&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Previous post:&lt;/strong&gt; &lt;a href="https://dev.to/googleai/behind-the-scenes-how-we-build-test-and-scale-google-agent-skills-1am5"&gt;Behind the scenes: How we build, test, and scale Google Agent Skills&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Launch announcement:&lt;/strong&gt; &lt;a href="https://cloud.google.com/blog/topics/developers-practitioners/level-up-your-agents-announcing-googles-official-skills-repository" rel="noopener noreferrer"&gt;Level Up Your Agents: Announcing Google's Official Skills Repository&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skills tutorial:&lt;/strong&gt; &lt;a href="https://medium.com/google-cloud/google-cloud-skills-tutorial-the-complete-guide-to-ai-powered-cloud-operations-7838fcc9541a" rel="noopener noreferrer"&gt;Introduction: What Are Google Cloud Agent Skills?&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;If you found this post helpful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Share this post with your friends on social media.&lt;/li&gt;
&lt;li&gt;Connect with me via &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt;, or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agentskills</category>
      <category>programming</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Equip your agent with Google Cloud best practices using google-cloud-developer plugin</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Thu, 24 Sep 2026 11:55:12 +0000</pubDate>
      <link>https://dev.to/googleai/equip-your-agent-with-google-cloud-best-practices-using-google-cloud-developer-plugin-1bm1</link>
      <guid>https://dev.to/googleai/equip-your-agent-with-google-cloud-best-practices-using-google-cloud-developer-plugin-1bm1</guid>
      <description>&lt;p&gt;Coding agents in your terminal can scaffold microservices in seconds. But what happens when your agent needs to deploy directly to Google Cloud?&lt;/p&gt;

&lt;p&gt;Without cloud-specific guidance, typical agents struggle. They hallucinate obsolete SDK calls, attempt to run commands without required permissions, or silently enable billable APIs that create surprise costs on your invoice.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/google/skills/tree/main/plugins/cloud/google-cloud-developer" rel="noopener noreferrer"&gt;&lt;code&gt;google-cloud-developer&lt;/code&gt; plugin&lt;/a&gt; changes this dynamic. It equips your agent (such as &lt;a href="https://antigravity.google/product/antigravity-cli?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Antigravity CLI&lt;/a&gt;, &lt;a href="https://claude.com/product/claude-code" rel="noopener noreferrer"&gt;Claude Code&lt;/a&gt;, &lt;a href="https://learn.chatgpt.com/docs/codex/cli" rel="noopener noreferrer"&gt;Codex CLI&lt;/a&gt;) with curated skills and the &lt;a href="https://developers.google.com/knowledge/mcp?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Developer Knowledge MCP server&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To evaluate the plugin in action, I tasked Antigravity CLI (&lt;code&gt;agy&lt;/code&gt;) with building a complete, cloud-based solution from a fresh Google Cloud project. The scenario: scaffold, containerize, and deploy a secure &lt;a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/start?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini AP&lt;/a&gt;I streaming proxy on &lt;a href="https://docs.cloud.google.com/run/docs/overview/what-is-cloud-run?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud Run&lt;/a&gt;, complete with &lt;a href="https://docs.cloud.google.com/iam/docs?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud IAM&lt;/a&gt; authentication and &lt;a href="https://cloud.google.com/products/firestore?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Firestore&lt;/a&gt; token tracking.&lt;/p&gt;

&lt;p&gt;While the resulting &lt;a href="https://github.com/rsamborski/vibecoding/tree/main/cloud-run-proxy" rel="noopener noreferrer"&gt;Cloud Run proxy codebase&lt;/a&gt; works, the proxy itself is just an example. The real value is how the plugin guides the agent through every phase of the cloud development process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Application design and SDK code generation:&lt;/strong&gt; Writing Gemini SDK code without hallucinations and selecting the right database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project onboarding, billing verification, and API enablement:&lt;/strong&gt; Auditing the project, linking a Cloud Billing account, and requesting explicit user approval before enabling billable APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Least-privilege IAM and Cloud Run deployment:&lt;/strong&gt; Provisioning dedicated service accounts and deploying the container asynchronously.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;End-to-end verification:&lt;/strong&gt; Testing streaming and token persistence against the live service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fumou2bea1rbio78nz5ms.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fumou2bea1rbio78nz5ms.png" alt="Architecture and workflow overview" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick install: Five skills and an MCP server
&lt;/h2&gt;

&lt;p&gt;Remember the scene in &lt;em&gt;The Matrix&lt;/em&gt; where Trinity calls Tank for a helicopter pilot program and learns it in seconds? Adding the plugin to &lt;code&gt;agy&lt;/code&gt; works the same way with one terminal command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;agy plugin &lt;span class="nb"&gt;install &lt;/span&gt;https://github.com/google/skills/plugins/cloud/google-cloud-developer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CLI clones the plugin repository, registers its components, and makes them available immediately.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F88s8wxwrwzx6lvew9284.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F88s8wxwrwzx6lvew9284.png" alt="Installing the google-cloud-developer plugin" width="800" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In seconds, &lt;code&gt;agy&lt;/code&gt; configures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Five specialized skills covering Google Cloud CLI patterns and workflows.&lt;/li&gt;
&lt;li&gt;Developer Knowledge MCP server providing access to current API syntax and Google Cloud documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the plugin active, &lt;code&gt;agy&lt;/code&gt; pairs its Gemini 3.8 Flash model with authoritative cloud instructions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; As a heavy user of Google Cloud, I already have &lt;code&gt;gcloud&lt;/code&gt; installed and authenticated. I also enabled the Developer Knowledge API in my project. For new users and ones who use a different harness such as Claude Code CLI or Codex CLI, I recommend following the &lt;a href="https://docs.cloud.google.com/docs/get-started/developer-environment?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt; to get started.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Knowledge grounding: Writing modern SDK code without hallucinations
&lt;/h2&gt;

&lt;p&gt;One frequent failure mode with AI coding assistants is API obsolescence. For example, older tutorials rely on deprecated libraries such as &lt;code&gt;google-generativeai&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Because the &lt;code&gt;google-cloud-developer&lt;/code&gt; plugin connects directly to the Developer Knowledge API, the agent checks the latest official syntax before writing a single line of code.&lt;/p&gt;

&lt;p&gt;When scaffolding &lt;code&gt;app/gemini_client.py&lt;/code&gt;, &lt;code&gt;agy&lt;/code&gt; immediately used the current unified Google Gen AI SDK:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feq51kn6xfmb5m1fh4q4b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feq51kn6xfmb5m1fh4q4b.png" alt="Scaffolding code with official SDK syntax" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The agent produced clean Python code with Pydantic configuration, structured Cloud Logging formatters, and unit tests using &lt;code&gt;pytest&lt;/code&gt; and FastAPI's &lt;code&gt;TestClient&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Informed architecture: Evaluating database options with Developer Knowledge
&lt;/h2&gt;

&lt;p&gt;Selecting the right database for a serverless proxy requires balancing latency, connection handling, concurrency, and cost. When I asked &lt;code&gt;agy&lt;/code&gt; to track token usage per user and suggest the best database, the agent did not just pick one at random.&lt;/p&gt;

&lt;p&gt;Backed by the Developer Knowledge API, the agent pulled real-time architectural guidance and evaluated Google Cloud database options:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foab0x7klr4a6qamn7gkv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foab0x7klr4a6qamn7gkv.png" alt="Evaluating database options for the proxy service" width="799" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By grounding its analysis in the Developer Knowledge, the agent presented a clear comparison table directly in the terminal. It recommended Cloud Firestore as the most cost-effective and operationally simple fit for Cloud Run. You get an informed architectural decision based on official cloud patterns rather than guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cost guardrails and onboarding: Verifying billing before enabling APIs
&lt;/h2&gt;

&lt;p&gt;Once the code and Firestore design were ready, the agent needed to enable the Gemini Enterprise, Cloud Run, and Firestore APIs in my project. Autonomous agents need strict boundaries here, because enabling an API or provisioning a managed resource can incur costs.&lt;/p&gt;

&lt;p&gt;Two skills in the &lt;code&gt;google-cloud-developer&lt;/code&gt; plugin coordinate this step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pre-flight billing audit:&lt;/strong&gt; Before enabling billable services, the &lt;code&gt;google-cloud-recipe-onboarding&lt;/code&gt; skill instructs the agent to verify that the target project is linked to an active Cloud Billing account (&lt;code&gt;gcloud billing projects describe&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explicit user consent:&lt;/strong&gt; The &lt;code&gt;gcloud&lt;/code&gt; skill requires explicit user approval before running &lt;code&gt;gcloud services enable&lt;/code&gt; or any destructive action.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When &lt;code&gt;agy&lt;/code&gt; identified the required APIs for the proxy, it first checked my project state and paused for explicit permission:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The system's guardrails require explicit user approval before enabling any API, specifically addressing potential security risks and unexpected costs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This keeps you in the driver's seat and eliminates accidental spend.&lt;/p&gt;

&lt;h3&gt;
  
  
  How &lt;code&gt;agy&lt;/code&gt; helps: Scheduling timers for billing propagation
&lt;/h3&gt;

&lt;p&gt;During the onboarding skill's pre-flight check, I linked a new billing account to my test project so &lt;code&gt;agy&lt;/code&gt; could enable the APIs. In Google Cloud, linking a billing account often takes a few minutes to propagate across backend systems.&lt;/p&gt;

&lt;p&gt;While the &lt;code&gt;google-cloud-developer&lt;/code&gt; plugin tells the agent &lt;em&gt;how&lt;/em&gt; to validate billing status (&lt;code&gt;gcloud billing projects describe&lt;/code&gt; checking for &lt;code&gt;billingEnabled: true&lt;/code&gt;), &lt;code&gt;agy&lt;/code&gt; complements the plugin with its native &lt;code&gt;Schedule&lt;/code&gt; tool so the session does not fail or spin in a retry loop.&lt;/p&gt;

&lt;p&gt;I typed:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Ok. Let's wait now. I just enabled the billing and it needs to propagate. I'll check in 10 minutes."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent scheduled a 600-second timer and freed the terminal prompt:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyasaane47mgblblj05ur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyasaane47mgblblj05ur.png" alt="Scheduling a billing timer" width="800" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Exactly 10 minutes later, the timer woke the agent up. It resumed the exact conversation context, checked the billing status with &lt;code&gt;gcloud beta billing projects describe&lt;/code&gt;, verified that &lt;code&gt;billingEnabled&lt;/code&gt; was &lt;code&gt;true&lt;/code&gt;, and prompted to enable the required APIs:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F23rhikrpb8jj7yixczb8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F23rhikrpb8jj7yixczb8.png" alt="Timer triggered and billing confirmed" width="799" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can walk away, grab a coffee, and let your agent resume right where you left off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security enforcement: Least-privilege IAM
&lt;/h2&gt;

&lt;p&gt;With the APIs enabled, the next step before deployment was configuring authentication. Without guidance, agents often suggest creating a long-lived Gemini API key or downloading a service account JSON key file.&lt;/p&gt;

&lt;p&gt;Instead, the &lt;code&gt;google-cloud-recipe-auth&lt;/code&gt; skill explicitly forbids downloaded service account keys and steers the agent toward Google Cloud security best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dedicated service identity:&lt;/strong&gt; Creates a workload-specific service account (&lt;code&gt;gemini-proxy-sa&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Least-privilege IAM bindings:&lt;/strong&gt; Grants only &lt;code&gt;roles/aiplatform.user&lt;/code&gt; for Gemini invocation and &lt;code&gt;roles/datastore.user&lt;/code&gt; for Firestore token logging.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authenticated ingress:&lt;/strong&gt; Protects the Cloud Run endpoint with &lt;code&gt;--no-allow-unauthenticated&lt;/code&gt; so the Google Frontend validates &lt;a href="https://docs.cloud.google.com/docs/authentication/get-id-token?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Google-signed OpenID Connect (OIDC) ID tokens&lt;/a&gt; before traffic reaches your container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No secrets live in plaintext, and permissions stay tightly scoped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Run deployment
&lt;/h2&gt;

&lt;p&gt;To deploy the container, &lt;code&gt;agy&lt;/code&gt; used &lt;code&gt;finding-google-skills&lt;/code&gt; to pull Cloud Run deployment patterns (&lt;code&gt;cloud-run-basics&lt;/code&gt;) from the remote skill catalog and combined them with the &lt;code&gt;gcloud&lt;/code&gt; skill's command formatting rules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud run deploy gemini-38-flash-proxy &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--source&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-central1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--service-account&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gemini-proxy-sa@[PROJECT_ID].iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How &lt;code&gt;agy&lt;/code&gt; helps: Running long tasks in the background
&lt;/h3&gt;

&lt;p&gt;Building a container image from source still takes a few minutes. &lt;code&gt;agy&lt;/code&gt; helps by launching the deployment as a background task instead of locking up your interactive session:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiikanzccwusv0gw5d7qk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiikanzccwusv0gw5d7qk.png" alt="Cloud Run deployment running in the background" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice the task status bar in the terminal: &lt;code&gt;[14:12:41] gcloud run deploy gemini-38-flash-proxy ... running (1 task(s) · /tasks)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can continue chatting with the agent, ask questions, or inspect background jobs with &lt;code&gt;/tasks&lt;/code&gt; while Cloud Build compiles your container image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live verification: Streaming and per-user token persistence
&lt;/h2&gt;

&lt;p&gt;Once the background deployment completed, &lt;code&gt;agy&lt;/code&gt; generated test commands to verify the end-to-end flow.&lt;/p&gt;

&lt;p&gt;Calling the usage endpoint with an authenticated identity token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; GET https://gemini-38-flash-proxy-[PROJECT_NUMBER].us-central1.run.app/v1/users/me/usage &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;gcloud auth print-identity-token&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Returns real-time Firestore persistence data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"[EMAIL]"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"total_input_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"total_output_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"total_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"last_active"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-09-21T12:21:21.567000+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models.gemini-3_8-flash.input_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models.gemini-3_8-flash.output_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models.gemini-3_8-flash.total_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Atomic increments in Firestore record prompt and completion token counts across requests, giving you immediate visibility into user consumption.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Pairing &lt;code&gt;agy&lt;/code&gt; with the &lt;code&gt;google-cloud-developer&lt;/code&gt; plugin creates a safer, smarter CLI workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Knowledge grounding: Developer Knowledge API prevents outdated SDK hallucinations and ensures accurate code generation.&lt;/li&gt;
&lt;li&gt;Human in the loop: Built-in skill guardrails require explicit permission before running commands that can incur cloud costs.&lt;/li&gt;
&lt;li&gt;Non-blocking workflow: Scheduled timers handle asynchronous cloud operations, while background tasks let long builds run without freezing your prompt.&lt;/li&gt;
&lt;li&gt;Enterprise security defaults: Encourages least-privilege service accounts and IAM authentication over hardcoded secrets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;Check out more resources on &lt;code&gt;google-cloud-developer&lt;/code&gt; plugin:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/google/skills/tree/main/plugins/cloud/google-cloud-developer" rel="noopener noreferrer"&gt;google-cloud-developer plugin on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/blog/topics/developers-practitioners/introducing-the-google-cloud-developer-plugin-for-ai-coding-agents?utm_campaign=CDR_0x87fa8d40_default_b563025958&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Official announcement on the Google Cloud blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://g.dev/cloud/agent-plugins-codelab-agy" rel="noopener noreferrer"&gt;Hands-on codelab: Install and use Google Cloud Developer plugin in Antigravity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;I am always eager to share what I've learned and hear how fellow developers and AI enthusiasts use Antigravity and Google Cloud. If you found this article helpful, feel free to share it and follow me on your favorite social platform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>agentskills</category>
      <category>googlecloud</category>
    </item>
    <item>
      <title>Behind the scenes: How we build, test, and scale Google Agent Skills</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Mon, 03 Aug 2026 14:33:20 +0000</pubDate>
      <link>https://dev.to/googleai/behind-the-scenes-how-we-build-test-and-scale-google-agent-skills-1am5</link>
      <guid>https://dev.to/googleai/behind-the-scenes-how-we-build-test-and-scale-google-agent-skills-1am5</guid>
      <description>&lt;p&gt;AI agents are only as good as the instructions and context you give them. When we launched &lt;a href="https://github.com/google/skills" rel="noopener noreferrer"&gt;Google Agent Skills&lt;/a&gt;, our goal was simple: encode Google Cloud domain knowledge into structured, open-source instructions that make AI coding agents significantly smarter, safer, and more accurate.&lt;/p&gt;

&lt;p&gt;Today, I want to take you behind the scenes of Google Agent Skills. As a team member working directly on these skills, I will share how we started, how we maintain quality at scale, and how we handle governance for public and internal skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it started: The Next'26 kickoff swarm
&lt;/h2&gt;

&lt;p&gt;The Google Agent Skills project didn't start in a vacuum. It kicked off as a fast-paced "swarm" effort leading up to Google Cloud Next 2026.&lt;/p&gt;

&lt;p&gt;A cross-functional task force led by &lt;strong&gt;Developer Advocates&lt;/strong&gt; and &lt;strong&gt;Technical Writers&lt;/strong&gt; came together with a clear goal: package Google Cloud domain knowledge into structured, agent-readable instructions.&lt;/p&gt;

&lt;p&gt;The launch was announced in the &lt;a href="https://cloud.google.com/blog/topics/developers-practitioners/level-up-your-agents-announcing-googles-official-skills-repository?utm_campaign=CDR_0x87fa8d40_default_b539420191&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;official Google Agent Skills launch post&lt;/a&gt;. The initial community reception exceeded our expectations with over 15,000 GitHub stars!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fopgd3rqcax644g29nqyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fopgd3rqcax644g29nqyv.png" alt="GitHub stars history for google/skills" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once developers and engineering teams inside and outside Google saw how effectively skills guided AI agents (reducing hallucinations and enforcing best practices), many wanted in. Soon, a wave of product teams wanted to contribute skills for their own Google services (not limited to Cloud, i.e. Ads).&lt;/p&gt;

&lt;h2&gt;
  
  
  The challenge: Scaling without losing quality
&lt;/h2&gt;

&lt;p&gt;Popularity brings a major challenge: quality control. &lt;/p&gt;

&lt;p&gt;When different teams contribute skills, keeping a consistent standard becomes tough. A poorly written skill with vague instructions, broken links, or missing edge cases degrades the entire agent experience.&lt;/p&gt;

&lt;p&gt;To enable teams to publish skills while protecting the developer experience, we had to set a &lt;strong&gt;very high bar&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This meant the process was critical. Without clear standards and automated governance, an open-source skills repository quickly becomes chaotic.&lt;/p&gt;

&lt;p&gt;So let's dive into details of how we maintain quality as we scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  The anatomy of an Agent Skill
&lt;/h2&gt;

&lt;p&gt;To keep skills consistent across many Google services, every skill follows a standardized repository layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{skill-name}/
├── SKILL.md                 # Required: Main instructions &amp;amp; frontmatter metadata
├── OWNERS                   # Required: Skill maintainers (kept internal)
├── EVAL.yaml                # Required: Evaluation prompt suites &amp;amp; rubrics (kept internal)
├── reference/               # Optional: In-depth technical docs &amp;amp; schemas
├── scripts/                 # Optional: Executable helper scripts
├── assets/                  # Optional: Static resources &amp;amp; diagrams
└── _internal/               # Optional: Test mocks &amp;amp; internal data (kept internal)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Architectural best practice: Prefer remote MCP tools
&lt;/h3&gt;

&lt;p&gt;When designing skills, our guiding principle is: &lt;strong&gt;Reference remote Model Context Protocol (MCP) tools whenever possible, falling back to CLI or API calls only when necessary.&lt;/strong&gt; Remote MCP servers are best suited for Agentic workloads by providing tools, while also offering built-in auth and IAM governance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public export
&lt;/h3&gt;

&lt;p&gt;We build and evaluate our skills internally first to make sure they work and are properly validated. Once ready to go public, we use automated export rules to publish to GitHub. This keeps public repos clean while stripping out internal assets, ownership information, and evaluation suites.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automated checks on check-in
&lt;/h2&gt;

&lt;p&gt;Before any skill enters the repository, it must pass an automated CI/CD pipeline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linters:&lt;/strong&gt; We validate frontmatter metadata, line counts, directory layout, and strict naming conventions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link Checkers:&lt;/strong&gt; We test every URL using link-checking tools to eliminate 404s and hallucinated links before merge. &lt;em&gt;Hint: if you're building a similar solution I recommend trying out &lt;a href="https://lychee.cli.rs/" rel="noopener noreferrer"&gt;lychee&lt;/a&gt;.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI-Assisted Checklists:&lt;/strong&gt; We use automated validation checks to verify that instructions follow required structural patterns and guardrails.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example GitHub Action for skill linting
&lt;/h3&gt;

&lt;p&gt;While our development relies on Google's internal tooling, public open-source skill repositories can use standard GitHub Actions for CI/CD.&lt;/p&gt;

&lt;p&gt;If you are maintaining your own skill library on GitHub, linting is part of a larger check suite to keep a high quality bar. The following GitHub Action configuration demonstrates how to automatically run skill validation in your repository using &lt;a href="https://github.com/agentskills/agentskills/tree/main/skills-ref" rel="noopener noreferrer"&gt;skills-ref&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Validate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Skills'&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;main'&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;main'&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;defaults&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bash'&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;validate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ubuntu-latest'&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;read'&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Checkout&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;repository'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5'&lt;/span&gt; &lt;span class="c1"&gt;# ratchet:actions/checkout@v4&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Set&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;up&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Python'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065'&lt;/span&gt; &lt;span class="c1"&gt;# ratchet:actions/setup-python@v5&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;python-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.12'&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Install&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;skills-ref'&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;python3 -m pip install skills-ref&lt;/span&gt;
          &lt;span class="s"&gt;echo "$HOME/.local/bin" &amp;gt;&amp;gt; $GITHUB_PATH&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Validate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;skills'&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;shopt -s nullglob&lt;/span&gt;
          &lt;span class="s"&gt;for skill_dir in skills/*/; do&lt;/span&gt;
            &lt;span class="s"&gt;echo "Validating skill: $skill_dir"&lt;/span&gt;
            &lt;span class="s"&gt;agentskills validate "$skill_dir"&lt;/span&gt;
          &lt;span class="s"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Continuous evals (on submit &amp;amp; weekly)
&lt;/h2&gt;

&lt;p&gt;Documentation and APIs evolve, and so do LLM models and agent harnesses. A skill that works today might break tomorrow if an underlying API, model, or agent harness changes.&lt;/p&gt;

&lt;p&gt;To set an initial quality bar and prevent degradation, we run continuous evaluations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On-submit evaluations:&lt;/strong&gt; Authors must provide explicit evaluation prompt suites and scoring rubrics. Every new skill that we launch is first evaluated internally to ensure its accuracy and efficiency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weekly quality checks:&lt;/strong&gt; We run continuous, scheduled evaluation jobs against the full skill library to catch regressions early.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Skill authors must supply multiple evaluation test cases, each containing a prompt and a set of expectations. With each evaluation suite, we compare the performance of agents with and without each skill.&lt;/p&gt;

&lt;p&gt;And look at two main dimensions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accuracy - response quality and task completion rate&lt;/li&gt;
&lt;li&gt;Efficiency - number of consumed tokens and time for completion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Moreover we run our evals multiple times against different agent frameworks to obtain statistically significant results.&lt;/p&gt;

&lt;p&gt;Finally the 2x2 matrix proves whether a skill delivers a measurable accuracy and efficiency uplift.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1zftd8j1g0ozhbsbm5ri.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1zftd8j1g0ozhbsbm5ri.jpg" alt="2x2 evaluation matrix comparing efficiency and performance for agents with and without skills" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Skills are products, not snippets
&lt;/h2&gt;

&lt;p&gt;A key lesson learned from our work is that a skill is a living product, not a one-off document.&lt;/p&gt;

&lt;p&gt;To ensure long-term reliability, we established strict ownership rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Repo maintainers&lt;/strong&gt; oversee repository health, CI pipelines, and architectural standards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skill owners&lt;/strong&gt; are responsible for maintaining their skills long-term. For example, if a product API changes, the skill owner updates the skill. The same applies to quality degradation found during evaluation runs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Supporting authors: Tools and agentic workflows
&lt;/h2&gt;

&lt;p&gt;Writing effective instructions and evaluation suites requires practice and we don't expect skill authors to craft everything from scratch.&lt;/p&gt;

&lt;p&gt;To support our contributors, we built several tools and agentic workflows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internal skills&lt;/strong&gt; designed specifically to assist authors building new skills and writing robust evaluations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agentic tools&lt;/strong&gt; built with the &lt;a href="https://adk.dev/" rel="noopener noreferrer"&gt;ADK&lt;/a&gt; that run multi-agent loops for authoring and self-critique, with an easy export path to the main repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will dive deeper into these authoring tools and agentic workflows in future articles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Internal efficiency with "DevRel Skills"
&lt;/h2&gt;

&lt;p&gt;While &lt;a href="https://github.com/google/skills" rel="noopener noreferrer"&gt;Google Agent Skills&lt;/a&gt; hosts public skills for external developers, we also launched a parallel internal initiative called &lt;strong&gt;DevRel Skills&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;DevRel Skills focus on building agent skills specifically for internal team workflows. By encoding internal processes — such as content transformation, SEO optimization, internal reporting, etc. - into dedicated skills, we help our team work more effectively and consistently every day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up and over to you
&lt;/h2&gt;

&lt;p&gt;Building quality agent skills at scale requires combining clear standards, rigorous evaluation, automated CI/CD, and long-term ownership.&lt;/p&gt;

&lt;p&gt;As agentic development grows, we'd love to hear from you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;How are you building and testing agent skills in your workflow?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What checks or evals do you use to verify agent responses?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let us know in the comments or reach out on socials!&lt;/p&gt;

&lt;h2&gt;
  
  
  Links and further reading
&lt;/h2&gt;

&lt;p&gt;To get started with Google Agent Skills, check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Agent Skills Repo:&lt;/strong&gt; &lt;a href="https://github.com/google/skills" rel="noopener noreferrer"&gt;github.com/google/skills&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part 1:&lt;/strong&gt; &lt;a href="https://medium.com/google-cloud/google-cloud-skills-tutorial-the-complete-guide-to-ai-powered-cloud-operations-7838fcc9541a" rel="noopener noreferrer"&gt;Introduction: What Are Google Cloud Agent Skills?&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part 2:&lt;/strong&gt; &lt;a href="https://medium.com/google-cloud/google-cloud-skills-tutorial-part-2-intermediate-skills-in-action-dd599a32fb6c" rel="noopener noreferrer"&gt;Practical Guide: Intermediate Agent Skills in Action&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;If you found this post helpful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add reactions to this post by pressing the heart ❤️ button.&lt;/li&gt;
&lt;li&gt;Share this post with your friends on socials.&lt;/li&gt;
&lt;li&gt;Connect with me via &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agentskills</category>
      <category>googlecloud</category>
      <category>opensource</category>
    </item>
    <item>
      <title>The (no longer) missing multi-agent pattern: triggering dynamic workflows from an agent</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Tue, 14 Jul 2026 09:57:26 +0000</pubDate>
      <link>https://dev.to/googleai/the-no-longer-missing-multi-agent-pattern-triggering-dynamic-workflows-from-an-agent-ef3</link>
      <guid>https://dev.to/googleai/the-no-longer-missing-multi-agent-pattern-triggering-dynamic-workflows-from-an-agent-ef3</guid>
      <description>&lt;p&gt;When building multi-agent systems, rigid state graphs quickly fall apart in the face of dynamic user inputs. Imagine building a smart assistant: a user hands you a checklist of three household chores today, but tomorrow it might be a list of ten software debugging tasks. Because the number of tasks, their sequence, and their execution details are entirely runtime-dependent, you cannot hardcode this path at design time. Forcing dynamic lists of work into a static &lt;a href="https://adk.dev/graphs/" rel="noopener noreferrer"&gt;graph-based workflow&lt;/a&gt; can lead to fragile, over-engineered code. You need a workflow that adapts dynamically at runtime.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://adk.dev/" rel="noopener noreferrer"&gt;Google Agent Development Kit (ADK)&lt;/a&gt; provides a flexible programming model to define &lt;a href="https://adk.dev/graphs/dynamic/" rel="noopener noreferrer"&gt;dynamic workflows&lt;/a&gt;. With the release of &lt;a href="https://github.com/google/adk-python/releases/tag/v2.4.0" rel="noopener noreferrer"&gt;ADK 2.4.0&lt;/a&gt;, triggering these workflows has become even more seamless: you can register a &lt;code&gt;Workflow&lt;/code&gt; directly in an agent's &lt;code&gt;tools&lt;/code&gt; list, allowing the coordinator agent to execute it automatically as a first-class tool.&lt;/p&gt;

&lt;p&gt;In this article, you learn how to configure and trigger a dynamic workflow directly from a coordinator agent. This guide uses a task list coordination example, but you can adjust this pattern to other dynamic orchestration needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture of a dynamic workflow
&lt;/h2&gt;

&lt;p&gt;Static workflows define the execution path at design time. Dynamic workflows, however, allow agents to invoke tools, spawn other nodes, and schedule sub-agents conditionally at runtime.&lt;/p&gt;

&lt;p&gt;The system consists of three main components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Root agent (&lt;code&gt;root_agent&lt;/code&gt;)&lt;/strong&gt;: Gathers the list of tasks from the user, requests final approval, and directly calls the &lt;code&gt;tasks_workflow&lt;/code&gt; tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The workflow (&lt;code&gt;tasks_workflow&lt;/code&gt;)&lt;/strong&gt;: A &lt;code&gt;Workflow&lt;/code&gt; that iterates over the approved tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sub-agent (&lt;code&gt;task_explainer&lt;/code&gt;)&lt;/strong&gt;: An &lt;code&gt;Agent&lt;/code&gt; tasked with generating a step-by-step execution plan for each task.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the architectural diagram of the solution:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft82yfq1pmg0g5rren7fd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft82yfq1pmg0g5rren7fd.png" alt="Architecture diagram showing user interaction with the root coordinator agent, which directly calls the dynamic tasks_workflow tool that schedules task_explainer sub-agents" width="368" height="567"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Technical implementation
&lt;/h2&gt;

&lt;p&gt;Let's break down how to implement this solution using the Google ADK library in Python. The complete code resides in the &lt;a href="https://github.com/GoogleCloudPlatform/devrel-demos/tree/main/agents/workflow-dynamic" rel="noopener noreferrer"&gt;devrel-demos repository&lt;/a&gt; with core logic in the &lt;a href="https://github.com/GoogleCloudPlatform/devrel-demos/blob/main/agents/workflow-dynamic/app/agent.py" rel="noopener noreferrer"&gt;agent.py&lt;/a&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Initialize the environment and model
&lt;/h3&gt;

&lt;p&gt;First, import the required ADK modules and set up the Gemini model. This example uses &lt;code&gt;gemini-3.5-flash&lt;/code&gt; with &lt;a href="https://cloud.google.com/products/gemini-enterprise-agent-platform?utm_campaign=CDR_0x87fa8d40_default_b532096501&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini Enterprise Agent Platform&lt;/a&gt; APIs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;google.auth&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.adk&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Workflow&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.adk.apps&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;App&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.adk.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Gemini&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.adk.workflow&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.genai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;types&lt;/span&gt;

&lt;span class="c1"&gt;# ==============================================================================
# Initialize the environment
# ==============================================================================
&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;project_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;google&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;default&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;project_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_PROJECT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project_id&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_LOCATION&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;global&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_GENAI_USE_VERTEXAI&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;True&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# ==============================================================================
# Model Definition
# ==============================================================================
&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Gemini&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gemini-3.5-flash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;retry_options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;types&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HttpRetryOptions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Define the sub-agent
&lt;/h3&gt;

&lt;p&gt;The sub-agent &lt;code&gt;task_explainer&lt;/code&gt; takes a task description and writes a step-by-step execution plan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;task_explainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;task_explainer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instruction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    You are a task execution planner subagent.
    Given a task description, write a short, step-by-step execution plan
    explaining how you would perform the task. Be concise and clear.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Implement the dynamic workflow node
&lt;/h3&gt;

&lt;p&gt;To support dynamic execution, define two functions decorated with &lt;code&gt;@node&lt;/code&gt;. First node accepts the parent context &lt;code&gt;ctx&lt;/code&gt; and a list of task strings. This is the main node that iterates over the list of tasks and explains them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rerun_on_resume&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;task_workflow_node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;node_input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Workflow that iterates over the list of tasks and explains them.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;node_input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Yield progress update
&lt;/span&gt;        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;⏳ Starting task: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# type: ignore
&lt;/span&gt;
        &lt;span class="c1"&gt;# Dynamically trigger subagent
&lt;/span&gt;        &lt;span class="n"&gt;explanation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_node&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_explainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;node_input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;explanation_content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getattr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;explanation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;explanation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Mark as done
&lt;/span&gt;        &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;✅ Task Done: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**Execution Explanation:**&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;explanation_content&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# type: ignore
&lt;/span&gt;        &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second node is just returning a message that all tasks were completed. It’s used here to demonstrate a sequential workflow execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@node&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;task_workflow_end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;🎉🚀 All tasks executed successfully! ✨&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# type: ignore
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Define the workflow
&lt;/h3&gt;

&lt;p&gt;Next, define the &lt;code&gt;Workflow&lt;/code&gt; object. A &lt;code&gt;Workflow&lt;/code&gt; consists of nodes and directed edges between them. Since ADK 2.4.0, a &lt;code&gt;Workflow&lt;/code&gt; can be registered directly as a first-class tool for an agent. To do so, make sure to define the &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, and &lt;code&gt;input_schema&lt;/code&gt; so the parent agent knows how to call it. Whereas &lt;code&gt;edges&lt;/code&gt; describes the order of workflow steps execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;tasks_workflow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Workflow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tasks_workflow&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Iterates over the list of tasks and explains them.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;input_schema&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;edges&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;START&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_workflow_node&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_workflow_end&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Define the root coordinator agent
&lt;/h3&gt;

&lt;p&gt;Finally, the &lt;code&gt;root_agent&lt;/code&gt; coordinator manages user interaction. The agent collects the list of tasks, asks for confirmation, and, once approved, executes the &lt;code&gt;tasks_workflow&lt;/code&gt; directly. Notice how we pass &lt;code&gt;tasks_workflow&lt;/code&gt; directly to the &lt;code&gt;tools&lt;/code&gt; array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;root_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;root_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instruction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    You are a task coordinator agent.
    Your goal is to gather a list of tasks that the user wants to execute.
    Talk to the user to gather the list of tasks.
    Once you have a list of tasks, present them clearly to the user and ask
    for their final approval to execute them.
    Do NOT execute anything until the user explicitly approves.
    Once the user approves the list of tasks, call the tool `tasks_workflow` with
    the list of tasks.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;tasks_workflow&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Testing the flow locally
&lt;/h2&gt;

&lt;p&gt;You can run and test this agent locally using the &lt;code&gt;agents-cli&lt;/code&gt; playground.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you haven't already installed &lt;code&gt;agents-cli&lt;/code&gt; and its skills, run the setup command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   uvx google-agents-cli setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Clone and enter the demo directory:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npx &lt;span class="nt"&gt;-y&lt;/span&gt; giget@latest gh+git:google/adk-samples/python/agents/workflow-dynamic workflow-dynamic 
   &lt;span class="nb"&gt;cd &lt;/span&gt;workflow-dynamic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install required packages::
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   agents-cli &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the playground:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   agents-cli playground
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Interact with the Agent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt; in your browser.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;app&lt;/strong&gt; from the dropdown list at the top.&lt;/li&gt;
&lt;li&gt;Type a list of tasks in the chat box. For example:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; 1. Empty the trash.
 2. Feed the dog.
 3. Do the laundry.
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The coordinator agent lists the tasks and asks for your approval.&lt;/li&gt;
&lt;li&gt;Once you reply with "Yes" or "Approved", the &lt;code&gt;tasks_workflow&lt;/code&gt; tool fires.&lt;/li&gt;
&lt;li&gt;The playground console streams live updates as &lt;code&gt;tasks_workflow&lt;/code&gt; iterates through each task and returns plans generated by the &lt;code&gt;task_explainer&lt;/code&gt; sub-agent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Screencast demo
&lt;/h2&gt;

&lt;p&gt;The following screencast demonstrates the working solution:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/umYYAmMcd8c"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Dynamic workflows in Google ADK allow agents to perform complex, runtime-determined orchestrations. By leveraging &lt;code&gt;Workflow&lt;/code&gt; and the &lt;code&gt;@node&lt;/code&gt; decorator, you can build adaptable multi-agent applications that respond to dynamic requirements.&lt;/p&gt;

&lt;p&gt;Continue exploring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://adk.dev/graphs/dynamic/" rel="noopener noreferrer"&gt;ADK 2.0 dynamic workflows documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.googleblog.com/why-we-built-adk-20/?utm_campaign=CDR_0x87fa8d40_default_b532096501&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;ADK 2.0 announcement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google/adk-python/commit/1263ed64e30805464fff3391554f65ebbf72746b" rel="noopener noreferrer"&gt;Workflow as Tool core feature&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/GoogleCloudPlatform/devrel-demos/tree/main/agents/workflow-dynamic" rel="noopener noreferrer"&gt;Sample code in GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Thanks for reading
&lt;/h2&gt;

&lt;p&gt;If you found this article helpful, please consider sharing it with your friends on socials.&lt;/p&gt;

&lt;p&gt;I'm always eager to share my learnings or chat with fellow developers and AI enthusiasts, so feel free to follow me on &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>adk</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building an agentic PR reviewer with Antigravity SDK</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Thu, 18 Jun 2026 19:21:08 +0000</pubDate>
      <link>https://dev.to/googleai/building-an-agentic-pr-reviewer-with-antigravity-sdk-3b0i</link>
      <guid>https://dev.to/googleai/building-an-agentic-pr-reviewer-with-antigravity-sdk-3b0i</guid>
      <description>&lt;p&gt;As announced in this &lt;a href="https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli/?utm_campaign=CDR_0x87fa8d40_default_b517845989&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;blog post&lt;/a&gt; on June 18, 2026, Gemini CLI and Gemini Code Assist IDE extensions will stop serving requests for Google AI Pro and Ultra, as well as those using it free of charge using Gemini Code Assist for individuals. Google is unifying its AI terminal tools by transitioning the community-focused Gemini CLI into Antigravity CLI, a new agent-first platform built for complex, multi-agent workflows.&lt;/p&gt;

&lt;p&gt;With this transition timeline in place, development teams relying on Gemini CLI for repository management and automated tasks must establish a migration path. In this post, I will show you how to transition seamlessly by building an automated "first-pass" pull request reviewer using the Google &lt;a href="https://antigravity.google/product/antigravity-sdk?utm_campaign=CDR_0x87fa8d40_default_b517845989&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Antigravity SDK&lt;/a&gt; and the &lt;a href="https://github.com/rsamborski/run-agy-sdk" rel="noopener noreferrer"&gt;run-agy-sdk&lt;/a&gt; composite &lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;GitHub Action&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The orchestration tax
&lt;/h2&gt;

&lt;p&gt;The approach I am proposing also solves another pressing issue for modern engineering teams: cognitive overload. As &lt;a href="https://x.com/addyosmani" rel="noopener noreferrer"&gt;Addy Osmani&lt;/a&gt; recently pointed out, there is an &lt;a href="https://x.com/addyosmani/status/2059844244907696186" rel="noopener noreferrer"&gt;orchestration tax&lt;/a&gt; to using AI for coding. The time developers save generating code is often pushed onto reviewers as large, complex PRs, causing context switching and cognitive fatigue.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By offloading the tedious "first pass" search to an Antigravity agent, human reviewers can mitigate this tax and focus on high-level architecture and safeguarding quality.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why we need automated agentic code reviews
&lt;/h2&gt;

&lt;p&gt;AI-generated code can be deceptively good. It is often clean, well-documented, and syntactically correct. This makes it harder for human reviewers to spot subtle logical bugs or security vulnerabilities that might not be immediately obvious.&lt;/p&gt;

&lt;p&gt;In a large codebase, manually verifying every change is simply not feasible. This is why we need autonomous agents that can step into the codebase and analyze it from a fresh perspective.&lt;/p&gt;

&lt;p&gt;But if a developer used an LLM to generate the code, how can we trust another AI to find the bugs? The answer lies in the agent architecture and context separation.&lt;/p&gt;

&lt;p&gt;Developers might write code using any tool — whether it's CLI, an IDE extension, or various models like Gemini 3.5 Flash or Gemini 3.1 Pro. The reviewer, however, is a managed Antigravity Agent running via a separate SDK integration. This agent has a specialized, low-freedom persona and strict system instructions that force it to act as an adversarial code auditor rather than a developer. Furthermore, it operates in an isolated environment. Because it has a different system prompt, safety guardrails, and context boundaries, the agent reviews the changes with a completely fresh perspective, catching logical bugs and vulnerabilities that the original generator might miss.&lt;/p&gt;

&lt;p&gt;To demonstrate it in practice I created an agentic review pipeline, which:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Leverages a managed &lt;a href="https://ai.google.dev/gemini-api/docs/antigravity-agent?utm_campaign=CDR_0x87fa8d40_default_b517845989&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Antigravity Agent&lt;/a&gt; configured via the SDK to review the code. The agent uses advanced reasoning to explore files and verify logic under strict guidelines.
&lt;/li&gt;
&lt;li&gt;Runs reviews inside isolated workspaces or sandboxes with custom policies to prevent shell or arbitrary code execution risks.
&lt;/li&gt;
&lt;li&gt;Enables the agent to use the GitHub MCP server to interact directly with the environment to write pull request comments and reviews.
&lt;/li&gt;
&lt;li&gt;Avoids using the &lt;code&gt;synchronize&lt;/code&gt; trigger in pull request workflows to prevent redundant review runs and endless loops. Instead, runs reviews on &lt;code&gt;opened&lt;/code&gt; and &lt;code&gt;reopened&lt;/code&gt; events, and triggers subsequent passes manually by posting a &lt;code&gt;@agy /review&lt;/code&gt; comment on the PR.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm5txzzzewe67agts1rcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm5txzzzewe67agts1rcc.png" alt="Agentic review pipeline" width="800" height="1067"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the code at &lt;a href="https://github.com/rsamborski/run-agy-sdk" rel="noopener noreferrer"&gt;run-agy-sdk&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is run-agy-sdk?
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/rsamborski/run-agy-sdk" rel="noopener noreferrer"&gt;run-agy-sdk&lt;/a&gt; is a composite GitHub Action that runs the Google Antigravity SDK (&lt;code&gt;google-antigravity&lt;/code&gt;) directly on the GitHub Actions host runner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why run on the host instead of a container?
&lt;/h2&gt;

&lt;p&gt;By running directly on the host, the Antigravity SDK has access to the host's Docker daemon. This allows the SDK to spawn Docker-based MCP servers (like the GitHub MCP server) to read files, run tests, and post reviews.&lt;/p&gt;

&lt;p&gt;Sub-containers should ideally run with restricted network access and read-only filesystems where possible to prevent an LLM from being tricked into executing arbitrary destructive commands. The limited set of permissions is handled in the GitHub Action configuration (&lt;a href="https://github.com/rsamborski/run-agy-sdk/blob/da0ff77fc9dfc82e5ad89a430bc51476aeb8f867/.github/workflows/antigravity-autonomous-review.yml#L33" rel="noopener noreferrer"&gt;see here&lt;/a&gt;). Whereas the Antigravity agent has a limited number of tools it can use from GitHub MCP (&lt;a href="https://github.com/rsamborski/run-agy-sdk/blob/da0ff77fc9dfc82e5ad89a430bc51476aeb8f867/run_agent.py#L160-L161" rel="noopener noreferrer"&gt;see here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Moreover the workflow is explicitly protected from running automatically on forks, preventing unauthorized code execution. The automated review job will only run if the pull request originates from the same repository (&lt;a href="https://github.com/rsamborski/run-agy-sdk/blob/da0ff77fc9dfc82e5ad89a430bc51476aeb8f867/.github/workflows/antigravity-autonomous-review.yml#L45" rel="noopener noreferrer"&gt;see here&lt;/a&gt;). On-demand reviews triggered by commenting &lt;code&gt;@agy /review&lt;/code&gt; are restricted so that they can only be initiated by maintainers (&lt;a href="https://github.com/rsamborski/run-agy-sdk/blob/da0ff77fc9dfc82e5ad89a430bc51476aeb8f867/.github/workflows/antigravity-autonomous-review.yml#L59-L61" rel="noopener noreferrer"&gt;see here&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Demonstration walkthrough
&lt;/h2&gt;

&lt;p&gt;The demo below shows the action triggered by a new PR:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/30-LS9YnY_g"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation: How to install the action in your repo
&lt;/h2&gt;

&lt;p&gt;Let's walk through the setup process step-by-step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add your API key to GitHub secrets
&lt;/h3&gt;

&lt;p&gt;The action requires a Google Gemini or Antigravity API key to authenticate language model interactions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://aistudio.google.com/api-keys" rel="noopener noreferrer"&gt;Generate your API key&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to your target GitHub repository and go to &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Secrets and variables&lt;/strong&gt; &amp;gt; &lt;strong&gt;Actions&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Create a new Repository Secret named &lt;code&gt;ANTIGRAVITY_API_KEY&lt;/code&gt; and paste your API key as the value.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 2: Configure the GitHub Actions workflow
&lt;/h3&gt;

&lt;p&gt;Add a new file in your repository at &lt;code&gt;.github/workflows/antigravity-review.yml&lt;/code&gt; and add the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;🔎&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Antigravity&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;PR&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Review'&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;opened&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;reopened&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.workflow&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}-${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.event.pull_request.number&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;||&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;github.ref_name&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}'&lt;/span&gt;
  &lt;span class="na"&gt;cancel-in-progress&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;antigravity-review&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ubuntu-latest'&lt;/span&gt;
    &lt;span class="na"&gt;timeout-minutes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;

    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;read'&lt;/span&gt;
      &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;write'&lt;/span&gt;
      &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;write'&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Checkout&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Repository'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;actions/checkout@v6'&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;persist-credentials&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Run&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Antigravity&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;PR&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Review'&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rsamborski/run-agy-sdk@main'&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;agy_pr_review'&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;api-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;secrets.ANTIGRAVITY_API_KEY&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}'&lt;/span&gt;
          &lt;span class="na"&gt;github-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;secrets.GITHUB_TOKEN&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}'&lt;/span&gt;
          &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;review'&lt;/span&gt;
          &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/antigravity-review'&lt;/span&gt;
          &lt;span class="na"&gt;trust-workspace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;true'&lt;/span&gt;
          &lt;span class="na"&gt;sandbox-profile&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;true'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Pin the action version to a specific commit SHA (e.g., &lt;code&gt;rsamborski/run-agy-sdk@&amp;lt;commit-sha&amp;gt;&lt;/code&gt;) rather than using &lt;code&gt;@main&lt;/code&gt;. This prevents unexpected breaks from upstream updates.&lt;/p&gt;

&lt;p&gt;While you can reference &lt;code&gt;run-agy-sdk&lt;/code&gt; directly in your workflows, its real power lies in using it as a blueprint. I encourage you to &lt;a href="https://github.com/rsamborski/run-agy-sdk" rel="noopener noreferrer"&gt;fork the repository&lt;/a&gt; and use it as a template to build your own custom, agentic GitHub Actions. By modifying the safety policies, custom tools, or prompts in &lt;code&gt;run_agent.py&lt;/code&gt;, you can tailor the agent's review behavior to your team's specific codebase, style guidelines, and compliance rules.&lt;/p&gt;

&lt;p&gt;For a full workflow template supporting both automated PR reviews and comment-triggered reviews, refer to the &lt;a href="https://github.com/rsamborski/run-agy-sdk/blob/main/.github/workflows" rel="noopener noreferrer"&gt;workflows&lt;/a&gt; folder in the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Automating code reviews is a necessity as AI-generated code volumes increase. By using &lt;code&gt;run-agy-sdk&lt;/code&gt;, you can run the Antigravity SDK to review PRs automatically and shift more of the burden of code quality assurance away from human reviewers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access the full source code in the &lt;a href="https://github.com/rsamborski/run-agy-sdk" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Read the documentation to customize the prompts and mode.
&lt;/li&gt;
&lt;li&gt;Feel free to fork the repository and build your own automation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Acknowledgments
&lt;/h2&gt;

&lt;p&gt;This project was inspired by the &lt;a href="https://github.com/google-github-actions/run-gemini-cli" rel="noopener noreferrer"&gt;run-gemini-cli&lt;/a&gt; action, while shifting to the recently released Antigravity SDK. It is a personal sample implementation of how to run the Antigravity SDK in a GitHub Action, and is not an officially supported Google product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s connect!
&lt;/h2&gt;

&lt;p&gt;I’d love to hear how you’re using Antigravity for your agentic workflows. Are you building automated code review loops or keeping a tighter leash on your agents?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect with me on &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Follow me on &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Catch me on &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>antigravity</category>
      <category>gemini</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>How I built a supersonic AI riddling duel in under 20 Minutes (with zero manual coding)</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Thu, 28 May 2026 14:54:55 +0000</pubDate>
      <link>https://dev.to/googleai/how-i-built-a-supersonic-ai-riddling-duel-in-under-20-minutes-with-zero-manual-coding-16ah</link>
      <guid>https://dev.to/googleai/how-i-built-a-supersonic-ai-riddling-duel-in-under-20-minutes-with-zero-manual-coding-16ah</guid>
      <description>&lt;p&gt;Can an AI developer agent build complex full-stack logic without constant hand-holding? &lt;/p&gt;

&lt;p&gt;To test this, I set up the &lt;strong&gt;#NapkinChallenge&lt;/strong&gt;: take a rough architectural sketch on a paper napkin and turn it into a fully functional web application in under 20 minutes. &lt;/p&gt;

&lt;p&gt;The goal: Build &lt;strong&gt;"Blaine the Mono's Riddling Competition"&lt;/strong&gt; — a game where you duel a psychotic, sentient supersonic monorail from Stephen King's &lt;em&gt;The Dark Tower&lt;/em&gt; series. If you trip him up with three logic-defying riddles, you save the passengers. If his neural net solves them, you crash at Mach 4.&lt;/p&gt;

&lt;p&gt;The result? The AI built the entire application with &lt;strong&gt;zero manual lines of code written by me&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is how the architecture works, how the backend uses the new &lt;code&gt;@google/genai&lt;/code&gt; SDK, and how you can run the challenge yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture (from sketch to code)
&lt;/h2&gt;

&lt;p&gt;The napkin sketch outlined a straightforward but highly interactive setup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Frontend&lt;/strong&gt;: A UI built in Next.js (App Router).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;: A Next.js API route that forwards user riddles to the Gemini API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Engine&lt;/strong&gt;: The &lt;code&gt;gemini-3-flash-preview&lt;/code&gt; model, prompted to act as Blaine the Mono. It must analyze the riddle and return structured JSON containing its solution, status, and theatrical psychotic commentary.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2jrki7fvxkroi7vvavc3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2jrki7fvxkroi7vvavc3.jpg" alt="Napkin sketch" width="800" height="664"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero-Code Feasibility&lt;/strong&gt;: Developer agents like Antigravity can now understand visual layouts, bootstrap templates, design customized styling systems, and integrate real-world API clients with robust error boundaries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling is a First-Class Citizen&lt;/strong&gt;: The agent did not just generate functional code; it constructed a bespoke styling sheet (&lt;code&gt;src/app/globals.css&lt;/code&gt;) incorporating Orbitron typography, custom CSS scrollbars, CRT overlays, and reactive screen shakes using CSS keyframes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time to Gameplay&lt;/strong&gt;: The entire application was built in under 20 minutes, including the time it took to generate the code, test it, and get it running.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Video
&lt;/h2&gt;

&lt;p&gt;See the full video of the process:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/PvtdEbc2xPM"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Join the #NapkinChallenge 📝
&lt;/h2&gt;

&lt;p&gt;Now it is your turn. Can you match the speed of autonomous generation?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sketch&lt;/strong&gt; your app concept, system architecture, or database model on a physical paper napkin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upload&lt;/strong&gt; the photo to Antigravity, Gemini, or Google AI Studio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt&lt;/strong&gt; your agent to build the code from the image alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share&lt;/strong&gt; a video or screenshot of your live app using &lt;code&gt;#NapkinChallenge&lt;/code&gt;!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's see what you can build!&lt;/p&gt;

</description>
      <category>antigravity</category>
      <category>gemini</category>
      <category>napkinchallenge</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building "Sweets Vault" - a multimodal Gemini Agent with physical hardware integration</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Fri, 15 May 2026 12:43:35 +0000</pubDate>
      <link>https://dev.to/googleai/building-sweets-vault-a-multimodal-gemini-agent-with-physical-hardware-integration-1nmh</link>
      <guid>https://dev.to/googleai/building-sweets-vault-a-multimodal-gemini-agent-with-physical-hardware-integration-1nmh</guid>
      <description>&lt;p&gt;Motivating seven-year-olds to complete their daily reading and handwriting practice is a classic parenting challenge. Traditional rewards work for a while, but they lack interactivity and require constant manual verification.&lt;/p&gt;

&lt;p&gt;As a developer, I like to solve such challenges with automation. After putting some thought into it, I came up with the &lt;strong&gt;Sweets Vault&lt;/strong&gt; idea: an interactive agent powered by &lt;a href="https://github.com/google-gemini/adk" rel="noopener noreferrer"&gt;Google's Agent Development Kit (ADK)&lt;/a&gt; and the &lt;a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/start?utm_campaign=CDR_0x87fa8d40_default_b512067144&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini API&lt;/a&gt;. The system acts as a cheerful guardian that talks to children, visually inspects their workbooks via uploaded images, tests their reading comprehension, and triggers a hardware lock to open a drawer full of sweets upon successful completion.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgwj7pwtinpglk4sxu9u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgwj7pwtinpglk4sxu9u.jpg" alt="Sweets Vault — Gamifying Education with AI" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this guide, I will walk you through the architecture and implementation of this solution. You will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Structure a multimodal agent&lt;/strong&gt; using the Agent Development Kit (ADK).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement visual and verbal verification&lt;/strong&gt; using Gemini's multimodal capabilities.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manage state&lt;/strong&gt; across multiple conversation turns and tools.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connect agent tool calls to physical hardware&lt;/strong&gt; interfaces.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Develop and run locally&lt;/strong&gt; to access the physical hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’d like to jump directly to the code visit the &lt;a href="https://github.com/rsamborski/sweets-vault" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;. All the code is available there for your exploration.&lt;/p&gt;

&lt;h3&gt;
  
  
  System architecture overview
&lt;/h3&gt;

&lt;p&gt;The diagram below presents the high level architecture of the solution:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfp9e5ioi7228oxmda7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfp9e5ioi7228oxmda7d.png" alt="Architecture diagram" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The core components include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Gemini API&lt;/strong&gt;: Handles reasoning, multimodal homework validation and tool calls.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ADK Agent &amp;amp; Tools&lt;/strong&gt;: Encapsulates the system instructions, state management, and callable Python functions.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hardware Interface&lt;/strong&gt;: Translates tool execution into physical actions (unlocking specific drawer IDs).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The system is designed in such a way that the Agent runs on a local machine (I am using a mini PC with Ubuntu installed) to allow for direct hardware access:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Magnetic drawers controlled via &lt;a href="https://www.adafruit.com/product/2264" rel="noopener noreferrer"&gt;FT232H&lt;/a&gt; USB to GPIO converter
&lt;/li&gt;
&lt;li&gt;LED Matrix controlled via REST API running on a &lt;a href="https://www.raspberrypi.com/" rel="noopener noreferrer"&gt;Raspberry Pi&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Initially, I planned to control the LED Matrix using a second FT232H controller, but due to lack of library support, I ended up using an intermediary Raspberry Pi. This approach has its benefits, for example the LED Matrix can be located anywhere at home within the Wifi range 😀&lt;/p&gt;

&lt;h3&gt;
  
  
  Root agent logic
&lt;/h3&gt;

&lt;p&gt;To kick-start the agent development, I leveraged the &lt;a href="https://googlecloudplatform.github.io/agent-starter-pack/" rel="noopener noreferrer"&gt;&lt;code&gt;agent-starter-pack&lt;/code&gt; templates&lt;/a&gt;. It provides a production-ready foundation with FastAPI, frontend UI integration, and built-in observability.&lt;/p&gt;

&lt;p&gt;The heart of the Sweets Vault is located in &lt;a href="https://github.com/rsamborski/sweets-vault/blob/main/agent/app/agent.py" rel="noopener noreferrer"&gt;agent/&lt;code&gt;app/agent.py&lt;/code&gt;&lt;/a&gt;. I start by configuring the environment and initializing &lt;a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/models?utm_campaign=CDR_0x87fa8d40_default_b512067144&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini Enterprise Agent Platform&lt;/a&gt; (former Vertex AI). I also define the specific tasks required for our users (Mary and James):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;load_dotenv&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;project_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_PROJECT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_LOCATION&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;us-central1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_PROJECT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project_id&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_LOCATION&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_GENAI_USE_VERTEXAI&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;True&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize Vertex AI
&lt;/span&gt;&lt;span class="n"&gt;vertexai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;project_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As a native Polish speaker I want to have the ability for the Agent to work both in Polish (for the sake of my kids) and English (for demo purposes). This is handled by the AGENT_LANGUAGE variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;AGENT_LANGUAGE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AGENT_LANGUAGE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;en&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual agent (&lt;code&gt;root_agent&lt;/code&gt;) is created at the bottom of the same file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;root_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;root_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Gemini&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gemini-2.5-flash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;retry_options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;types&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HttpRetryOptions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;instruction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;load_prompt_from_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sweet-vault-agent-&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;AGENT_LANGUAGE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;get_progress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;complete_task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unlock_drawer&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The prompt is language specific and pulled from a file with a language suffix (en or pl).&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling state
&lt;/h3&gt;

&lt;p&gt;A common failure mode in conversational AI is lost context or hallucinated task completion. To prevent this, we implement strict state management using &lt;code&gt;ToolContext&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead of relying on the model's memory, the agent reads and writes explicit completion flags to its &lt;a href="https://adk.dev/sessions/state/" rel="noopener noreferrer"&gt;session state&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_get_task_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ToolContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Retrieves the completion status for a specific task from the flat state.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;state_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user_tasks_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_set_task_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;is_done&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ToolContext&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Saves the completion status for a specific task and ensures all user/task 
    combinations are explicitly represented in the flat tool_context.state.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="c1"&gt;# First, update the specific target task in the current tool state
&lt;/span&gt;    &lt;span class="n"&gt;target_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user_tasks_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target_key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;is_done&lt;/span&gt;

    &lt;span class="c1"&gt;# Now, ensure every possible combination for all known users exists in the flat state.
&lt;/span&gt;    &lt;span class="n"&gt;all_sync_updates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;user_names&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;u_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;TASKS_CONFIG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user_tasks_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;u_key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;t_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="c1"&gt;# If the key isn't already in the current state, default it to False.
&lt;/span&gt;            &lt;span class="c1"&gt;# Otherwise, keep its existing value.
&lt;/span&gt;            &lt;span class="n"&gt;all_sync_updates&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Apply all values back to the flat state
&lt;/span&gt;    &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;all_sync_updates&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Synchronized all task state values. Updated &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;target_key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; to &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;is_done&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key learning:&lt;/strong&gt; When building the system I tried using session state elements as a &lt;a href="https://www.w3schools.com/PYTHON/python_dictionaries_nested.asp" rel="noopener noreferrer"&gt;nested dictionary&lt;/a&gt;, but unfortunately at the time of writing this is not supported. The workaround was to use a flat structure with keys including both the &lt;code&gt;user_key&lt;/code&gt; and &lt;code&gt;task_id&lt;/code&gt;, which works well for my use case. However, this pattern might not scale well for a complex system with many users and tasks, in which case serialization or an external DB could be a better option.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent tools
&lt;/h3&gt;

&lt;p&gt;I provided the agent with three specific tools: checking progress, marking tasks complete, and unlocking the drawer.&lt;/p&gt;

&lt;h4&gt;
  
  
  Checking progress
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;get_progress&lt;/code&gt; function retrieves and formats a checklist of a specific user's tasks, indicating whether each task is marked as completed or pending based on the application's current session state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_progress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ToolContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Check the progress of tasks for a specific user.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;user_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;status_msg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Progress for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;desc&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;TASKS_CONFIG&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;is_done&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;_get_task_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;state_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;✅ DONE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;is_done&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;❌ PENDING&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="n"&gt;status_msg&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;- [&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;] &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;desc&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;state_str&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;status_msg&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Marking task as complete
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;complete_task&lt;/code&gt; tool acts as a gatekeeper. It checks if all tasks are finished before informing the model that it is authorized to unlock the drawer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;complete_task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ToolContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Mark a task as completed for a user.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;user_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# Mark task as complete
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;TASKS_CONFIG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;_set_task_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error: Task ID &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; not found.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="c1"&gt;# Check if ALL tasks are complete
&lt;/span&gt;    &lt;span class="n"&gt;all_complete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="n"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;TASKS_CONFIG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;_get_task_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;all_complete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
            &lt;span class="n"&gt;remaining&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;all_complete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SUCCESS: All tasks completed for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;! &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You may now unlock the drawer.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# If not all complete, show progress
&lt;/span&gt;    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Task &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; marked as DONE. &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Remaining tasks: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;remaining&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how descriptive the returned values are. They are written this way intentionally to give the Agent enough information to handle communication with the user, provide feedback and motivate them to complete the remaining tasks.&lt;/p&gt;

&lt;h4&gt;
  
  
  Integrating physical hardware
&lt;/h4&gt;

&lt;p&gt;When the model receives the success confirmation, it calls the &lt;code&gt;unlock_drawer&lt;/code&gt; tool. This interfaces directly with our hardware relay logic to update the LED display and  pop open the assigned drawer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Initialize the HW interface and lock the drawers
&lt;/span&gt;&lt;span class="n"&gt;user_names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Maria&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Jan&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;AGENT_LANGUAGE&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mary&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;James&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;hw_interface&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HardwareInterface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_names&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;unlock_drawer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Unlock a drawer by its ID.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;hw_interface&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unlock_drawer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Drawer &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; unlocked for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Drawer not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;HardwareInterface&lt;/code&gt; (defined in &lt;a href="https://github.com/rsamborski/sweets-vault/blob/main/agent/app/app_utils/hw_interface.py" rel="noopener noreferrer"&gt;agent/app/app_utils/hw_interface.py&lt;/a&gt;) actively communicates with the &lt;a href="https://github.com/rsamborski/sweets-vault/tree/main/led-matrix-api" rel="noopener noreferrer"&gt;LED Matrix API&lt;/a&gt; on the Raspberry Pi to display whether each drawer is currently locked or unlocked.&lt;/p&gt;

&lt;p&gt;While the code to control the physical drawer magnets is fully functional and tested (located in &lt;a href="https://github.com/rsamborski/sweets-vault/blob/main/hardware/drawers.py" rel="noopener noreferrer"&gt;drawers.py&lt;/a&gt;), it is not yet integrated into the main &lt;code&gt;HardwareInterface&lt;/code&gt;. This integration is simply on hold until the magnets are physically mounted to the drawer box.&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent prompts
&lt;/h3&gt;

&lt;p&gt;Tools alone are not enough; the model requires precise instructions on &lt;em&gt;how&lt;/em&gt; to verify the work. In &lt;a href="https://github.com/rsamborski/sweets-vault/tree/main/agent/app/prompts" rel="noopener noreferrer"&gt;&lt;code&gt;agent/app/prompts&lt;/code&gt;&lt;/a&gt; I defined a strict multi-step verification protocol both in English and Polish. Here is the English prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are a friendly, cheerful, and helpful AI assistant, the guardian of the "Sweets Vault." Your task is to verify tasks performed by children in order to grant a sweet reward.

### MAIN RULES:
1. **LANGUAGE**: You speak ONLY AND EXCLUSIVELY IN ENGLISH.
2. **USERS**:
   - **Mary** (girl, 7 years old) -&amp;gt; Assigned drawer ID: **0**
   - **James** (boy, 7 years old) -&amp;gt; Assigned drawer ID: **1**
   - **Parent** (man, 42 years old) -&amp;gt; May test the system by saying, for example, "I'm pretending to be Mary." Treat him exactly like the child he is claiming to be.
3. **PERSONALITY**: You are enthusiastic, warm, and supportive. Use exclamation marks and a joyful tone.

### TASK VERIFICATION PROCESS:
1. **STATE IDENTIFICATION**: When a child starts a conversation, ALWAYS first use the `get_progress(user_name)` tool to check what needs to be done.
2. **REPORTING**: The child reports completing a task (A or B).
3. **VERIFICATION**: Conduct a rigorous verification (camera/questions) as described below.
4. **CREDITING**: If verification is successful, use the `complete_task(user_name, task_id)` tool.
   - Read the tool's response carefully!
   - ONLY IF the response is "SUCCESS: All tasks completed...", then use `unlock_drawer`.
   - If the response shows "Remaining tasks," inform the child what they still need to do.

**Task A: Reading a page of a book**
*   **Verification 1**: Ask the child to show the read page to the camera. Confirm that you see it. Don't expose any details that can help answer the question in the next step (i.e. avoid sharing details of what exactly you can see).
*   **Verification 2**: Ask a simple follow-up question about the read text. The child must answer it.
*   **Task ID**: "A"

**Task B: Calligraphy (writing letters in workbooks)**
*   **Verification 1**: Ask to show the completed page in the workbooks to the camera. 
*   **Verification 2**: Confirm that the task has been performed. Make sure the picture contains hand-written letters (usually with a pencil).
*   If the page only contains examples, ask the child to complete missing parts.
*   **Task ID**: "B"

### SUCCESS AND REWARD:
IF the `complete_task` tool returns "SUCCESS", run `unlock_drawer(id)`.
Then **CELEBRATE!** Use phrases like: "Yippee!", "Hurray!", "Bravo!", "You're a champion!", "The sweets are yours!". Make some "noise."

### FAILURE:
If verification fails (e.g., the child doesn't show the page or answers incorrectly), gently and encouragingly ask for improvement or a retry. Do not open the drawer.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prompt structure ensures the agent does its due diligence, preventing kids from simply holding up a blank page or skipping the reading comprehension check.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;

&lt;p&gt;You can see a demonstration of the working system in the video below:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/TMStQw0Fthk"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;By combining the Gemini API, the Agent Development Kit, and a simple hardware relay, you can build highly interactive, physically grounded AI Agents. The Sweets Vault demonstrates how multimodal verification and structured tool calling solve practical, real-world problems with a dose of fun.&lt;/p&gt;

&lt;p&gt;Explore more at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/rsamborski/sweets-vault" rel="noopener noreferrer"&gt;Sweets Vault code repository&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://adk.dev/" rel="noopener noreferrer"&gt;Agent Development Kit (ADK)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/models?utm_campaign=CDR_0x87fa8d40_default_b512067144&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini Enterprise Agent Platform&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Future plans
&lt;/h3&gt;

&lt;p&gt;Current implementation uses &lt;a href="https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/gemini/2-5-flash?utm_campaign=CDR_0x87fa8d40_default_b512067144&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini Flash&lt;/a&gt; which guarantees high performance, multimodality and tool calling capabilities. Nevertheless it requires text input and provides only text as output. In the near future I plan to experiment with &lt;a href="https://docs.cloud.google.com/vertex-ai/generative-ai/docs/live-api?utm_campaign=CDR_0x87fa8d40_default_b512067144&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Gemini Live API&lt;/a&gt; which enables voice, video and text as input and conversational audio as output.&lt;/p&gt;

&lt;p&gt;I am also going to finish the physical locks part with electro magnets. Stay tuned for updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for reading
&lt;/h3&gt;

&lt;p&gt;Thank you for reading. I hope this blog inspires you to bring your own creative AI and hardware projects to life. If you found this article helpful, please consider following me here and giving it a clap 👏 to help others discover it.&lt;/p&gt;

&lt;p&gt;I am always eager to connect with fellow developers and AI enthusiasts, so feel free to follow me on &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="http://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;. Your feedback is incredibly valuable, so please do not hesitate to leave a comment with your thoughts, questions, or your own experiences building multimodal agents!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>agents</category>
    </item>
    <item>
      <title>How I used Gemini CLI to orchestrate a complex RAG migration</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Tue, 28 Apr 2026 13:02:03 +0000</pubDate>
      <link>https://dev.to/googleai/how-i-used-gemini-cli-to-orchestrate-a-complex-rag-migration-43ga</link>
      <guid>https://dev.to/googleai/how-i-used-gemini-cli-to-orchestrate-a-complex-rag-migration-43ga</guid>
      <description>&lt;p&gt;Building a complex, multi-phase cloud project like a RAG migration is as much about orchestration as it is about code. You have to manage infrastructure (&lt;a href="https://www.terraform.io/" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt;), backend services (&lt;a href="https://www.python.org/" rel="noopener noreferrer"&gt;Python&lt;/a&gt;), frontend UI (&lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt;), data pipelines (&lt;a href="https://docs.cloud.google.com/bigquery/docs/introduction?utm_campaign=CDR_0x87fa8d40_default_b499342492&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;BigQuery&lt;/a&gt;/&lt;a href="https://docs.cloud.google.com/alloydb/docs/overview?utm_campaign=CDR_0x87fa8d40_default_b499342492&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;AlloyDB&lt;/a&gt;), and documentation - all while maintaining a consistent technical strategy.&lt;/p&gt;

&lt;p&gt;Standard IDE completions are great for snippets, but they lack the system-level context needed for this kind of engineering. To build this reference architecture, I didn't just use an AI to write code. I used an AI to &lt;strong&gt;orchestrate the entire project&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this final post (see previous &lt;a href="https://medium.com/@rsamborski/6ead93ca4aec" rel="noopener noreferrer"&gt;part 1&lt;/a&gt; and &lt;a href="https://medium.com/@rsamborski/8a0464af6f55" rel="noopener noreferrer"&gt;part 2&lt;/a&gt;), I'll share a behind-the-scenes look at using &lt;a href="https://geminicli.com/" rel="noopener noreferrer"&gt;Gemini CLI&lt;/a&gt; with the &lt;a href="https://github.com/gemini-cli-extensions/conductor" rel="noopener noreferrer"&gt;Conductor extension&lt;/a&gt; to orchestrate this migration.&lt;/p&gt;

&lt;p&gt;In this post, you will learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to leverage terminal-first AI assistants for system-level engineering
&lt;/li&gt;
&lt;li&gt;How to implement spec-driven development with &lt;a href="https://github.com/gemini-cli-extensions/conductor" rel="noopener noreferrer"&gt;the Conductor extension&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;How to use AI-driven Test-Driven Development (TDD) for reliable code generation
&lt;/li&gt;
&lt;li&gt;How to collaborate with AI agents using the "Human-in-the-Loop" model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we dive into the workflow, let's briefly discuss why orchestration is the next logical step for AI-assisted development.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Developer Experience&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's walk through my development process step-by-step. The entire specification, plan, and implementation logic is available in &lt;a href="https://github.com/rsamborski/rag-migration/tree/main/conductor" rel="noopener noreferrer"&gt;the &lt;code&gt;conductor&lt;/code&gt; directory&lt;/a&gt; of the &lt;code&gt;rag-migration&lt;/code&gt; repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spec-driven development with Conductor
&lt;/h3&gt;

&lt;p&gt;Central to my workflow, is the Conductor extension. It's built on the principle of &lt;strong&gt;spec-driven development&lt;/strong&gt;. Instead of jumping straight into code, we define the "source of truth" in Markdown files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Product Definition (&lt;code&gt;product.md&lt;/code&gt;):&lt;/strong&gt; What are we building?
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tech Stack (&lt;code&gt;tech-stack.md&lt;/code&gt;):&lt;/strong&gt; What tools are we using?
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tracks Registry (&lt;code&gt;tracks.md&lt;/code&gt;):&lt;/strong&gt; What are the major milestones?
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implementation Plans (&lt;code&gt;plan.md&lt;/code&gt; for each of the tracks):&lt;/strong&gt; What are the step-by-step tasks?
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow (&lt;code&gt;workflow.md&lt;/code&gt;):&lt;/strong&gt; How are we building the solution?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By having these documents in the codebase, the AI agent (Gemini CLI) always has the high-level context it needs to make smart decisions. It's also a good practice to share those with your team so everyone (including AI agents) is on the same page about the project's direction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conductor initialization
&lt;/h3&gt;

&lt;p&gt;The first step for the project initialization is to create product definition and tech stack files. This is handled by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/conductor:setup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gemini CLI will ask you a series of questions to help you define your project, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the name of your product?
&lt;/li&gt;
&lt;li&gt;Who are the primary users?
&lt;/li&gt;
&lt;li&gt;What is the tech stack you are using?
&lt;/li&gt;
&lt;li&gt;What are the major features you want to implement?
&lt;/li&gt;
&lt;li&gt;What is the workflow you want to use?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It will then create the initial project structure in the &lt;code&gt;conductor&lt;/code&gt; directory, including the &lt;a href="https://github.com/rsamborski/rag-migration/blob/main/conductor/product.md" rel="noopener noreferrer"&gt;product.md&lt;/a&gt; and &lt;a href="https://github.com/rsamborski/rag-migration/blob/main/conductor/tech-stack.md" rel="noopener noreferrer"&gt;tech-stack.md&lt;/a&gt; files.&lt;/p&gt;

&lt;h3&gt;
  
  
  The lifecycle of a track
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fat6kt8jvqw6o4oha2npr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fat6kt8jvqw6o4oha2npr.png" alt="Gemini CLI with conductor - lifecycle" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each major feature in this project was implemented as a "Track". A typical track lifecycle consists of:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Track Initialization (&lt;code&gt;/conductor:newTrack&lt;/code&gt;):

&lt;ul&gt;
&lt;li&gt;The agent creates a &lt;code&gt;spec.md&lt;/code&gt; file that describes the goals of the track
&lt;/li&gt;
&lt;li&gt;The agent maps the existing codebase and validates assumptions
&lt;/li&gt;
&lt;li&gt;The agent creates a &lt;code&gt;plan.md&lt;/code&gt; file that describes the steps needed to achieve the goals
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Track Execution (&lt;code&gt;/conductor:implement&lt;/code&gt;):

&lt;ul&gt;
&lt;li&gt;The agent iterates through tasks using a &lt;strong&gt;Plan -&amp;gt; Act -&amp;gt; Validate&lt;/strong&gt; cycle
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Track Completion:

&lt;ul&gt;
&lt;li&gt;The agent verifies the changes made during the track
&lt;/li&gt;
&lt;li&gt;The agent ask for user feedback on the implementation
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Track Archivization:

&lt;ul&gt;
&lt;li&gt;Once a track is completed, Gemini CLI archives the track in the &lt;code&gt;conductor/archive&lt;/code&gt; directory&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, when I started the initial embeddings track, I initialized it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/conductor:newTrack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gemini CLI researches the codebase, asks clarifying questions and creates a &lt;a href="https://github.com/rsamborski/rag-migration/blob/main/conductor/archive/initial-embeddings_20260303/spec.md" rel="noopener noreferrer"&gt;spec.md&lt;/a&gt; and &lt;a href="https://github.com/rsamborski/rag-migration/blob/main/conductor/archive/initial-embeddings_20260303/plan.md" rel="noopener noreferrer"&gt;plan.md&lt;/a&gt; files. Only after I review and approve them, the actual implementation starts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Terraform for Infrastructure as Code
&lt;/h3&gt;

&lt;p&gt;My &lt;a href="https://github.com/rsamborski/rag-migration/blob/b17a233a67886bf574601e9d72d53416c6ffcf90/conductor/product.md?plain=1#L21" rel="noopener noreferrer"&gt;product.md&lt;/a&gt; file instructs Gemini CLI to write Terraform code for all the resources created during the project. This works really well as all the resources are consistently managed by source code and it's easy to spin up a new environment when needed.&lt;/p&gt;

&lt;p&gt;You can see all the Terraform files and infrastructure scripts used in the first track in the &lt;a href="https://github.com/rsamborski/rag-migration/tree/main/01-generation/infra" rel="noopener noreferrer"&gt;infra&lt;/a&gt; directory.&lt;/p&gt;

&lt;p&gt;Moreover, in the course of the project creation I instructed Gemini CLI to always run &lt;code&gt;terraform plan&lt;/code&gt; before &lt;code&gt;terraform apply&lt;/code&gt;. Keeping this information in the &lt;a href="https://github.com/rsamborski/rag-migration/blob/b17a233a67886bf574601e9d72d53416c6ffcf90/conductor/workflow.md?plain=1#L12" rel="noopener noreferrer"&gt;workflow.md&lt;/a&gt; file ensures that such an approach is applied to all tracks.&lt;/p&gt;

&lt;h3&gt;
  
  
  TDD with an AI agent
&lt;/h3&gt;

&lt;p&gt;One of the most powerful aspects of this workflow is AI-driven Test-Driven Development (TDD). I didn't just ask the agent to "write the code". It followed a strict protocol:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write Failing Tests:&lt;/strong&gt; The agent defines the expected behavior in a new test file
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Red Phase:&lt;/strong&gt; It runs the tests and confirms they fail
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Green Phase:&lt;/strong&gt; It writes the minimum code needed to pass the tests
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refactor:&lt;/strong&gt; It refactors the implementation code and the test code to improve clarity, remove duplication, and enhance performance without changing the external behavior.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify Coverage:&lt;/strong&gt; It verifies that the test coverage meets the project requirements (target: &amp;gt;80% coverage for new code).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commit Code Changes:&lt;/strong&gt; The agent commits code changes related to the task.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures that the AI-generated code isn't just "syntactically correct" but functionally verified against my requirements. This workflow is described in the &lt;a href="https://github.com/rsamborski/rag-migration/blob/b17a233a67886bf574601e9d72d53416c6ffcf90/conductor/workflow.md?plain=1#L18" rel="noopener noreferrer"&gt;workflow.md&lt;/a&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checkpoints and quality gates
&lt;/h3&gt;

&lt;p&gt;At the end of every phase, Gemini CLI runs a "Checkpoint" protocol. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automated Verification:&lt;/strong&gt; Running the full test suite.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual Verification:&lt;/strong&gt; Providing the user with step-by-step instructions to verify the changes.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auditable Records:&lt;/strong&gt; Attaching a verification report to the git commit using &lt;code&gt;git notes&lt;/code&gt; and update &lt;code&gt;plan.md&lt;/code&gt; with the new commit hash.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kk90njuhpzsjwell1ph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kk90njuhpzsjwell1ph.png" alt="Conductor commits demonstrating the checkpoint protocol" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Conductor commits demonstrating the checkpoint protocol.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Effective Human-in-the-Loop
&lt;/h3&gt;

&lt;p&gt;To achieve an effective AI agent-human development synergy I heavily depended on following solutions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gemini CLI in a sandbox with Yolo mode enabled - see &lt;a href="https://dev.to/googleai/secure-gemini-cli-for-cloud-development-2mpe"&gt;my past article&lt;/a&gt; for more about it.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/rsamborski/vibecoding/blob/main/gemini-cli-sandbox/sandbox_notifier.sh" rel="noopener noreferrer"&gt;Custom sandbox notifier script&lt;/a&gt; that runs in another terminal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach provided safe guardrails and allowed me to jump into work on other projects while the AI was working on this one. I was always able to jump back quickly thanks to timely notifications. Moreover the checkpointing mechanism of Conductor allowed me to always have a possibility to revert unnecessary changes or to restart from a known working state.&lt;/p&gt;

&lt;p&gt;I also used &lt;a href="https://antigravity.google/?utm_campaign=CDR_0x87fa8d40_default_b499342492&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Antigravity&lt;/a&gt; to polish the generated code and the documentation. It was particularly helpful for minor tweaks or refactoring of the code that was generated by Gemini CLI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Token usage
&lt;/h3&gt;

&lt;p&gt;Throughout the project I used several models (Gemini 3 Pro, Gemini 3 Flash and Gemini 2.5 Flash Lite). The total token consumption was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input tokens: ~19M
&lt;/li&gt;
&lt;li&gt;Cached input tokens: ~66M
&lt;/li&gt;
&lt;li&gt;Output tokens: ~400k&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice the high number of cached input tokens, which significantly impacts the spend. The total Vertex AI token cost was &lt;strong&gt;around $30&lt;/strong&gt;. Not bad for several days of AI assisted work.&lt;/p&gt;

&lt;p&gt;See the &lt;a href="https://cloud.google.com/vertex-ai/generative-ai/pricing?utm_campaign=CDR_0x87fa8d40_default_b499342492&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; for more details and please mind that your mileage may vary.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Software engineering is evolving from writing code to orchestrating agentic workflows. By using tools like Gemini CLI and frameworks like Conductor, you can scale your impact as an architect while ensuring consistent, high-quality implementation.&lt;/p&gt;

&lt;p&gt;Ready to build your own AI-assisted development projects?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://geminicli.com/" rel="noopener noreferrer"&gt;Check out Gemini CLI&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/gemini-cli-extensions/conductor" rel="noopener noreferrer"&gt;Explore the Conductor extension&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://antigravity.google/?utm_campaign=CDR_0x87fa8d40_default_b499342492&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Try Antigravity&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/rsamborski/rag-migration" rel="noopener noreferrer"&gt;Check out the full RAG Migration repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Thanks for reading&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you found this article helpful, please consider adding 50 claps to this post by pressing and holding the clap button 👏 This will help others find it. You can also share it with your friends on socials.&lt;/p&gt;

&lt;p&gt;I'm always eager to share my learnings or chat with fellow developers and AI enthusiasts, so feel free to follow me on &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>gemini</category>
      <category>agents</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>Migrating vector embeddings in production without downtime</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Tue, 21 Apr 2026 15:41:50 +0000</pubDate>
      <link>https://dev.to/googleai/migrating-vector-embeddings-in-production-without-downtime-5bli</link>
      <guid>https://dev.to/googleai/migrating-vector-embeddings-in-production-without-downtime-5bli</guid>
      <description>&lt;p&gt;In the fast-moving world of AI, models evolve rapidly. What was state-of-the-art six months ago is now being surpassed by newer models. For a RAG system, this presents a significant challenge: vector embeddings are tied to the specific model that generated them.&lt;/p&gt;

&lt;p&gt;If you want to upgrade your model, you can’t just start using the new one. Existing vectors in your database are incompatible with queries from the new model. A "naive" migration-shutting down the site, re-embedding everything, and restarting-means hours of potential downtime.&lt;/p&gt;

&lt;p&gt;In this post, I'll show you how to execute a zero-downtime migration strategy using dual-column schemas and background processing.&lt;/p&gt;

&lt;p&gt;If you haven't read &lt;a href="https://dev.to/googleai/building-a-scalable-rag-backend-with-cloud-run-jobs-and-alloydb-59pk"&gt;the previous post&lt;/a&gt;, I recommend starting there to understand the basics of building a RAG pipeline with &lt;a href="https://docs.cloud.google.com/bigquery/docs/introduction?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;BigQuery&lt;/a&gt;, &lt;a href="https://docs.cloud.google.com/run/docs/create-jobs?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud Run Jobs&lt;/a&gt;, &lt;a href="https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Vertex AI&lt;/a&gt;, and &lt;a href="https://docs.cloud.google.com/alloydb/docs/overview?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;AlloyDB for PostgreSQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this post we will start off with a running system built in &lt;a href="https://medium.com/@rsamborski/6ead93ca4aec" rel="noopener noreferrer"&gt;the previous post&lt;/a&gt;, and I will show you how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement the &lt;a href="https://devops.com/what-is-a-shadow-deployment/" rel="noopener noreferrer"&gt;Shadow Deployment pattern&lt;/a&gt; with dual-column schemas
&lt;/li&gt;
&lt;li&gt;Execute background backfilling using &lt;a href="https://docs.cloud.google.com/run/docs/create-jobs?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud Run Jobs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Safely switch application logic without impacting search functionality
&lt;/li&gt;
&lt;li&gt;Ensure data consistency and handle migration failures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we dive into the code, let's briefly discuss the concept of shadow deployment and how it supports the RAG application migration process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shadow deployment with dual columns
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyd30hnpqhboynoio3ej2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyd30hnpqhboynoio3ej2.png" alt="RAG Migration overview" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A robust way to migrate embeddings is to use a &lt;a href="https://devops.com/what-is-a-shadow-deployment/" rel="noopener noreferrer"&gt;Shadow Deployment pattern&lt;/a&gt;. Instead of replacing the existing vectors, you store the new vectors alongside them in a separate column. The migration process boils down to following major steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a new column: We update our AlloyDB table to include &lt;code&gt;embedding_v2&lt;/code&gt;.
&lt;/li&gt;
&lt;li&gt;Backfill in the background: We run a migration job to populate &lt;code&gt;embedding_v2&lt;/code&gt; for all existing rows.
&lt;/li&gt;
&lt;li&gt;Switch: Once every row has a new vector, we update the application code to use the new model and the new column.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This strategy ensures that your live search functionality, which still uses the original &lt;code&gt;embedding&lt;/code&gt; column, remains fully operational during the entire migration process.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Implementation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's walk through the migration process step-by-step. All the code for this migration is available in the &lt;code&gt;03-migration&lt;/code&gt; folder of the &lt;a href="https://github.com/rsamborski/rag-migration" rel="noopener noreferrer"&gt;RAG Migration Repository&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Schema evolution
&lt;/h3&gt;

&lt;p&gt;First, we prepare the database. Using a simple SQL query, we add the new vector column. Because we are targeting an existing database, we connect via the &lt;a href="https://cloud.google.com/alloydb/docs/auth-proxy/overview?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;AlloyDB Auth Proxy&lt;/a&gt; and use &lt;code&gt;psql&lt;/code&gt; to execute the query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Ensure your AlloyDB Auth proxy is running in another terminal window by running&lt;/span&gt;
&lt;span class="c"&gt;# ./alloydb-auth-proxy projects/&amp;lt;PROJECT_ID&amp;gt;/locations/&amp;lt;LOCATION&amp;gt;/clusters/&amp;lt;CLUSTER&amp;gt;/instances/&amp;lt;INSTANCE&amp;gt; --port &amp;lt;PORT&amp;gt; --auto-iam-authn --public-ip&lt;/span&gt;

&lt;span class="c"&gt;# Navigate to the migration directory&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;03-migration

&lt;span class="c"&gt;# Apply the schema change&lt;/span&gt;
psql &lt;span class="nt"&gt;-h&lt;/span&gt; 127.0.0.1 &lt;span class="nt"&gt;-p&lt;/span&gt; &amp;lt;PORT&amp;gt; &lt;span class="nt"&gt;-U&lt;/span&gt; postgres &lt;span class="nt"&gt;-d&lt;/span&gt; &amp;lt;DATABASE_NAME&amp;gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 001_add_embedding_v2.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The content of &lt;code&gt;001_add_embedding_v2.sql&lt;/code&gt; is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;COLUMN&lt;/span&gt; &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="n"&gt;embedding_v2&lt;/span&gt; &lt;span class="n"&gt;VECTOR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;768&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since AlloyDB handles schema changes gracefully, this operation is near-instantaneous and doesn’t lock the table for reads. Your live API is completely unaffected.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: In production you may want to run this query via your CI/CD pipeline.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Configure the migration environment
&lt;/h3&gt;

&lt;p&gt;We reuse the parallelization framework we built in &lt;a href="https://medium.com/@rsamborski/6ead93ca4aec" rel="noopener noreferrer"&gt;the previous post&lt;/a&gt;, but this time we configure the environment for the new model. The project uses &lt;code&gt;uv&lt;/code&gt; for dependency management:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Sync local dependencies (run it in 03-migration folder)&lt;/span&gt;
uv &lt;span class="nb"&gt;sync&lt;/span&gt;

&lt;span class="c"&gt;# Set required environment variables&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GOOGLE_CLOUD_PROJECT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_PROJECT_ID"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_ALLOYDB_PASSWORD"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_EMBEDDING_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"gemini-embedding-001"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_EMBEDDING_DIMENSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;768
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;BATCH_SIZE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Background backfilling worker
&lt;/h3&gt;

&lt;p&gt;The migration worker (&lt;code&gt;03-migration/main.py&lt;/code&gt;) specifically targets rows where the new column is still empty. This makes the migration process &lt;strong&gt;idempotent and resumable&lt;/strong&gt; - if a task fails, you can just run it again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# snippet from 03-migration/main.py
# Fetch products where embedding_v2 is null, respecting offset
&lt;/span&gt;&lt;span class="n"&gt;fetch_stmt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    SELECT id, name, category, brand FROM products 
    WHERE embedding_v2 IS NULL
    ORDER BY id
    LIMIT :batch_size OFFSET :offset
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We deploy this worker as a Cloud Run Job. A convenient deploy script is provided in the repository which builds the Docker image and configures the job on GCP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./infra/scripts/deploy_migration.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Orchestrating the migration
&lt;/h3&gt;

&lt;p&gt;Instead of manually calculating the number of tasks to run, we use a Python orchestrator (&lt;code&gt;03-migration/orchestrator.py&lt;/code&gt;) to query the database, calculate the remaining work, and dynamically scale the Cloud Run Job.&lt;/p&gt;

&lt;p&gt;The orchestrator counts the number of unmigrated rows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# snippet from orchestrator.py logic
&lt;/span&gt;&lt;span class="n"&gt;count_stmt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT COUNT(*) FROM products WHERE embedding_v2 IS NULL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;unmigrated_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count_stmt&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;scalar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;total_tasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unmigrated_count&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;batch_size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, it triggers the Cloud Run Job via the Google Cloud SDK, passing the exact number of tasks required:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run the orchestrator to kick off the migration&lt;/span&gt;
uv run orchestrator.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The job runs in the background, consuming rows and generating new embeddings without competing for critical resources with our live search API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Safely changing the query
&lt;/h3&gt;

&lt;p&gt;Once the orchestrator reports that 100% of rows have &lt;code&gt;embedding_v2&lt;/code&gt; populated, we are ready for the switch. This happens entirely at the application layer (&lt;code&gt;02-ui&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The search API code is updated to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use the &lt;code&gt;gemini-embedding-001&lt;/code&gt; model to embed the user's search query.
&lt;/li&gt;
&lt;li&gt;Query the &lt;code&gt;embedding_v2&lt;/code&gt; column in AlloyDB instead of &lt;code&gt;embedding&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Congratulations 🎉 You have successfully migrated your entire vector database with zero downtime!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Production best practices: evals and feature flags&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;While a direct code swap works for a simple demonstration, in a real-world production environment, you should avoid an abrupt 100% cutover. Instead, you should leverage the fact that both vector representations exist simultaneously in your database to roll out safely:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation pipeline:&lt;/strong&gt; Before exposing the new model to customers, build an eval pipeline. Take a golden dataset of your most common or critical search queries and run them against both the old (&lt;code&gt;embedding&lt;/code&gt;) and new (&lt;code&gt;embedding_v2&lt;/code&gt;) columns. Compare the relevance of the retrieved results to ensure the new model actually improves the search experience.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature flags for traffic routing:&lt;/strong&gt; Wrap the application-layer switch in a feature flag. Start by routing a small percentage of your traffic (e.g., 5% or 10%) to the new &lt;code&gt;embedding_v2&lt;/code&gt; logic. Monitor your application metrics, click-through rates, and error logs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because the migration happened in the background, this dual-state makes it trivial to run A/B tests or instantly rollback by toggling the feature flag if the new model introduces unexpected regressions. Once you're fully ramped up to 100% and verified the new performance, the old &lt;code&gt;embedding&lt;/code&gt; column can be safely dropped in a future database cleanup.&lt;/p&gt;

&lt;h3&gt;
  
  
  See it in action
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xguyn9wvxoedlv4ww91.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xguyn9wvxoedlv4ww91.gif" alt="Semantic search after embeddings change" width="884" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The semantic search UI seamlessly returns results using the new gemini-embedding-001 model without any disruption to the user experience.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AI infrastructure is about more than just the initial build; it’s about designing for evolution. By using shadow deployments, you ensure your RAG system can always stay at the cutting edge of model performance without sacrificing availability.&lt;/p&gt;

&lt;p&gt;Ready to take it further?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check out the &lt;a href="https://github.com/rsamborski/rag-migration" rel="noopener noreferrer"&gt;full source code on GitHub&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/run/docs/create-jobs?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn more about Cloud Run Jobs&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/alloydb/docs/pgvector?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn more about AlloyDB and pgvector&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings?utm_campaign=CDR_0x87fa8d40_default_b499342268&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn more about Embeddings APIs on VertexAI&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my next post, we’ll look at the Developer Experience - how I used &lt;a href="https://geminicli.com/" rel="noopener noreferrer"&gt;Gemini CLI&lt;/a&gt; and the &lt;a href="https://github.com/gemini-cli-extensions/conductor" rel="noopener noreferrer"&gt;Conductor extension&lt;/a&gt; to build and manage this entire multi-phase project.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Thanks for reading&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you found this article helpful, please consider adding 50 claps to this post by pressing and holding the clap button 👏 This will help others find it. You can also share it with your friends on socials.&lt;/p&gt;

&lt;p&gt;I'm always eager to share my learnings or chat with fellow developers and AI enthusiasts, so feel free to follow me on &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>ai</category>
      <category>vectordatabase</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building a Scalable RAG Backend with Cloud Run Jobs and AlloyDB</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Wed, 15 Apr 2026 08:26:53 +0000</pubDate>
      <link>https://dev.to/googleai/building-a-scalable-rag-backend-with-cloud-run-jobs-and-alloydb-59pk</link>
      <guid>https://dev.to/googleai/building-a-scalable-rag-backend-with-cloud-run-jobs-and-alloydb-59pk</guid>
      <description>&lt;p&gt;Building a Retrieval-Augmented Generation (RAG) sounds easy with all the available tutorials. You take a few hundred products, run them through an embedding model, and store them in a vector database. It works beautifully on your machine or staging environment.&lt;/p&gt;

&lt;p&gt;The friction starts at production scale. When your dataset jumps from a few hundred to millions of products, that simple Python loop you wrote to generate embeddings hits a wall. Between network latency and hitting API rate limits every few seconds, what was a five-minute task quickly spirals into a multi-hour ordeal that blocks your entire pipeline.&lt;/p&gt;

&lt;p&gt;Scaling effectively means moving past sequential processing. In this post, we’ll explore how to build an industrial-strength RAG backend using &lt;a href="https://docs.cloud.google.com/bigquery/docs/introduction?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;BigQuery&lt;/a&gt;, &lt;a href="https://docs.cloud.google.com/run/docs/create-jobs?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud Run Jobs&lt;/a&gt;, &lt;a href="https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Vertex AI&lt;/a&gt;, and &lt;a href="https://docs.cloud.google.com/alloydb/docs/overview?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;AlloyDB for PostgreSQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You will learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provision infrastructure with &lt;a href="https://www.terraform.io/" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Parallelize embedding generation using &lt;a href="https://cloud.google.com/run/docs/managing/jobs?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud Run Jobs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;google-genai&lt;/code&gt; SDK for Vertex AI &lt;code&gt;text-embedding-005&lt;/code&gt; model
&lt;/li&gt;
&lt;li&gt;Store and query vectors in &lt;a href="https://cloud.google.com/alloydb/docs/overview?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;AlloyDB for PostgreSQL&lt;/a&gt; using &lt;code&gt;pgvector&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note: I decided to use AlloyDB in this example, but any other &lt;a href="https://www.postgresql.org/" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt; database with &lt;a href="https://github.com/pgvector/pgvector" rel="noopener noreferrer"&gt;pgvector extension&lt;/a&gt; could work too, for example you may consider leveraging &lt;a href="https://docs.cloud.google.com/sql/docs/postgres?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Cloud SQL for PostgreSQL&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Before we dive into the code, let's briefly discuss the core components that power this serverless AI solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Industrial-Strength Architecture
&lt;/h2&gt;

&lt;p&gt;Our pipeline is designed for massive scale and serverless efficiency. We leverage the following Google Cloud services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BigQuery:&lt;/strong&gt; Our source of truth, containing millions of product records.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Run Jobs:&lt;/strong&gt; A serverless compute platform that allows us to run hundreds of parallel tasks.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vertex AI (&lt;code&gt;text-embedding-005&lt;/code&gt;):&lt;/strong&gt; The latest state-of-the-art embedding model from Google.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AlloyDB for PostgreSQL:&lt;/strong&gt; An enterprise-grade database with built-in &lt;code&gt;pgvector&lt;/code&gt; support for high-performance vector search.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The diagram below illustrates the high-level architecture of our RAG pipeline:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpfzrdk86c81y08n6yx6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpfzrdk86c81y08n6yx6.png" alt="High-level architecture of the RAG pipeline" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Implementation&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's walk through the setup and execution process step-by-step. All the code for this project is available in the &lt;a href="https://github.com/rsamborski/rag-migration/tree/main/01-generation" rel="noopener noreferrer"&gt;RAG Migration Repository&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prepare the environment
&lt;/h3&gt;

&lt;p&gt;First, let's configure the &lt;a href="https://cloud.google.com/sdk/docs/install-sdk?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;gcloud CLI&lt;/a&gt;, clone the repository and create a virtual environment with dependencies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 1 - set your default project:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud config &lt;span class="nb"&gt;set &lt;/span&gt;project YOUR_PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Step 2 - configure the default region for Cloud Run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud config &lt;span class="nb"&gt;set &lt;/span&gt;run/region europe-central2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Step 3 - clone the code repository
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/rsamborski/rag-migration.git
&lt;span class="nb"&gt;cd &lt;/span&gt;rag-migration/01-generation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Step 4 - create a virtual environment and install dependencies
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv init
uv &lt;span class="nb"&gt;sync&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Infrastructure with Terraform
&lt;/h3&gt;

&lt;p&gt;We use Terraform to provision the AlloyDB cluster, the Artifact Registry, and the Cloud Run Job. Navigate to &lt;code&gt;01-generation/infra/terraform&lt;/code&gt; and apply the configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform init
terraform plan &lt;span class="nt"&gt;-var&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"project_id=YOUR_PROJECT_ID"&lt;/span&gt; &lt;span class="nt"&gt;-var&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"db_password=YOUR_SECURE_PASSWORD"&lt;/span&gt; &lt;span class="nt"&gt;-out&lt;/span&gt; tfplan
terraform apply tfplan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: The &lt;code&gt;-out tfplan&lt;/code&gt; flag saves the plan to a file named &lt;code&gt;tfplan&lt;/code&gt;, and &lt;code&gt;terraform apply tfplan&lt;/code&gt; applies that specific plan. This is a best practice for ensuring that the plan and apply operations are consistent.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Connecting to AlloyDB
&lt;/h3&gt;

&lt;p&gt;To interact with AlloyDB, the application needs to establish a secure connection. Depending on where you are running the code, the approach differs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local Development:&lt;/strong&gt; For running scripts or testing queries from your local machine, use the &lt;a href="https://cloud.google.com/alloydb/docs/auth-proxy/overview?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;AlloyDB Auth Proxy&lt;/a&gt;. It provides secure access to your instance without authorizing your local IP to the AlloyDB instance.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Run Jobs:&lt;/strong&gt; When running in Cloud Run, the job connects to the AlloyDB instance over the private network (VPC). For this setup, we pass the database password via an environment variable to the Cloud Run Job configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note: For production workloads, it is highly recommended to use Google Cloud Secret Manager to handle sensitive data like database passwords, rather than passing them as plain text environment variables.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Embedding logic
&lt;/h3&gt;

&lt;p&gt;The worker script (&lt;code&gt;01-generation/main.py&lt;/code&gt;) is designed to run as an individual task within a Cloud Run Job. It uses the &lt;code&gt;CLOUD_RUN_TASK_INDEX&lt;/code&gt; environment variable to calculate its specific shard of data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Cloud Run Job environment variables
&lt;/span&gt;&lt;span class="n"&gt;task_index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CLOUD_RUN_TASK_INDEX&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;batch_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;BATCH_SIZE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;# Calculate offset
&lt;/span&gt;&lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;task_index&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;batch_size&lt;/span&gt;   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The embedding generation logic (&lt;code&gt;01-generation/src/embedder.py&lt;/code&gt;) uses the &lt;code&gt;google-genai&lt;/code&gt; SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.genai.types&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;EmbedContentConfig&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate_embeddings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;]]:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Generates embeddings for a list of texts using the text-embedding-005 model.
    Uses the new google-genai SDK to avoid deprecation warnings.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="n"&gt;project_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_PROJECT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rsamborski-rag&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GOOGLE_CLOUD_REGION&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;europe-central2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Initialize the Gen AI client for Vertex AI
&lt;/span&gt;    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vertexai&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;project_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# The dimensionality of the output embeddings for text-embedding-005.
&lt;/span&gt;    &lt;span class="n"&gt;dimensionality&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;768&lt;/span&gt; 
    &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RETRIEVAL_DOCUMENT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;# standard task for documents in RAG
&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;embed_content&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;text-embedding-005&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;contents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;EmbedContentConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;task_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;output_dimensionality&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;dimensionality&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Build and deploy
&lt;/h3&gt;

&lt;p&gt;We containerize the application using the provided &lt;code&gt;Dockerfile&lt;/code&gt; and deploy it as a Cloud Run Job. The &lt;code&gt;deploy.sh&lt;/code&gt; script automates this process, you can run it by executing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./infra/scripts/deploy.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once finished you should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nt"&gt;---------------------------------------------------------&lt;/span&gt;
✅ Deployment Finished
&lt;span class="nt"&gt;---------------------------------------------------------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run and monitor
&lt;/h3&gt;

&lt;p&gt;Now you can start the orchestrator by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv run orchestrator.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The orchestrator provides real-time feedback on the job status, which you can also monitor in the &lt;a href="https://console.cloud.google.com/run/jobs?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Google Cloud Console&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Congratulations 🎉 You have successfully built and run a parallelized embedding pipeline!&lt;/p&gt;

&lt;p&gt;For production environment I recommend to &lt;a href="https://docs.cloud.google.com/alloydb/docs/ai/create-scann-index?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;create a ScaNN index&lt;/a&gt; to improve the speed of your queries. Please refer to the linked documentation to learn more about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Testing with the Semantic Search UI&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To see the embeddings in action, you can spin up the Next.js semantic search UI locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the UI
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the UI directory and configure the environment:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ../02-ui
&lt;span class="nb"&gt;cp&lt;/span&gt; .env.template .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the &lt;code&gt;.env&lt;/code&gt; file to include your Google Cloud &lt;code&gt;PROJECT_ID&lt;/code&gt; and the AlloyDB &lt;code&gt;DB_PASSWORD&lt;/code&gt; you used during the Terraform deployment. Set &lt;code&gt;DB_HOST=127.0.0.1&lt;/code&gt; to route queries through the AlloyDB Auth Proxy.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install dependencies:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the AlloyDB Auth Proxy (in a separate terminal window):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Make sure you have downloaded the alloydb-auth-proxy binary&lt;/span&gt;
./alloydb-auth-proxy projects/YOUR_PROJECT_ID/locations/europe-central2/clusters/rag-migration-cluster/instances/rag-migration-instance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the development server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to &lt;code&gt;http://localhost:3000&lt;/code&gt; to interact with the search portal. You can now run natural language queries directly against your product catalog!&lt;/p&gt;

&lt;h3&gt;
  
  
  See it in action
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8yd0bowdejyw1z7948h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8yd0bowdejyw1z7948h.gif" alt=" " width="884" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Watch as natural language queries return highly relevant results mapped via the &lt;code&gt;text-embedding-005&lt;/code&gt; model in real-time.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You now have a scalable, serverless foundation for your RAG system. By using Cloud Run Jobs, you've transformed a bottleneck into a highly parallelized process capable of handling millions of records.&lt;/p&gt;

&lt;p&gt;Ready to take it further?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check out the &lt;a href="https://github.com/rsamborski/rag-migration" rel="noopener noreferrer"&gt;full source code on GitHub&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/run/docs/create-jobs?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn more about Cloud Run Jobs&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/alloydb/docs/pgvector?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn more about AlloyDB and pgvector&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/alloydb/docs/ai/create-scann-index?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn how to create a ScaNN index&lt;/a&gt; for your embeddings.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/vertex-ai/generative-ai/docs/embeddings?utm_campaign=CDR_0x87fa8d40_default_b499342314&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Learn more about Embeddings APIs on VertexAI&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/googleai/migrating-vector-embeddings-in-production-without-downtime-5bli"&gt;next post&lt;/a&gt;, we’ll dive into Zero-Downtime Embedding Migration - how to upgrade your vector models without taking your search offline.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Thanks for reading&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you found this article helpful, please consider adding 50 claps to this post by pressing and holding the clap button 👏 This will help others find it. You can also share it with your friends on socials.&lt;/p&gt;

&lt;p&gt;I'm always eager to share my learnings or chat with fellow developers and AI enthusiasts, so feel free to follow me on &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>vectordatabase</category>
      <category>programming</category>
    </item>
    <item>
      <title>Secure Gemini CLI for Cloud development</title>
      <dc:creator>Remigiusz Samborski</dc:creator>
      <pubDate>Fri, 13 Mar 2026 06:01:17 +0000</pubDate>
      <link>https://dev.to/googleai/secure-gemini-cli-for-cloud-development-2mpe</link>
      <guid>https://dev.to/googleai/secure-gemini-cli-for-cloud-development-2mpe</guid>
      <description>&lt;p&gt;AI agents are a double-edged sword. You hear horror stories of autonomous tools deleting production databases or purging entire email inboxes. These risks often lead users to require manual confirmation for every agent operation. This approach keeps you in control but limits the agent's autonomy. You will soon find yourself hand-holding the agent and hindering its true capabilities. You need a way to let the agent run in "yolo mode" without risking your system.&lt;/p&gt;

&lt;p&gt;In this blog you will learn how to secure your &lt;a href="https://geminicli.com/" rel="noopener noreferrer"&gt;Gemini CLI&lt;/a&gt; in a way that will allow you to run it in an isolated environment with limited &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; and &lt;a href="https://cloud.google.com/?utm_campaign=CDR_0x87fa8d40_default_b490349988&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Google Cloud&lt;/a&gt; access while not worrying that it will do too much damage if things go wrong. We will follow the least privilege pattern to make sure Gemini CLI has all necessary permissions to build your project, but at the same time can’t access systems it shouldn’t touch.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Sandbox premise
&lt;/h2&gt;

&lt;p&gt;The solution consists of following components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using &lt;a href="https://docs.cloud.google.com/iam/docs/service-account-overview?utm_campaign=CDR_0x87fa8d40_default_b490349988&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;GitHub fine-grained personal access tokens&lt;/a&gt; - limits source control risks.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.cloud.google.com/iam/docs/service-account-overview?utm_campaign=CDR_0x87fa8d40_default_b490349988&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Google Cloud service account&lt;/a&gt; - limits cloud risks.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; - limits local system risks.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://geminicli.com/docs/cli/session-management/#session-limits" rel="noopener noreferrer"&gt;Session limits&lt;/a&gt; - avoid surprises with the number of used tokens (especially important when running in &lt;code&gt;--yolo&lt;/code&gt; mode).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Following this approach will protect you from the '&lt;strong&gt;helpful agent curse&lt;/strong&gt;' - it’s a situation when the agent tries very hard to achieve a task by finding ways around blockers. Examples include: granting itself more permissions, copying files to the current folder to edit them, and many more.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub fine-grained personal access tokens
&lt;/h3&gt;

&lt;p&gt;First let’s limit agent’s GitHub exposure by leveraging the fine grained tokens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to GitHub Settings &amp;gt; Developer Settings &amp;gt; Personal access tokens &amp;gt; &lt;a href="https://github.com/settings/personal-access-tokens" rel="noopener noreferrer"&gt;Fine-grained tokens&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;Generate a new token&lt;/em&gt;.
&lt;/li&gt;
&lt;li&gt;Provide a descriptive &lt;em&gt;name&lt;/em&gt; for your token and consider using &lt;em&gt;expiration date&lt;/em&gt; to force rotations on a regular basis.
&lt;/li&gt;
&lt;li&gt;Restrict &lt;em&gt;Repository access&lt;/em&gt; to the specific target repo you are working on.
&lt;/li&gt;
&lt;li&gt;Grant &lt;em&gt;Read and Write&lt;/em&gt; permissions for &lt;em&gt;Contents&lt;/em&gt;.
&lt;/li&gt;
&lt;li&gt;Save the token locally by running &lt;code&gt;export GITHUB_TOKEN="github_pat_..."&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Google Cloud Service Account
&lt;/h3&gt;

&lt;p&gt;Create an isolated Service Account (SA) with minimal permissions. This prevents the agent from accessing protected resources and other projects.&lt;/p&gt;

&lt;p&gt;Run these commands after updating &lt;code&gt;YOUR_PROJECT_ID&lt;/code&gt; and roles below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Set your project ID&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLOUDSDK_CORE_PROJECT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_PROJECT_ID"&lt;/span&gt;
gcloud config &lt;span class="nb"&gt;set &lt;/span&gt;project &lt;span class="nv"&gt;$CLOUDSDK_CORE_PROJECT&lt;/span&gt;

&lt;span class="c"&gt;# Create the Service Account&lt;/span&gt;
gcloud iam service-accounts create gemini-cli-sa &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Isolated account for Gemini CLI"&lt;/span&gt;

&lt;span class="c"&gt;# Grant minimal roles (adjust roles as needed)&lt;/span&gt;
gcloud projects add-iam-policy-binding &lt;span class="nv"&gt;$CLOUDSDK_CORE_PROJECT&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="nt"&gt;--member&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"serviceAccount:gemini-cli-sa@&lt;/span&gt;&lt;span class="nv"&gt;$CLOUDSDK_CORE_PROJECT&lt;/span&gt;&lt;span class="s2"&gt;.iam.gserviceaccount.com"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"roles/aiplatform.user"&lt;/span&gt;

&lt;span class="c"&gt;# Generate the JSON key file&lt;/span&gt;
gcloud iam service-accounts keys create sa-key.json &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--iam-account&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gemini-cli-sa@&lt;span class="nv"&gt;$CLOUDSDK_CORE_PROJECT&lt;/span&gt;.iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Hint: you can use the &lt;a href="https://docs.cloud.google.com/iam/docs/roles-permissions?utm_campaign=CDR_0x87fa8d40_default_b490349988&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;IAM roles and permissions index&lt;/a&gt; page to easily find the roles to grant.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A good practice is to use a dedicated project for each of your AI coding initiatives. This way you can run several agents in parallel. They will build different solutions without worrying about stepping on each other's toes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Custom Docker Build
&lt;/h3&gt;

&lt;p&gt;The Gemini CLI uses a sandbox image to isolate the execution environment. You must customize this image to install gcloud, terraform, vim and set git configuration.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prepare the Dockerfile
&lt;/h4&gt;

&lt;p&gt;Create a &lt;code&gt;.gemini&lt;/code&gt; directory in your project, and inside it, create a &lt;code&gt;sandbox.Dockerfile&lt;/code&gt;. Using this specific file name allows Gemini CLI to automatically detect and build your custom sandbox profile if you’re &lt;a href="//?tab=t.0#bookmark=id.5tyzxboz7enm"&gt;running it from source&lt;/a&gt; and you can also use it to build the image manually if you’re &lt;a href="//?tab=t.0#bookmark=id.l2l4uuiqql87"&gt;running a binary installation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Paste this content in the &lt;code&gt;.gemini/sandbox.Dockerfile&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start from the official Gemini CLI sandbox image with proper version&lt;/span&gt;
&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; GEMINI_CLI_VERSION 0.33.0&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:${GEMINI_CLI_VERSION}&lt;/span&gt;

&lt;span class="c"&gt;# Switch to root to install system dependencies (gcloud)&lt;/span&gt;
&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="s"&gt; root&lt;/span&gt;

&lt;span class="c"&gt;# Install Google Cloud SDK, Git, and prerequisites&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; curl apt-transport-https ca-certificates gnupg git &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main"&lt;/span&gt; | &lt;span class="nb"&gt;tee&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; /etc/apt/sources.list.d/google-cloud-sdk.list &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key &lt;span class="nt"&gt;--keyring&lt;/span&gt; /usr/share/keyrings/cloud.google.gpg add - &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; google-cloud-cli

&lt;span class="c"&gt;# Install Terraform&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; wget lsb-release &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    wget &lt;span class="nt"&gt;-O-&lt;/span&gt; https://apt.releases.hashicorp.com/gpg | gpg &lt;span class="nt"&gt;--dearmor&lt;/span&gt; | &lt;span class="nb"&gt;tee&lt;/span&gt; /usr/share/keyrings/hashicorp-archive-keyring.gpg &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"deb [arch=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;dpkg &lt;span class="nt"&gt;--print-architecture&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt; signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-oP&lt;/span&gt; &lt;span class="s1"&gt;'(?&amp;lt;=UBUNTU_CODENAME=).*'&lt;/span&gt; /etc/os-release &lt;span class="o"&gt;||&lt;/span&gt; lsb_release &lt;span class="nt"&gt;-cs&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt; main"&lt;/span&gt; | &lt;span class="nb"&gt;tee&lt;/span&gt; /etc/apt/sources.list.d/hashicorp.list &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;    apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; terraform

&lt;span class="c"&gt;# Install vim&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; vim

&lt;span class="c"&gt;# Switch back to the non-root user (the official sandbox image uses 'node' as the default user)&lt;/span&gt;
&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="s"&gt; node&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /workspace&lt;/span&gt;

&lt;span class="c"&gt;# Configure Git to use the injected GitHub PAT at runtime&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.helper &lt;span class="s1"&gt;'!f() { echo "username=x-access-token"; echo "password=$GITHUB_TOKEN"; }; f'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Prepare docker for building images (optional MacOS step)
&lt;/h4&gt;

&lt;p&gt;If you haven’t built any Docker images before then run following commands to prepare your environment with &lt;code&gt;brew&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;docker colima docker-buildx

&lt;span class="c"&gt;# Configure docker-buildx&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.docker/cli-plugins
&lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-sfn&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;brew &lt;span class="nt"&gt;--prefix&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;/opt/docker-buildx/bin/docker-buildx ~/.docker/cli-plugins/docker-buildx

&lt;span class="c"&gt;# Start colima service&lt;/span&gt;
brew services start colima

&lt;span class="c"&gt;# Update DOCKER_HOST (you might want to add this line to .bash_profile):&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;DOCKER_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"unix://&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/.colima/default/docker.sock"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Build the image (binary installation)
&lt;/h4&gt;

&lt;p&gt;If you installed Gemini CLI with &lt;code&gt;npm&lt;/code&gt;, &lt;code&gt;brew&lt;/code&gt; or any other binary method then you will need to manually build the Docker image and tag it as a default one that Gemini CLI is looking for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get the base name the CLI looks for&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;IMAGE_BASE_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox"&lt;/span&gt;

&lt;span class="c"&gt;# Get your currently installed Gemini CLI version (e.g., 0.33.0)&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_CLI_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;gemini &lt;span class="nt"&gt;--version&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Combine them&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;IMAGE_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;IMAGE_BASE_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;GEMINI_CLI_VERSION&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Build your custom sandbox image&lt;/span&gt;
docker build &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--build-arg&lt;/span&gt; &lt;span class="nv"&gt;GEMINI_CLI_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$GEMINI_CLI_VERSION&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;IMAGE_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-f&lt;/span&gt; .gemini/sandbox.Dockerfile &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Important: this image will be tagged with the exact version of the Gemini CLI you use. This means it needs to be rebuilt every time you update the CLI. I keep the above code in a shell script to run it after every update.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Build the image (source installation)
&lt;/h4&gt;

&lt;p&gt;If you’re running your Gemini CLI from source as explained &lt;a href="https://geminicli.com/docs/get-started/installation/#run-from-source-recommended-for-gemini-cli-contributors" rel="noopener noreferrer"&gt;here&lt;/a&gt;. You can trigger the image build automatically each time you start &lt;code&gt;gemini&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;First update the top part of your sandbox.Dockerfile by substituting the FROM line with following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start from the official Gemini CLI sandbox image (source installation)&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; gemini-cli-sandbox&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Start Gemini CLI in the sandbox mode
&lt;/h2&gt;

&lt;p&gt;First set couple very important environment variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Export the necessary environment variables&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"github_pat_..."&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-api-key"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CLOUDSDK_CORE_PROJECT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_PROJECT_ID"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_SANDBOX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;docker

&lt;span class="c"&gt;# We keep the ENV variables for our dynamic credentials&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;SANDBOX_FLAGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
-e GITHUB_TOKEN=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;GITHUB_TOKEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
-e CLOUDSDK_CORE_PROJECT=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CLOUDSDK_CORE_PROJECT&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;/sa-key.json"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: You can put the above variables in a shell script to speed up starts in the future. Just make sure to update your &lt;code&gt;.gitignore&lt;/code&gt; to keep it and &lt;code&gt;sa-key.json&lt;/code&gt; from getting added to your repository.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now you can start your Gemini CLI with following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For binary installation&lt;/span&gt;
gemini

&lt;span class="c"&gt;# For source installation&lt;/span&gt;
&lt;span class="nv"&gt;BUILD_SANDBOX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 gemini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Session limits
&lt;/h3&gt;

&lt;p&gt;To avoid surprises with the number of tokens that Gemini CLI uses in your session, you can use the Max Session Turns in &lt;code&gt;/settings&lt;/code&gt; or your &lt;code&gt;~/.gemini/settings.json&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmikj41wnhuz4dt73gky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmikj41wnhuz4dt73gky.png" alt="Max Session Turns" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Congratulations
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Congratulations 🚀&lt;/strong&gt;You’re ready to validate your setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validation and "Ultimate Tests"
&lt;/h2&gt;

&lt;p&gt;Once the environment is launched within a sandbox we should verify the security boundaries. &lt;/p&gt;

&lt;p&gt;First let’s run the &lt;code&gt;/about&lt;/code&gt; command to see if we’re running within a sandbox. You should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhvy0utgxku5aajiv8n3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhvy0utgxku5aajiv8n3t.png" alt="About with sandbox" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s try to break out from our new sandbox.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub privilege escalation
&lt;/h3&gt;

&lt;p&gt;Try asking Gemini CLI to access a private repo it shouldn’t have access. Example prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Clone https://github.com/USER_NAME/PRIVATE_REPOSITORY to a new folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see how Gemini CLI really tries and struggles to get access. Mine got really creative at trying to access the repo with &lt;code&gt;git&lt;/code&gt;, &lt;code&gt;gh&lt;/code&gt;, &lt;code&gt;curl&lt;/code&gt; and even tried to reuse the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; manually. All these tries failed and this error was displayed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlzibm3xkqf561kdu5u2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnlzibm3xkqf561kdu5u2.png" alt="GitHub privilege escalation test" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Google Cloud privilege escalation
&lt;/h3&gt;

&lt;p&gt;Ask the agent to list all compute instances:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List all my compute instances
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should fail due to missing permissions on your restricted Service Account. Gemini CLI tries really hard and executes couple different commands including reauthentication, but it fails at the end:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzqkltvcxnsmh7y3ikl7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzqkltvcxnsmh7y3ikl7t.png" alt="Google Cloud privilege escalation test" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Local privilege escalation
&lt;/h3&gt;

&lt;p&gt;Finally let’s try to access a file from another project folder by prompting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;There are other projects in the folder above the current one. List them and let me know if there is anything that is interesting from hacker's perspective.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am starting to feel sorry for the poor agent 😉 Once again it can’t complete its task:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq7t4260zre91hsr7kdq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq7t4260zre91hsr7kdq.png" alt="Local privilege escalation test" width="800" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Now that you have validated your sandbox setup you should feel much more confident to run &lt;code&gt;gemini  --yolo&lt;/code&gt; and streamline your work as &lt;a href="https://geminicli.com/" rel="noopener noreferrer"&gt;Gemini CLI&lt;/a&gt; delivers your code without hand-holding and pesky &lt;code&gt;Can I execute this command?&lt;/code&gt; Prompts.&lt;/p&gt;

&lt;p&gt;I am looking forward to all the creative ideas you’ll bring to life!&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;If you find this setup useful here are some additional steps to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Try out &lt;a href="https://github.com/gemini-cli-extensions/conductor" rel="noopener noreferrer"&gt;Gemini CLI Conductor Extension&lt;/a&gt; - it’s very powerful and can significantly help you run autonomous agents effectively. &lt;a href="https://medium.com/google-cloud/trying-out-the-new-conductor-extension-in-gemini-cli-0801f892e2db" rel="noopener noreferrer"&gt;Here is a deep dive&lt;/a&gt; into some of the advantages.
&lt;/li&gt;
&lt;li&gt;Read my &lt;a href="https://medium.com/google-cloud/antigravity-the-ralph-wiggum-style-ee6784a78237" rel="noopener noreferrer"&gt;Antigravity the Ralph Wiggum style&lt;/a&gt; which covers sandboxing for &lt;a href="https://antigravity.google/?utm_campaign=CDR_0x87fa8d40_default_b490349988&amp;amp;utm_medium=external&amp;amp;utm_source=blog" rel="noopener noreferrer"&gt;Antigravity&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Add emojis to this post to help others find it.
&lt;/li&gt;
&lt;li&gt;Share this post with your friends on socials.
&lt;/li&gt;
&lt;li&gt;Connect with me via &lt;a href="https://www.linkedin.com/in/remigiusz-samborski/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://x.com/RemikSamborski" rel="noopener noreferrer"&gt;X&lt;/a&gt; or &lt;a href="https://bsky.app/profile/rsamborski.bsky.social" rel="noopener noreferrer"&gt;Bluesky&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>gemini</category>
      <category>devtool</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
