Skip to main content

Research anything, deeply, in one line of code. A Python library wrapping Google Gemini Deep Research API.

Project description

Deep Probe

Research anything, deeply, in one line of code.

A Python library that wraps Google Gemini Deep Research API with automatic reconnection and structured output.

Features

  • Simple API: One line of code to run deep research
  • Auto-reconnection: Handles network failures with exponential backoff
  • Structured output: Pydantic models for type-safe results
  • Sync & Async: Both synchronous and asynchronous interfaces
  • Streaming: Real-time output with thought summaries
  • CLI tool: Rich-powered command-line interface
  • Resume support: Resume interrupted research operations

Installation

pip install deep-probe

Quick Start

Python API

from deep_probe import DeepProbe

# Initialize (uses GEMINI_API_KEY environment variable)
probe = DeepProbe()

# Run research
result = probe.research("What is quantum computing?")

# Access the report
print(result.report)

# Save to file
result.save("report.md")

Async API

import asyncio
from deep_probe import DeepProbe

async def main():
    probe = DeepProbe()
    result = await probe.research_async("AI trends 2024")
    print(result.report)

asyncio.run(main())

Streaming API

from deep_probe import DeepProbe

probe = DeepProbe()

def on_text(text: str):
    print(text, end="", flush=True)

def on_thought(thought: str):
    print(f"\n💭 {thought}\n")

result = probe.research_stream(
    "What is the future of AI?",
    on_text=on_text,
    on_thought=on_thought,
)

CLI

# Basic usage
deep-probe "What is quantum computing?"

# Save to file
deep-probe "AI trends 2024" --save report.md

# Show thinking process
deep-probe "Climate change effects" --verbose

# Stream output in real-time
deep-probe "Research topic" --stream

# Quiet mode (only output report)
deep-probe "Test topic" --quiet

# Resume previous research
deep-probe --resume "interaction-id-here"

Configuration

Set your Google Gemini API key:

export GEMINI_API_KEY='your-api-key'

Or create a .env file:

GEMINI_API_KEY=your-api-key

Get your API key from Google AI Studio.

API Reference

DeepProbe

Main client for running deep research.

from deep_probe import DeepProbe, ResearchResult

# Initialize with optional settings
probe = DeepProbe(
    api_key="optional-api-key",  # Or use GEMINI_API_KEY env var
    thinking_summaries=True,      # Enable thinking summaries output
)

# Synchronous research
result: ResearchResult = probe.research("topic")

# Asynchronous research
result: ResearchResult = await probe.research_async("topic")

# Streaming research with callbacks
result: ResearchResult = probe.research_stream(
    "topic",
    on_text=lambda text: print(text, end=""),
    on_thought=lambda thought: print(f"💭 {thought}"),
)

# Resume previous research
result: ResearchResult = probe.resume("interaction-id")
result: ResearchResult = await probe.resume_async("interaction-id")

ResearchResult

result.report          # str - The research report in markdown
result.sources         # list[Citation] - Sources cited
result.thoughts        # list[Thought] - Research process/thinking summaries
result.cost_usage      # TokenUsage - Token statistics
result.interaction_id  # str - Unique identifier for resume
result.status          # ResearchStatus - Final status

result.save("file.md")  # Save to file

Exceptions

from deep_probe.exceptions import (
    DeepProbeError,      # Base exception
    ProbeAuthError,      # API key issues
    ProbeNetworkError,   # Connection failures (includes interaction_id)
    ProbeTimeoutError,   # Time limit exceeded
    ProbeAPIError,       # Server-side errors
    ProbeCancelledError, # User cancellation
)

Auto-Reconnection

DeepProbe handles network failures automatically:

Scenario Action Max Retries Delay
Network disconnect Auto-reconnect 3 2s → 4s → 8s
API rate limit Wait and retry 3 60s
Auth error No retry 0 N/A

All network errors include interaction_id for resuming interrupted research.

Google Gemini Deep Research

This library uses the deep-research-pro-preview-12-2025 agent from Google's Gemini API. Key characteristics:

  • Max duration: 60 minutes per research task
  • Sources: Uses Google Search and URL context tools
  • Pricing: ~$2-5 per task (estimates from Google)
  • Output: Markdown-formatted research reports

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check .

# Run type checking
mypy src/

License

Apache License 2.0

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deep_probe-0.1.2.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deep_probe-0.1.2-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file deep_probe-0.1.2.tar.gz.

File metadata

  • Download URL: deep_probe-0.1.2.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for deep_probe-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fc0003cdce7e2b71446f0f0041af37d9fe6d02465a01738076225c34a5ec3d6a
MD5 08b28ba7a06fc0d9242213b25994ca0b
BLAKE2b-256 00a21baaf232f2ab979f07729a26751f788d37ea305cb96ef39a6e4afcf2836e

See more details on using hashes here.

File details

Details for the file deep_probe-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: deep_probe-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for deep_probe-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38f98a65cac517a4953932d04cfa65bd062818e72d424e6df26dbf83c41da9e3
MD5 1b42bdea873d108f3a244c5dde67f55f
BLAKE2b-256 3534819342722551a9845bf5c15f23fb9321a006094475dbb80a951b3e938b4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page