AI / Google Antigravity Gemini Fundamentals Interview Questions
What are Managed Agents in the Gemini API and how do they differ from building agents yourself?
Managed Agents is a Gemini API feature (in public preview as of mid-2026) that lets developers build and deploy autonomous, stateful agents that run in secure, isolated Google-hosted Linux sandbox environments. Unlike building your own agent loop, managed agents handle the infrastructure of multi-step execution, sandboxing, and state management.
| Aspect | DIY agent loop | Managed Agents (Gemini API) |
|---|---|---|
| Infrastructure | Developer manages execution env | Google-hosted secure sandbox |
| Sandboxing | Developer responsible | Isolated per session by Google |
| State management | Developer manages session state | Google manages agent state |
| Code execution | Requires code interpreter tool setup | Built-in; native Linux execution |
| Long tasks | Timeout and reconnect challenges | background=true; persistent execution |
| Monitoring | Custom logging | Observable steps in Interactions API |
| Current agents | N/A | Antigravity (general), Deep Research |
from google import genai client = genai.Client() # Invoke a managed agent exactly like a model call: interaction = client.interactions.create( model="antigravity-preview-05-2026", # managed agent input="Build and test a Python REST API with FastAPI.", ) # The agent handles: # 1. Planning the approach # 2. Writing the FastAPI code # 3. Installing dependencies (pip install fastapi uvicorn) # 4. Running tests # 5. Reporting results # All inside its sandbox - zero infrastructure from you # You can also mix agents and models in one conversation: research = client.interactions.create( model="gemini-deep-research-preview", # Deep Research agent input="Research best practices for API authentication", ) # Follow up with a standard model using the research context: followup = client.interactions.create( model="gemini-3.5-flash", input="Now implement authentication based on this research.", previous_interaction_id=research.id, # carries context forward )
More Related questions...