Gemini Deep Research
Use Gemini's Deep Research Agent to perform complex, long-running context gathering and synthesis tasks.
Prerequisites
- -
GEMINI_API_KEY environment variable (from Google AI Studio) - Note: This does NOT work with Antigravity OAuth tokens. Requires a direct Gemini API key.
How It Works
Deep Research is an agent that:
- 1. Breaks down complex queries into sub-questions
- Searches the web systematically
- Synthesizes findings into comprehensive reports
- Provides streaming progress updates
Usage
Basic Research
CODEBLOCK0
Custom Output Format
CODEBLOCK1
With File Search (optional)
CODEBLOCK2
Stream Progress
CODEBLOCK3
Output
The script saves results to timestamped files:
- -
deep-research-YYYY-MM-DD-HH-MM-SS.md - Final report in markdown - INLINECODE2 - Full interaction metadata
API Details
- - Endpoint: INLINECODE3
- Agent: INLINECODE4
- Auth:
x-goog-api-key header (NOT OAuth Bearer token)
Limitations
- - Requires Gemini API key (get from Google AI Studio)
- Does NOT work with Antigravity OAuth authentication
- Long-running tasks (minutes to hours depending on complexity)
- May incur API costs depending on your quota
Gemini 深度研究
使用 Gemini 的深度研究代理执行复杂、长时间运行的上下文收集与综合任务。
前提条件
- - GEMINIAPIKEY 环境变量(来自 Google AI Studio)
- 注意:此功能不适用于 Antigravity OAuth 令牌。需要直接使用 Gemini API 密钥。
工作原理
深度研究是一个代理,它能够:
- 1. 将复杂查询分解为子问题
- 系统性地搜索网络
- 将发现结果综合为全面报告
- 提供流式进度更新
使用方法
基础研究
bash
scripts/deep_research.py --query 研究 Google TPU 的发展历史
自定义输出格式
bash
scripts/deep_research.py --query 研究电动汽车电池的竞争格局 \
--format 1. 执行摘要\n2. 主要参与者(包含数据表格)\n3. 供应链风险
可选的文件搜索
bash
scripts/deep_research.py --query 将我们 2025 财年报告与当前公开网络新闻进行比较 \
--file-search-store fileSearchStores/my-store-name
流式进度
bash
scripts/deep_research.py --query 你的研究主题 --stream
输出
脚本将结果保存到带时间戳的文件中:
- - deep-research-YYYY-MM-DD-HH-MM-SS.md - Markdown 格式的最终报告
- deep-research-YYYY-MM-DD-HH-MM-SS.json - 完整交互元数据
API 详情
- - 端点:https://generativelanguage.googleapis.com/v1beta/interactions
- 代理:deep-research-pro-preview-12-2025
- 认证:x-goog-api-key 标头(非 OAuth Bearer 令牌)
限制
- - 需要 Gemini API 密钥(从 Google AI Studio 获取)
- 不适用于 Antigravity OAuth 认证
- 长时间运行的任务(根据复杂度,耗时数分钟到数小时)
- 可能根据配额产生 API 费用