TL;DR: Google released Gemini Deep Research and Deep Research Max on April 21, 2026. They run on Gemini 3.1 Pro and use a separate
Interactions APIinstead ofgenerateContent. The biggest change for engineers: arbitrary remote MCP server support — you can wire your internal data sources directly into the agent without exfiltrating data. This post walks through end-to-end integration in Python with code you can copy-paste.
If you've been watching the autonomous research agent space, the April 21 Google release is a meaningful step. Two new agents — deep-research-preview-04-2026 for low-latency interactive use and deep-research-max-preview-04-2026 for deep, multi-minute synthesis — both backed by Gemini 3.1 Pro. The benchmark numbers are loud (DeepSearchQA 93.3%, HLE 54.6%, +41% quality vs December), but for engineers building with this, the structural change is MCP support.
Let me show you how to actually integrate it.
What changed (engineer perspective)
Three things matter for integration work:
-
New API surface: Deep Research uses
POST /v1beta/interactions, notgenerateContent. Different request shape, async semantics, streaming events. -
MCP tool type:
toolsarray now accepts{"mcp": {"server_uri": "..."}}for arbitrary remote servers. FactSet/S&P/PitchBook are launch partners. - Collaborative Planning: agent generates a plan first, you approve/modify, then it runs. Saves money on misaligned multi-step work.
Step 1: Setup
pip install google-genai
export GEMINI_API_KEY="your-key-from-aistudio"
You need pay-as-you-go billing enabled on AI Studio. Free tier doesn't get Interactions API.
Step 2: First call (Standard variant)
import os
from google import genai
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
interaction = client.interactions.create(
input="Compare the pricing of OpenAI, Anthropic, and Google APIs as of Q2 2026",
agent="deep-research-preview-04-2026"
)
print(f"Interaction ID: {interaction.id}")
print(f"Initial state: {interaction.state}")
The call returns immediately with an ID. The actual work happens async — you stream or poll.
Step 3: Stream results (this is what you'll actually use)
final_text = []
images = []
citations = []
for event in client.interactions.stream(interaction_id=interaction.id):
if event.type == "thought_summary":
# Show the user what the agent is currently working on
print(f"\n[thinking] {event.content[:80]}...", flush=True)
elif event.type == "text_delta":
final_text.append(event.text)
print(event.text, end="", flush=True)
elif event.type == "image":
# Native chart/infographic generated inline
images.append(event.data)
elif event.type == "citation":
citations.append(event.url)
elif event.type == "done":
break
The thought_summary events are what make this UX-friendly for long-running calls. Surface them in your UI so users know the agent isn't stuck.
Step 4: Add MCP for internal data
Here's where it gets interesting. Connect to your internal MCP server (or one of the launch partners):
interaction = client.interactions.create(
input="Summarize our Q1 sales pipeline by region with year-over-year comparison",
agent="deep-research-max-preview-04-2026",
agent_config={
"collaborative_planning": True,
"tools": [
{"mcp": {
"server_uri": "https://mcp.mycompany.com/sales",
"auth": {"type": "bearer", "token": os.environ["INTERNAL_MCP_TOKEN"]}
}},
{"code_execution": {}},
{"url_context": {}}
# Note: no google_search → web access disabled, internal-only mode
]
}
)
The agent queries your MCP server directly. Your data doesn't leave your infrastructure — only the inferred results flow back through Google's runtime. This is the "federated query" pattern and it's the unlock for regulated industries.
Step 5: Collaborative Planning (recommended for Max)
When you use Max, the agent can burn 30 minutes going down the wrong path. Collaborative Planning is a cheap insurance:
interaction = client.interactions.create(
input="Build a 360-degree competitive analysis of our top 5 competitors",
agent="deep-research-max-preview-04-2026",
agent_config={"collaborative_planning": True}
)
# Agent stops after generating the plan
plan = client.interactions.get_plan(interaction_id=interaction.id)
for i, step in enumerate(plan.steps, 1):
print(f"{i}. {step.description}")
# Inspect/modify, then approve
# (in production, surface the plan in your UI for human review)
client.interactions.run(interaction_id=interaction.id)
In my testing, this catches scope drift early about 40% of the time. Worth the latency hit.
Step 6: Multimodal grounding
You can attach PDF/CSV/images/audio/video as inputs:
with open("q1-2026-financials.pdf", "rb") as f:
pdf_bytes = f.read()
interaction = client.interactions.create(
input="Analyze this earnings report and benchmark against 3 competitors",
agent="deep-research-max-preview-04-2026",
inputs=[{"mime_type": "application/pdf", "data": pdf_bytes}]
)
For larger files, use Gemini Files API to upload first and pass the URI.
Step 7: Multi-turn follow-ups
Follow-up questions don't go through the full Interactions API again — they use the standard model with previous_interaction_id for context:
follow_up = client.models.generate_content(
model="gemini-3.1-pro-preview",
contents="Elaborate on the second risk factor — what's the regulatory exposure?",
previous_interaction_id=interaction.id
)
Fast, single-turn responses with the full prior context.
Production considerations (the not-fun stuff)
- It's beta. The SDK signature will change. Wrap it in your own abstraction so a migration is one PR.
- Cost is variable. One Interactions API call = many model calls + tool calls + MCP traffic. Set spend caps in AI Studio. Add per-interaction budget guards in your code.
- Latency: Standard is faster than December but still not synchronous-friendly for chat UIs. Max is minutes. Use a job queue (Cloud Tasks / Celery / SQS).
- Resumability: streaming connections drop. Plan for resume-from-interaction-id.
- MCP auth: bearer tokens work, but think about rotation, scoping, and audit logs.
- Vertex AI: not shipped yet for these agents. If your enterprise mandates Vertex, you're waiting.
Cost estimation rough numbers
In my testing (small sample, your mileage will vary):
- Standard call, no MCP, 3 sources: ~$0.15–$0.40
- Max call, with MCP + multimodal PDF: ~$2–$8
- Max call, due-diligence-grade with 20+ sources: $10+
Don't let interns hit the "research" button without a budget cap on the account.
What I'd build first
If you have an internal data source that's currently a pain to query (CRM, data warehouse, internal docs), wrapping it as an MCP server and pointing Deep Research Max at it overnight is probably the highest-ROI use case right now. You get a daily briefing on whatever you point it at.
References
Building anything with Deep Research Max? What's your MCP architecture looking like? Drop it in the comments — I'm curious how others are handling the auth and audit-log side.
Top comments (0)