Supyagent
Examples & Recipes

Email Summarizer

Build a daemon agent that reads Gmail inbox, summarizes emails, and posts digests to Slack.

Email Summarizer

This example builds a daemon agent that periodically reads your Gmail inbox, summarizes important emails, and posts a digest to a Slack channel. It uses supyagent's cloud integrations for Gmail and Slack access.

Prerequisites

  1. Connect Gmail and Slack integrations:
supyagent connect    # Authenticate with the service
  1. On the dashboard, enable Gmail (read access) and Slack (post access) integrations.

  2. Verify the tools are available:

supyagent service tools --provider google
supyagent service tools --provider slack

The Agent YAML

agents/email-summarizer.yaml
name: email-summarizer
description: Summarizes Gmail inbox and posts digests to Slack
version: "1.0"
type: daemon

model:
  provider: anthropic/claude-sonnet-4-5-20250929
  temperature: 0.3
  max_tokens: 4096

schedule:
  interval: 30m                 # Poll every 30 minutes
  max_events_per_cycle: 20      # Process up to 20 emails per cycle
  prompt: |
    Check for new emails since the last cycle. For any important
    emails (from team members, clients, or containing action items),
    create a summary and post it to the #email-digest Slack channel.

system_prompt: |
  You are an email summarization daemon. Your job is to:

  1. Read recent emails from Gmail
  2. Identify important messages (ignore newsletters, promotions, automated notifications)
  3. Create concise summaries of important emails
  4. Post a digest to the #email-digest Slack channel

  ## What counts as important:
  - Emails from team members or clients
  - Messages containing action items, deadlines, or decisions
  - Direct questions that need a response
  - Calendar invitations or meeting changes

  ## Digest format:
  Post a single Slack message with this format:

  **Email Digest** (N new important emails)

  1. **From:** [sender] | **Subject:** [subject]
     Summary: [1-2 sentence summary]
     Action needed: [yes/no + what]

  2. ...

  If no important emails are found, do not post to Slack.

  ## When processing inbox events:
  - Each event contains an email summary and metadata
  - Archive events after processing
  - Use memory to track which senders are important based on past patterns

tools:
  allow:
    - "*"

memory:
  enabled: true                 # Remember important contacts and patterns
  extraction_threshold: 3       # Extract knowledge frequently

service:
  enabled: true                 # Use cloud integrations (Gmail, Slack)

limits:
  max_tool_calls_per_turn: 100  # Allow many tool calls for batch processing

How It Works

Daemon Loop

When you run supyagent daemon email-summarizer, the agent:

  1. Wakes up every 30 minutes (controlled by schedule.interval)
  2. Checks the inbox for unread events from Gmail
  3. Processes up to 20 events per cycle (schedule.max_events_per_cycle)
  4. The schedule.prompt is sent to the LLM along with any inbox events
  5. The agent uses Gmail tools to read email details and Slack tools to post digests
  6. Processed events are archived
  7. Memory extracts patterns (important senders, recurring topics)

Memory Integration

With memory.enabled: true, the agent learns over time:

  • Which senders consistently send important emails
  • Recurring topics and project names
  • Your preferences for what counts as important

This means the summaries improve with use.

Running the Daemon

Standard Mode

supyagent daemon email-summarizer

Output:

Daemon starting: email-summarizer (every 30m, max 20 events/cycle)
Press Ctrl+C to stop

[14:00:00] Cycle 1: 8 event(s) in 12.3s -- OK
[14:30:00] Cycle 2: 3 event(s) in 5.1s -- OK
[15:00:00] Cycle 3: 0 event(s) -- skipped

Dry Run (Test One Cycle)

supyagent daemon email-summarizer --dry-run

This runs a single cycle and exits, useful for testing.

Override Interval

supyagent daemon email-summarizer --interval 5m    # Check every 5 minutes
supyagent daemon email-summarizer --interval 1h    # Check every hour

Verbose Output

supyagent daemon email-summarizer --verbose

Shows the full agent response for each cycle, useful for debugging.

Customization

Add Calendar Events

Extend the system prompt to include Google Calendar:

system_prompt: |
  You are a daily briefing daemon. Every morning at 8am:
  1. Summarize important emails from the last 12 hours
  2. List today's calendar events
  3. Post a combined briefing to #daily-standup

schedule:
  interval: 1h
  prompt: |
    Check for new emails and today's calendar events.
    Create a combined briefing.

Filter by Label

Modify the prompt to focus on specific Gmail labels:

schedule:
  prompt: |
    Check Gmail for emails labeled "client" or "urgent" since
    the last cycle. Summarize and post to #urgent-digest.

Multiple Channels

Route different email types to different Slack channels:

system_prompt: |
  Route email summaries to the appropriate Slack channel:
  - Client emails -> #client-updates
  - Engineering emails -> #eng-digest
  - HR/admin emails -> #admin-notices
  - Everything else -> #general-digest

Monitoring

Check daemon telemetry to track performance:

supyagent telemetry email-summarizer

View inbox events that have been processed:

supyagent inbox -s archived -p google