GEMINI LABJP
PRO35 — July 17, the date reports had pointed to, has passed without an official Gemini 3.5 Pro announcement or model card. July 24 is being cited as the fallbackNB2LITE — Nano Banana 2 Lite, otherwise known as Gemini 3.1 Flash-Lite Image, arrives as the fastest of the family: roughly four seconds per image at $0.034 per thousandOMNI — Gemini Omni Flash enters public preview, generating video up to ten seconds long at $0.10 per second of outputEDIT — Omni Flash is built around conversational editing. Swap a character, relight a scene, or change the angle in plain language, and the original audio and video tracks stay intactSYNTHID — Both new models carry SynthID watermarking, so anything they produce can be checked for provenance from inside the Gemini appSHUTDOWN — The older image generation models are deprecated and switch off on August 17. Worth checking your migration windowPRO35 — July 17, the date reports had pointed to, has passed without an official Gemini 3.5 Pro announcement or model card. July 24 is being cited as the fallbackNB2LITE — Nano Banana 2 Lite, otherwise known as Gemini 3.1 Flash-Lite Image, arrives as the fastest of the family: roughly four seconds per image at $0.034 per thousandOMNI — Gemini Omni Flash enters public preview, generating video up to ten seconds long at $0.10 per second of outputEDIT — Omni Flash is built around conversational editing. Swap a character, relight a scene, or change the angle in plain language, and the original audio and video tracks stay intactSYNTHID — Both new models carry SynthID watermarking, so anything they produce can be checked for provenance from inside the Gemini appSHUTDOWN — The older image generation models are deprecated and switch off on August 17. Worth checking your migration window
Articles/API / SDK
API / SDK/2026-06-21Advanced

Should You Move Your Agent Loop to Gemini's Managed Agents? Three Questions That Decide What Migrates

With Gemini API's Managed Agents in public preview, deciding between a self-hosted agent loop and a Google-hosted sandbox is now a real question. Three questions — execution environment, state ownership, and failure recovery — decide what migrates and what stays.

gemini-api277managed-agents4ai-agents2automation51architecture15google-io-2026

Premium Article

Managed Agents, announced at Google I/O 2026, are now available in public preview on the Gemini API. The pitch is appealing: a single API call spins up an agent inside a Google-hosted, isolated Linux sandbox, where it reasons, calls tools, executes code, and hands you back the result.

I run a fair amount of automation as an indie developer — scheduled blog maintenance, image-asset housekeeping, and similar background jobs — all driven by agent loops I wrote and operate myself. My honest first reaction to the announcement was an even split of hope and suspicion. Hope, because if something else can carry the tedious parts of running a loop, I will gladly let it. Suspicion, because moving automation that already works is one of the more reliable ways to hurt yourself.

So I went through the jobs running on my machines, one by one, asking a single question: could this move to Managed Agents, and should it? The short answer is that not everything made the cut — but the reasoning collapsed neatly into three questions. What follows is that working-through, written down.

Your agent loop is mostly not the loop

The agent loop itself is surprisingly little code. Call the model; if it returns a function call, run the matching function; feed the result back; repeat. The skeleton fits in about thirty lines.

Here is a minimal loop with exactly one tool, a release-notes checker. Gemini calls the tool when it needs to, and the loop ends once a final text report comes back.

from google import genai
from google.genai import types
 
client = genai.Client()  # reads GEMINI_API_KEY from the environment
 
def check_release_notes(product: str) -> dict:
    """Returns the latest release-notes entry (a real version would hit an RSS feed or DB)."""
    return {"product": product, "latest": "1.4.2", "breaking_changes": False}
 
tool = types.Tool(function_declarations=[
    types.FunctionDeclaration(
        name="check_release_notes",
        description="Fetches the latest release-notes entry for a product name",
        parameters=types.Schema(
            type=types.Type.OBJECT,
            properties={"product": types.Schema(type=types.Type.STRING)},
            required=["product"],
        ),
    )
])
 
contents = [types.Content(
    role="user",
    parts=[types.Part(text="Check whether the latest release of dependency foo contains breaking changes, and report in one paragraph")],
)]
 
for _ in range(5):  # hard cap to prevent runaway loops
    response = client.models.generate_content(
        model="gemini-3.5-flash",
        contents=contents,
        config=types.GenerateContentConfig(tools=[tool]),
    )
    if not response.function_calls:
        print(response.text)
        break
    contents.append(response.candidates[0].content)
    for call in response.function_calls:
        result = check_release_notes(**call.args)
        contents.append(types.Content(
            role="user",
            parts=[types.Part.from_function_response(name=call.name, response=result)],
        ))

I kept the skeleton deliberately bare to make a point: in production, everything that matters accretes around it. Retries with exponential backoff. Logging and persistence of intermediate progress. Keeping the execution environment alive — cron, containers, whatever you use. Credential management. Timeouts and protection against overlapping runs. In my own codebase, the operational layer around the loop is considerably larger than anything related to the agent's actual thinking.

I covered that production scaffolding in detail in Custom Gemini API Agent Loop Without ADK — A Complete Production Guide to Tool Calling, Memory, and Parallel Execution, but the one-line summary is: the loop is easy, the operations are the product. That is the baseline for everything below.

Which part of that operational layer do Managed Agents actually absorb?

Reading through what Google has published, the scope of Managed Agents looks like this. They provision and tear down the execution environment — the isolated Linux sandbox. They drive the loop itself: reason, execute tools and code, continue, repeat. And they hold the agent's state while it runs. In other words, out of the operational layer I just called "the product," the environment upkeep and the loop orchestration move wholesale to the other side of the API.

What stays on your side is just as clear. Defining the task — what you actually want done. Receiving the result and judging whether it is correct. Handling failure. Watching cost. You can delegate how the agent runs; you cannot delegate why it runs or what happens with what it produces.

Looking at that boundary, what struck me was not the freedom from cron management. It was the fact that verification and failure handling stay with me — because in my experience, the time sink in operating automation has never been keeping environments alive. It is investigating things when they break. That realization is why I stopped asking "is this convenient?" and started asking the three questions below.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Wrapping the Managed Agents call in a thin wrapper that auto-falls back to your self-hosted loop on failure
An idempotency-key gatekeeper that makes reruns and double-submits safe — including the sort_keys pitfall
A nightly cost-metering design tracking the managed/self time ratio and fallback rate to catch preview billing creep early
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API / SDK2026-06-30
Folding Scattered Call Sites Into One Front Door: Migrating to the Interactions API for Automation
With the Interactions API now generally available, Gemini's calls can settle behind a single entry point. Here is a migration design for folding scattered call sites — generateContent, Batch, and homegrown agent loops — into one front door without breaking anything, complete with a working adapter layer.
API / SDK2026-06-19
Your Managed Agents Bill Has a Second Axis: Drawing a Budget Boundary Around Sandbox Runtime
Managed Agents in public preview bills for tokens and for how long its Google-hosted sandbox stays alive. A single hung run quietly drains your budget on that second axis. Here is a working Python design for wall-clock caps, idle teardown, and a concurrency ceiling.
API / SDK2026-06-16
Before You Let a Managed Agent Ship: Designing Your Own Acceptance Gate
Let the public-preview Managed Agents generate files and broken artifacts will flow straight into production. Here is how to build a verification gate that artifacts must pass before you accept them, with runnable Python and a rejection-feedback loop.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →