๐Ÿ‘ค Author ยท Val Town

An automated email-based research assistant powered by Google's Deep Research AI. Send an email with your research question, and receive a comprehensive research report back via email.

  • Email-triggered research: Send a research query via email to initiate deep research
  • Asynchronous processing: Research runs in the background using Google's Deep Research Pro
  • Automated delivery: Completed research reports are automatically emailed back to you
  • Status tracking: Uses Val Town blob storage to track ongoing research tasks
  • Markdown formatting: Receive beautifully formatted research reports in HTML
  1. Send an email to: deep-research@valtown.email
  2. Subject: Your research topic (e.g., "Latest advances in quantum computing")
  3. Body: Detailed research question or context
  4. Wait: The system will process your request and send the research report back to your email

This val consists of two main components:

  • Type: Email Val
  • Trigger: Incoming email
  • Function:
    • Receives email and extracts the research question
    • Initiates a Deep Research task via Google GenAI API
    • Stores task metadata in blob storage for tracking
    • Returns immediately while research continues in background
  • Type: Interval Val
  • Trigger: Scheduled (periodic check)
  • Function:
    • Polls blob storage for pending research tasks
    • Checks completion status with Google GenAI API
    • Sends email with research results when completed
    • Handles failed research attempts
    • Cleans up completed tasks from storage
  • @google/genai - Google GenAI SDK for Deep Research
  • markdown-it - Markdown to HTML conversion
  • Val Town standard library (blob, email)
Email arrives โ†’ Store task โ†’ Background research
                    โ†“
            Periodic status check
                    โ†“
         Research complete? โ†’ Email results

Tasks are stored in blob storage as:

{ [interactionId]: { interaction: { id, status, ... }, e: { from, subject, text, ... } } }

  • Race condition: Concurrent emails or simultaneous status checks may cause conflicts (noted in code comments)
  • Consider implementing proper locking mechanism for production use
  • Google GenAI API credentials (configured through Val Town secrets)
  • From address: paulkinlan.deep-research-email@valtown.email
  • Reply name: "Deep Research"

Email to send:

To: paulkinlan.deep-research-email@valtown.email
Subject: The impact of AI on software development
Body: I'm interested in understanding how AI tools like
      GitHub Copilot and ChatGPT are changing the way
      developers write code. Please research recent
      trends and statistics.

Response you'll receive: A comprehensive email with:

  • Detailed research findings in HTML format
  • Multiple sources and citations
  • Well-formatted sections and bullet points
  • Original query context included

This val is ready to use as-is. The components are:

  • Email endpoint: Automatically configured by Val Town
  • Cron job: Set to run at configured intervals
  • Blob storage: Managed by Val Town infrastructure

This is a personal project hosted on Val Town.

Paul Kinlan (@paulkinlan)


Built with Val Town ๐Ÿ๏ธ

Read the original on val.town โ†—