A production-ready command-line interface for the Gemini Deep Research Agent.
This tool unlocks the power of Google's most advanced autonomous research model, allowing you to conduct deep, multi-step investigations, analyze local documents, and generate comprehensive reportsβall from your terminal.
- π Autonomous Deep Research: Powered by Gemini 3 Pro, it plans, searches, reads, and synthesizes complex topics.
- π Smart Context Ingestion: Instantly analyze local PDFs, text files, or folders. The tool handles cloud upload/cleanup automatically.
- πΎ Structured Data Export: Save reports directly to JSON or CSV files with automatic schema enforcement (
--output). - π» Headless Mode: Fire-and-forget research tasks (
start) that run in the background. Perfect for long-running investigations. - ποΈ Session History: Automatically saves your research history to a local database. List past tasks and retrieve old reports instantly.
- β‘ Real-Time Streaming: Watch the agent's "Thought Process" in real-time as it navigates the web.
- π‘οΈ Robust & Resilient: Auto-resumes sessions if the network drops. Features exponential backoff, database retry logic, and an advanced debug mode for maximum stability.
- π¬ Interactive Follow-ups: Chat with the finished report to ask clarifying questions.
- π¦ Portable: Auto-detects its environment. Install globally via
uvor run locally.
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Sync dependencies and set up virtual environment
uv sync
# Run the test suite
uv run pytest
# Execute the application
uv run deep-researchYou need a Google GenAI API Key.
- Get a Key: Google AI Studio
- Set it up:
- Global (Recommended): Run once, use anywhere.
mkdir -p ~/.config/deepresearch echo "GEMINI_API_KEY=your_key_here" > ~/.config/deepresearch/.env
- Local: Create a
.envfile in your current directory.
- Global (Recommended): Run once, use anywhere.
Conduct a deep dive into a topic. The --stream flag shows the agent's thinking.
deep-research research "The history of the internet" --streamHave a contract, a paper, or a set of notes? Analyze them instantly.
# Analyze a single file
deep-research research "What are the liability terms?" --upload ./contract.pdf --stream
# Analyze a whole folder
deep-research research "Summarize the key findings" --upload ./research_papers/ --streamNote: Files are uploaded to a temporary secure store and automatically deleted after the session.
Steer the output format and save structured data.
# Save as Markdown
deep-research research "Compare GPU prices" --output report.md
# Save as JSON (Schema Enforced)
deep-research research "List top 5 cloud providers with market share" --output market_data.json
# Save as CSV
deep-research research "Table of US Presidents and their terms" --output presidents.csvFor complex topics, use --depth 2 to enable the autonomous recursive mode.
- Phase 1: The agent performs initial research and generates a report.
- Gap Analysis: It autonomously analyzes the report for missing information or "gaps".
- Deep Dive: It spawns parallel child research tasks to investigate these gaps.
- Synthesis: It merges all findings into a final, comprehensive answer.
deep-research research "Deep analysis of quantum computing timelines" --depth 2For long tasks, start the research in the background and check back later.
# Start a detached session
deep-research start "Detailed analysis of quantum computing trends"
# Check status
deep-research list
# View result when done
deep-research show 1Interact with your research history. You can use the local Session ID (e.g., 1) or the API Interaction ID.
# Resume session #1
deep-research followup 1 "Can you explain the error correction part simply?"Review your past research sessions and keep your system clean.
# List recent sessions
deep-research list
# Show the report from a specific session ID
deep-research show 1 --save report.html
# Delete a session
deep-research delete 1
# Garbage Collection (Cleanup Stale Cloud Files)
deep-research cleanupUnlock the full potential of your autonomous research agent with these powerful workflows.
Inherit a messy legacy project? Use this to understand it fast.
- The Power: Uses
--uploadto ingest the file structure and key files, and--depth 2to recursively analyze subsystems and identify architectural patterns. - Command:
deep-research "Analyze this codebase. Identify the tech stack, key patterns, and security risks." --upload ./src/ --depth 2
Stuck on an obscure error? Let the agent find the fix.
- The Power: Synthesizes solutions from StackOverflow, GitHub Issues, and official documentation into a single, verified fix, saving you hours of tab-switching.
- Command:
deep-research "Fix 'Error X' in System Y. Synthesize solutions from GitHub issues and docs."
Need to turn a whitepaper into a tweet thread?
- The Power: Uploads long PDF reports and intelligently reformats the key insights into specific social media formats.
- Command:
deep-research "Turn this report into a Tweet thread and a LinkedIn post." --upload report.pdf
Need to compare products for a strategy meeting?
- The Power: Uses
--breadth 5to spawn parallel agents that research multiple competitors simultaneously, and--format CSVto generate a spreadsheet ready for Excel. - Command:
deep-research "Compare top 5 CRM tools. Columns: Pricing, Features, Sentiment." --breadth 5 --format CSV --output crm.csv
Worried about logistics?
- The Power: Traces product dependencies recursively to identify geopolitical bottlenecks (e.g., rare earth metals) and single points of failure.
- Command:
deep-research "Trace the supply chain of Lithium batteries. Identify geopolitical risks." --depth 2
Considering an investment or partnership?
- The Power: Recursively investigates financial health (10-K), recent lawsuits, and leadership history to create a comprehensive risk profile.
- Command:
deep-research "Deep dive on [Company]. Focus on financial health, lawsuits, and leadership." --depth 2
Need funding?
- The Power: Researches specific funding agencies (NSF, NIH) and tailors your project description to align perfectly with their current strategic goals.
- Command:
deep-research "Draft a grant proposal for [Project Idea] aligned with NSF strategic goals."
Writing a thesis or paper?
- The Power: The "Gap Analysis" feature. The agent creates an initial review, realizes "I found papers on X, but I'm missing Y," and automatically spawns child tasks to find the missing citations.
- Command:
deep-research start "Write a literature review on microplastics in soil. Identify research gaps." --depth 3 --breadth 4
Need case law?
- The Power: Recursively analyzes legal databases to find relevant case law in specific jurisdictions and highlights contradictory rulings.
- Command:
deep-research "Find case law regarding [Legal Concept] in [Jurisdiction]. Analyze contradictions."
Studying history?
- The Power: Synthesizes views from multiple historians to construct a detailed counter-factual analysis of major historical events.
- Command:
deep-research "Analyze the Battle of Midway outcomes if [Event X] had changed."
Want a custom news feed?
- The Power: The
-q(Quiet Mode) allows you to run this in a cron job or script, piping the output directly to email or Slack without any logs. - Command:
deep-research -q "Summarize global AI news from the last 24 hours." > morning_brief.txt
Planning a complex trip?
- The Power: Depth ensures specific constraints (e.g., "Gluten-Free", "Kid-Friendly") are checked against actual restaurant menus and venue policies, not just generic lists.
- Command:
deep-research "2-week Japan trip. Gluten-free food, kid-friendly hiking, anime spots." --depth 2
Preparing for a big interview?
- The Power: Recursively looks at the company's recent challenges, the CEO's speeches, and employee reviews to give you talking points that impress.
- Command:
deep-research "Deep dive on [Company]. Focus on recent product launches and culture." --depth 2
Need a gift for a hobby you don't understand?
- The Power: Checks Reddit threads and niche forums to find durable, highly-rated items that enthusiasts actually respect, within your budget.
- Command:
deep-research "Best gift for a 30yo rock climber who loves coffee. Budget $200."
Is that viral video true?
- The Power: Traces claims back to primary sources (studies, raw footage) to identify logical fallacies and misinformation.
- Command:
deep-research "Verify the claims in [Viral Article]. Trace citations to primary sources."
We welcome contributions! This project uses uv for dependency management and pytest for testing.
# Run tests
uv run pytest
# Install pre-commit hooks
git config core.hooksPath .git/hooksThis project is licensed under the MIT License - see the LICENSE file for details.