Skip to content

[Admin Assistant] Task 3: Email Monitoring (AgentMail + Gmail) #183

@jsirish

Description

@jsirish

Overview

Implement comprehensive email monitoring for AgentMail and Gmail with urgent item detection.

Requirements

AgentMail Integration

Account: jsirish@agentmail.to

Features:

  • Check for new messages every 30 minutes
  • Summarize new messages
  • Flag action items
  • Auto-categorize (urgent, normal, newsletter, notifications)
  • Thread tracking

API:

from agentmail import Client
client = Client()
messages = client.inboxes.messages.list(inbox_id='jsirish@agentmail.to')

Gmail Integration

Features:

  • Monitor Jason's Gmail for urgent items
  • Search queries:
    • is:unread newer_than:1h is:important
    • from:client@domain.com newer_than:4h
    • label:urgent newer_than:1d
  • Sender priority list (clients, partners, family)
  • Keyword detection (urgent, asap, emergency, deadline)

API:

gog gmail search 'is:unread newer_than:1h is:important' --json

Urgent Email Detection

Priority Senders:

  • Clients (from CRM)
  • Team members
  • Family/contacts
  • Service providers

Priority Keywords:

  • urgent, asap, emergency, deadline, today, tomorrow
  • meeting, call, review, approval needed
  • invoice, payment, contract

Alert Thresholds:

  • Priority sender + unread > 15 min → Alert immediately
  • Keyword match + unread > 30 min → Alert
  • Normal email → Batch in next briefing

Email Triage Workflow

  1. Fetch new emails since last check
  2. Categorize by sender and content
  3. Score urgency (0-100)
  4. Alert if score > threshold
  5. Summarize in next briefing
  6. Track in memory for follow-up

Deliverables

  • AgentMail integration script
  • Gmail integration script
  • Urgent email detector
  • Sender priority list
  • Keyword detection
  • Alert system
  • Email summarization

Acceptance Criteria

  • New emails detected within 30 min
  • Urgent emails alerted within 5 min
  • Categorization accurate
  • Summaries concise
  • No false positives on alerts
  • All emails tracked

Technical Notes

  • Use agentmail Python SDK
  • Use gog CLI for Gmail
  • Store state in memory/email-state.json
  • Cache sender priorities
  • Log all alerts for review

Relates to #182

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions