Deep Research (Interactions)

Run the Deep Research managed agent through the Gemini Interactions API. The agent plans the task, searches the web, and returns a researched report with citations. The model forces background=True and store=True, and the non-streaming path polls until the result is ready.

Code

1import asyncio
2
3from kern.agent import Agent
4from kern.models.google import GeminiInteractions
5
6agent = Agent(
7 model=GeminiInteractions(
8 agent="deep-research-preview-04-2026",
9 thinking_summaries="auto",
10 visualization="auto",
11 ),
12 markdown=True,
13)
14
15if __name__ == "__main__":
16 agent.print_response(
17 "Research the current state of solid-state battery commercialization "
18 "and summarize the leading approaches."
19 )
20
21 asyncio.run(
22 agent.aprint_response(
23 "Compare the major open-source vector databases on indexing and query latency.",
24 stream=True,
25 )
26 )

Usage

Set up your virtual environment

1uv venv --python 3.12
2source .venv/bin/activate
1uv venv --python 3.12
2.venv\Scripts\activate

Set your API key

1export GOOGLE_API_KEY=xxx

Install dependencies

1uv pip install -U "google-genai>=2.0" kern-ai

Run Agent

1python cookbook/90_models/google/gemini_interactions/deep_research.py