Deep Research Streaming (Interactions)
Stream real-time progress (thought summaries, text, generated images) from a Deep Research task instead of waiting for the final report. Set thinking_summaries="auto" to receive intermediate reasoning during streaming. Background execution is required for agents and is enabled automatically.
Code
1import asyncio23from kern.agent import Agent4from kern.models.google import GeminiInteractions56agent = Agent(7 model=GeminiInteractions(8 agent="deep-research-preview-04-2026",9 thinking_summaries="auto",10 ),11 markdown=True,12)1314if __name__ == "__main__":15 agent.print_response(16 "Research the history and impact of Google TPUs.",17 stream=True,18 )1920 asyncio.run(21 agent.aprint_response(22 "Research the current state of open-source LLM inference engines.",23 stream=True,24 )25 )Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export GOOGLE_API_KEY=xxxInstall dependencies
1uv pip install -U "google-genai>=2.0" kern-aiRun Agent
1python cookbook/90_models/google/gemini_interactions/deep_research_streaming.py