Inbox Zero Agent
Automatically categorize emails, draft responses, track follow-ups, and keep your inbox at zero
š§ Ingredients
š APIs
read_emails_create_drafts_apply_labels_send_messages
š Alternatives:
alerts_for_urgent_emails_and_follow_up_reminders
š Alternatives:
track_follow_up_status_and_response_times
š Alternatives:
š Step-by-Step Build Guide
Connect to Gmail API with read/write/labels scopes
1. Connect to Gmail API with read/write/labels scopes
Connect to Gmail API with read/write/labels scopes Steps: 1. Validate all required inputs are available 2. Execute the operation described above 3. Verify the result meets expected output format 4. Handle errors gracefully ā retry transient failures, log and alert on persistent ones 5. Return structured output with status and any relevant data If any required data is missing, request it from the user before proceeding.
š§ Human Required
- ⢠## Connect the API 1. Sign up for the service if you don't have an account 2. Find the API settings in your account dashboard 3. Generate an API key or access token 4. Share the key with your agent when prompted š” Most services have a free tier that's sufficient to get started.
Pull unread emails and classify each into categories
2. Pull unread emails and classify each into categories: Action Required, FYI, Newsletter, Automated/Receipts, Spam
Fetch unread emails from Gmail using the Gmail API. GET https://gmail.googleapis.com/gmail/v1/users/me/messages?q=is:unread&maxResults=20 For each message, GET the full message to extract: sender, subject, date, snippet. Classify each email: - š“ Urgent: needs reply today (from known contacts, contains "urgent", "ASAP", time-sensitive) - š” Action Required: needs a response but not time-critical - šµ FYI: newsletters, notifications, CC'd threads - āŖ Low Priority: automated receipts, marketing Return: total unread count, then the top 5 by urgency with sender, subject, and classification.
Apply Gmail labels automatically based on classification
3. Apply Gmail labels automatically based on classification
Apply Gmail labels automatically based on classification Steps: 1. Validate all required inputs are available 2. Execute the operation described above 3. Verify the result meets expected output format 4. Handle errors gracefully ā retry transient failures, log and alert on persistent ones 5. Return structured output with status and any relevant data If any required data is missing, request it from the user before proceeding.
For routine emails (meeting confirmations, simple questions), auto
4. For routine emails (meeting confirmations, simple questions), auto-draft a response
Generate a draft response based on the context. Guidelines: - Match the tone of the original message (formal ā formal, casual ā casual) - Keep it concise ā aim for 2-4 sentences for routine responses - Include specific references to the original message - End with a clear next step or call to action - Don't make commitments or promises on behalf of the user Mark the draft clearly: "[DRAFT ā Review before sending]" Include a confidence score: High (routine/clear intent), Medium (judgment call), Low (complex/sensitive). For Low confidence drafts, explain what needs human judgment.
For emails you've sent that haven't received a reply in 3+ days, create a follow
5. For emails you've sent that haven't received a reply in 3+ days, create a follow-up reminder
For emails you've sent that haven't received a reply in 3+ days, create a follow-up reminder Steps: 1. Validate all required inputs are available 2. Execute the operation described above 3. Verify the result meets expected output format 4. Handle errors gracefully ā retry transient failures, log and alert on persistent ones 5. Return structured output with status and any relevant data If any required data is missing, request it from the user before proceeding.
Daily at 8am
6. Daily at 8am: send an inbox summary ā X unread, Y need action, Z follow-ups pending
Daily at 8am: send an inbox summary ā X unread, Y need action, Z follow-ups pending Steps: 1. Validate all required inputs are available 2. Execute the operation described above 3. Verify the result meets expected output format 4. Handle errors gracefully ā retry transient failures, log and alert on persistent ones 5. Return structured output with status and any relevant data If any required data is missing, request it from the user before proceeding.
Track response times and flag any emails unanswered for >48h
7. Track response times and flag any emails unanswered for >48h
Track response times and flag any emails unanswered for >48h Steps: 1. Validate all required inputs are available 2. Execute the operation described above 3. Verify the result meets expected output format 4. Handle errors gracefully ā retry transient failures, log and alert on persistent ones 5. Return structured output with status and any relevant data If any required data is missing, request it from the user before proceeding.
Weekly
8. Weekly: inbox analytics ā emails received, response rate, average response time, top senders
Send the compiled content via email using the configured email API.
Compose the email:
- To: {recipient_email}
- Subject: {subject_line}
- Body: Format as clean HTML with proper headings, bullet points, and styling.
Use inline CSS for compatibility. Keep it mobile-friendly (max-width: 600px).
Send via the configured email provider (SendGrid, Resend, or SES).
Verify the response indicates successful delivery (202 for SendGrid, 200 for Resend).
Log: timestamp, recipient, subject, and delivery status.
If send fails, retry once after 3 seconds. If it fails again, save the email content locally and alert the user.š¤ Example Agent Prompt
Connect to Gmail API with read/write/labels scopes Steps: 1. Validate all required inputs are available 2. Execute the operation described above 3. Verify the result meets expected output format 4. Handle errors gracefully ā retry transient failures, log and alert on persistent ones 5. Return structured output with status and any relevant data If any required data is missing, request it from the user before proceeding.
Copy this prompt into your agent to get started.