Google Launched Self-Managing Agents: Hands-On with Gemini Managed Agents
At Google I/O 2026, on May 19th, Google announced Managed Agents in the Gemini API. The concept is straightforward: a single API call provisions a complete agent with a remote, isolated, ephemeral Linux environment. You don't manage a server, configure Docker, or handle scaling. You just program the behavior.
This solves a real problem. Anyone who has tried to deploy an AI agent to production knows the drill: Linux server, isolated environment, task orchestrator, queues, monitoring, sandbox security... you can spend weeks just on infrastructure. Managed Agents eliminate this entire layer.
In this post, you'll understand what changed, why it matters, and — practically — how to create your first managed agent in under 30 minutes.
What are Managed Agents in the Gemini API?
A Managed Agent is an AI agent that runs entirely on Google's infrastructure. You send an HTTP request and receive a complete execution environment in return: a Linux terminal, internet access, code execution, file downloads.
The agent Google provided is Antigravity, powered by the Gemini 3.5 Flash model. It can reason, plan, call tools, execute Python code in a sandbox, and browse the web. Everything is delivered without you needing to install anything beyond an HTTP client.
Google described it this way on the official blog:
"Managed Agents in the Gemini API removes the friction of infrastructure setup, delivering the power of the Antigravity agent harness via managed agents, with a single API call providing a fully provisioned agent with a remote sandbox." — Google AI Blog, May 19, 2026
The key insight is this: instead of you building the "house" for the agent to live in, Google delivers the ready-made house. You only define the behavior.
Why does this matter now?
Until May 2026, setting up an autonomous agent required stacking multiple layers of infrastructure. The table below shows the contrast:
| Component | Before (DIY) | With Managed Agents |
|---|---|---|
| Execution environment | Linux Server + Docker | Automatic (remote sandbox) |
| Task orchestrator | Celery / Temporal | Built-in in Antigravity |
| Security isolation | cgroups + seccomp + AppArmor | Managed by Google |
| Scalability | Auto-scaling groups | Elastic, no configuration |
| Artifact download | S3 Bucket + presigned URLs | Native REST API |
| Initial cost | US$ 50-200/month just for infra (market estimate) | Cost per token — Google claims Gemini 3.5 Flash costs less than half of comparable models |
Google claims that Gemini 3.5 Flash costs less than half of comparable models. Exact prices will be confirmed in the official documentation. But the direction is clear: instead of spending weeks setting up infrastructure, you spend 30 minutes programming the behavior.
Hands-on — Step-by-Step Tutorial
Let's create an agent that analyzes data from a CSV, extracts insights, and generates a report.
⚠️ Warning: The examples below are conceptual illustrations based on the preview documentation from Google I/O 2026. Consult the official Gemini API documentation for the exact parameter names and endpoints, which may change during the preview period.
Step 1 — Environment Setup
Create your API key in Google AI Studio and enable billing. Then, install the dependencies:
pip install google-genai requests python-dotenv
Create a .env file in the project root:
GEMINI_API_KEY=your_key_here
Step 2 — First call: the Antigravity agent
Let's have the agent execute a Python script to analyze a CSV. The environment='remote' parameter is what activates the managed sandbox:
import os
from dotenv import load_dotenv
from google import genai
load_dotenv() client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
response = client.models.generate_content( model="gemini-3.5-flash", contents="Write a Python script to analyze this CSV data: sales,region,value\n100,North,50\n200,South,75\n150,East,60\n180,West,90\n\nThe script should calculate total by region and find the best-performing region.", config={ "environment": "remote", "temperature": 0.2 } )
print(response.text)
Run the script. In seconds, the Antigravity agent — powered by Gemini 3.5 Flash — provisions a Linux environment, writes the code, executes it, and returns the result. You saw none of that, you just received the output.
Step 3 — Multi-turn conversation
Real agents rarely solve everything in one call. To maintain context between interactions, use previous_interaction_id and environment_id:
# First interaction
resp1 = client.models.generate_content(
model="gemini-3.5-flash",
contents="Create a Python script that fetches the latest news about AI from a public API",
config={"environment": "remote"}
)
env_id = resp1.environment_id prev_id = resp1.interaction_id
Second interaction — the agent remembers the context
resp2 = client.models.generate_content( model="gemini-3.5-flash", contents="Now modify the script to save the results to a JSON file", config={ "environment": "remote", "environment_id": env_id, "previous_interaction_id": prev_id } )
print(resp2.text)
The environment_id keeps the same sandbox active between calls. The previous_interaction_id provides conversation context. The agent knows exactly what you asked before.
Step 4 — Real-time streaming
Long operations (web scraping, processing large datasets) can take minutes. With stream=True, you see the result in real-time:
stream = client.models.generate_content_stream(
model="gemini-3.5-flash",
contents="Scrape the top 10 stories from Hacker News and summarize each one",
config={
"environment": "remote",
"stream": True
}
)
for chunk in stream: print(chunk.text, end="")
Each chunk is a piece of the agent's reasoning. You see it planning, executing, finding errors, and correcting them — as if you were looking over its shoulder.
Step 5 — Download generated artifacts
Did the agent create a JSON file? A processed CSV? A chart? Consult the official Gemini API documentation for the artifact download endpoint. The sandbox supports inline files up to 1 MB. For larger files, you can connect GitHub repositories, public URLs, or Google Cloud Storage.
Step 6 — Create a custom agent
If the generic Antigravity isn't enough, create your own agent with system instructions. According to Google's documentation, you can use markdown files to configure behavior: AGENTS.md for system instructions and SKILL.md for reusable skills — a format that allows versioning agent behavior as code.
Create an AGENTS.md file:
# Marketing Analyst Agent
You are a marketing data analyst. Your job is to:
- Analyze CSV files with marketing campaign data
- Calculate ROI, CTR, conversion rates
- Generate actionable insights in Portuguese
- Always output results as formatted tables
Never make up data. Only report what you find.
Now register a skill in SKILL.md:
# Skill: CSV Analysis
Analyze marketing CSV files and produce structured reports.
Parameters
- file_url: URL of the CSV file
- metrics: comma-separated list of metrics to calculate
Output format
Always return a markdown table with: | Campaign | Spend | Revenue | ROI | Status |
And in your API call:
response = client.models.generate_content(
model="gemini-3.5-flash",
contents="Analyze this campaign CSV and tell me which campaign had the best ROI",
config={
"environment": "remote",
"system_instruction": open("AGENTS.md").read(),
"skills": [open("SKILL.md").read()]
}
)
Your agent now acts as a marketing analyst — not a generic LLM. Skills function as behavior plugins.
What to build with this?
Some ideas to get started:
- Data analysis assistant: drop a CSV, receive a complete report
- Intelligent web scraper: the agent navigates, extracts, and structures data
- Technical documentation generator: point to a repository, receive docs
- Translator + reviewer: multi-step translation and review pipeline
- Automated tester: the agent runs tests, captures errors, and suggests fixes
The most interesting part? You can chain multiple agents. One collects data, passes it to another that analyzes it, which passes it to a third that generates the final report. All with simple API calls.
What Google didn't tell you (but you need to know)
Two points of attention:
Ephemeral environment. The sandbox is destroyed after a period of inactivity. If you need persistent state between sessions, you need to save artifacts externally (Google Cloud Storage, GitHub).
Initialization latency. The first call to a new environment takes a few seconds (provisioning time). Subsequent calls with the same environment_id tend to be faster. For real-time applications, keep the environment warm with a keep-alive.
Product in preview. Managed Agents was launched as a preview at Google I/O 2026. The API may still change. Test in non-critical environments before relying on it in production.
Conclusion
Managed Agents aren't just another feature of the Gemini API. It's a paradigm shift: for the first time, you can create a complete AI agent without touching infrastructure. A single API call replaces weeks of server, Docker, orchestrator, and sandbox security configuration.
Today's tutorial took you from zero to a functional agent in 6 steps and under 30 minutes. The next step is yours: what will you build with a self-managing agent?
If you test it, let us know in the comments. We want to see what the Brazilian community will create with this.
Related Articles
Also check out: 2026: The Year AI Regulation Left the Drawing Board — Deadlines, Fines, and What Changed in Brazil and the World Also check out: The AI Agent Security Crisis of 2026: 30 Thousand Exposed Instances, 1.5 Million Leaked Tokens, and What It Means for You Also check out: 1,451 AI Devices Approved by the FDA: The Silent Revolution in Healthcare in 2026
Related Articles
The End of AI Generalists: Why Deep Specialization Is Paying 3x More in 2026
Generalist data scientist positions have dropped 62% in two years. Meanwhile, AI agent and MLOps specialists earn up to 3x more. The AI market...
Egress Costs in AI Providers in Brazil: Oracle vs. Global Giants in 2026
Detailed analysis of egress costs in AI services like SageMaker and Vertex AI in Brazil in 2026. Compare Oracle, AWS, Azure, and Google Cloud and see how...
AI as a Service in Brazil in 2026: The New Cloud War and the End of Custom Solutions
Brazilian companies are replacing proprietary AI models with APIs and managed platforms. AWS, Google Cloud, and Azure compete for a US$ 50 billion market...