Gemini API Managed Agents: Background Execution and Remote MCP Guide Google shipped four production-readiness upgrades to Gemini API Managed Agents on July 7, including background execution that allows agents to run asynchronously server-side without a persistent HTTP connection, and remote MCP support for calling private APIs from inside the sandbox. The background execution feature, enabled by setting background=True, returns an interaction ID immediately and supports polling or resuming streams via last_event_id, available on the free tier for gemini-3.5-flash, gemini-3.1-pro-preview, and antigravity-preview-05-2026. Remote MCP lets agents call MCP-compatible endpoints by passing an mcp_server tool at interaction time, with the MCP 2026-07-28 spec removing stateful sessions for stateless builds. Google shipped four production-readiness upgrades to Gemini API Managed Agents on July 7. The headline feature: background execution — agents now run asynchronously server-side without a persistent HTTP connection. If you’ve been watching Managed Agents since Google I/O and waiting for them to handle real workloads, this is the update that tips the scale. What Managed Agents Are If You Missed Google I/O Managed Agents in the Gemini API, introduced at Google I/O May 2026 https://blog.google/innovation-and-ai/technology/developers-tools/google-io-2026-developer-highlights/ , give you a fully provisioned, sandboxed Linux agent environment via a single API call. Pass in an agent name, a model, and input — Google runs it in an isolated container with code execution, Google Search, and a writable filesystem already wired up. No infrastructure to manage, no orchestration layer to build. The limitation has been obvious: agents run synchronously, requiring an open HTTP connection for the full duration. Complex tasks take minutes; HTTP timeouts kick in after seconds. That mismatch has been the primary reason teams held off on using Managed Agents for anything beyond quick queries. Background Execution: The Feature That Actually Matters The fix is a single parameter: background=True . When set, interactions.create returns an interaction ID immediately. The agent continues running on Google’s servers. Your connection dropping is no longer fatal. python from google import genai import time client = genai.Client Returns immediately with an interaction ID interaction = client.interactions.create agent="antigravity-preview-05-2026", input="Analyze Q1 revenue data, identify anomalies, and generate a report", background=True Poll until done while True: result = client.interactions.get interaction.id if result.status in "completed", "failed" : break time.sleep 5 print result.output If your connection drops mid-task, pass last event id to resume the stream from where it left off. The task keeps running regardless. Background execution is supported for gemini-3.5-flash , gemini-3.1-pro-preview , and antigravity-preview-05-2026 — and is available on the free tier. Full details are in Google’s background execution documentation https://ai.google.dev/gemini-api/docs/background-execution . Remote MCP: Your Private APIs Inside Google’s Sandbox The second major addition lets a Managed Agent call your MCP-compatible endpoints directly from inside its sandbox. Pass an mcp server tool at interaction time: interaction = client.interactions.create agent="antigravity-preview-05-2026", input="Fetch all P0 bugs from Jira and correlate with the last 10 commits", tools= {"type": "mcp server", "url": "https://your-jira-mcp.example.com/mcp"}, {"type": "code execution"}, {"type": "google search"} The practical unlocking here is significant. Previously, getting an agent to touch internal data — your ticket system, a proprietary analytics API, an IoT backend — required either exposing endpoints publicly or building a custom proxy function. Remote MCP removes that friction. Network allowlists and credential patterns handle access control on your side. One important note if you’re building a remote MCP server for this: the MCP 2026-07-28 spec https://www.digitalapplied.com/blog/mcp-2026-07-28-spec-stateless-migration-guide shipping today removes stateful sessions entirely. Every request carries its own context in meta ; the initialize handshake is gone. Build your MCP server stateless from day one. ByteIota covered the full migration guide yesterday https://byteiota.com/mcp-2026-07-28-spec-sessions-gone-migration-guide/ . Credential Refresh and Custom Functions The other two additions are less flashy but equally important for production use. Credential refresh solves the token expiry problem. When a short-lived OAuth token expires mid-workflow, you previously lost all sandbox state — filesystem, installed packages, cloned repositories. Now pass your existing environment id with updated credentials, and the new rules take effect immediately while sandbox state persists. Hour-long agentic workflows are now viable. Custom functions let you define domain-specific capabilities the agent can call in its reasoning loop — proprietary data fetchers, internal metric endpoints, pre-processing functions. These extend the sandbox without requiring a full MCP server setup, which is useful for smaller integrations. Where This Leaves the Agent Platform War The honest comparison: Gemini Managed Agents give you Google-managed infrastructure. OpenAI’s Agents SDK https://platform.openai.com/docs/agents and Anthropic’s Claude Agents SDK give you a model plus SDK layer — you manage execution yourself. Neither is objectively better. If you need cross-cloud portability or want full control over where your agent code runs, Managed Agents aren’t for you. If you’re already on GCP and don’t want to build and maintain an orchestration layer, the July 7 update makes Managed Agents a genuinely compelling option. Background execution closes the reliability gap. Remote MCP closes the data access gap. Credential refresh makes long sessions viable. The free tier availability across all four new features matters. Google isn’t locking this behind enterprise SKUs — adoption incentives are clearly the priority right now. All four features are live. Start with the official Google blog post https://blog.google/innovation-and-ai/technology/developers-tools/expanding-managed-agents-gemini-api/ for context, then go straight to the documentation https://ai.google.dev/gemini-api/docs/background-execution to implement.