Give AI agents their own email inboxes using the AgentMail API. Use when building email agents, sending/receiving emails programmatically, managing inboxes, handling attachments, organizing with labels, creating drafts for human approval, or setting up real-time notifications via webhooks/websockets. Supports multi-tenant isolation with pods.
100
100%
Does it follow best practices?
Impact
100%
1.20xAverage score across 1 eval scenario
Advisory
Suggest reviewing before use
A startup called NovaSpark is launching a new AI-powered analytics feature to their beta users. The team has a list of five early adopters who have been waiting for this announcement and need to be contacted today. The engineering team has been given access to an AgentMail account to send these notifications programmatically.
The outreach coordinator wants a reliable solution: if one email fails to send (maybe a user's inbox is temporarily unavailable or there's a transient API error), the script should not stop sending to the others — every user on the list must receive an attempt. The team also wants to be able to safely re-run the script without duplicating emails, since deployment pipelines sometimes retry failed jobs. Finally, emails should be tagged for tracking purposes so the team can later filter sent messages by campaign.
Write a single self-contained script named send_notifications.py (Python) or send_notifications.ts (TypeScript) that:
The script should read the API key from an environment variable named AGENTMAIL_API_KEY.
Each email should have a subject of "NovaSpark Analytics: Your Early Access Is Ready" and include a brief announcement that the feature is now available, with a personal greeting using the recipient's first name.
The following files are provided as inputs. Extract them before beginning.
=============== FILE: inputs/beta_users.json =============== [ { "name": "Alice Chen", "email": "alice.chen@techcorp.io" }, { "name": "Bob Martins", "email": "bob.martins@devstudio.com" }, { "name": "Carol Singh", "email": "carol.singh@cloudfirm.net" }, { "name": "David Okafor", "email": "david.okafor@startuplabs.co" }, { "name": "Elena Vasquez", "email": "elena.vasquez@bigdata.org" } ]