Skip to content

Conversation

@johnny603
Copy link

@johnny603 johnny603 commented Jan 23, 2026

Description

Integrate a mail service to enable email notifications for budget alerts using the third-party email provider, Resend. The code paths already exist and just need to be connected.

  • Simple API and SDK
  • Generous free tier (100 emails/day, 3,000/month)
  • Excellent TypeScript support
  • Easy integration with Node.js backend
  • Better deliverability than building custom SMTP

Config keys: RESEND_API_KEY, ALERT_EMAIL_FROM, ALERT_EMAIL_RECIPIENTS
Docs updated: email-service-guide.md, config.yaml.example

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

Related Issues

Fixes #7

Changes Made

  • Implemented Resend provider integration and client initialization using RESEND_API_KEY.
  • Connected the existing budget alert pipeline to send email via the mail service abstraction.
  • Added configuration fields and examples (ALERT_EMAIL_FROM, ALERT_EMAIL_RECIPIENTS) in config.yaml.example and documented setup in email-service-guide.md.
  • Added basic text/HTML email templates including alert context (project/agent, threshold, current spend).
  • Extended unit tests around the email service and alert path (e.g., verifying send_email is invoked on threshold breach).

Testing

Describe the tests you ran to verify your changes:

Unit tests targeted the email service and budget alert code path, asserting that emails are sent when thresholds are breached.
Manual verification using Resend (test mode), confirming delivery to recipients and template rendering.

# Unit tests
cd core
pytest tests/test_email_service.py -q
pytest -q

# Lint
cd core
ruff check .

# Manual test: set env and simulate an alert
export RESEND_API_KEY="your_resend_api_key"
export ALERT_EMAIL_FROM="noreply@yourdomain.com"
export ALERT_EMAIL_RECIPIENTS="devops@yourdomain.com,finance@yourdomain.com"

# Trigger a budget alert via your existing alert simulation/run path
# (e.g., run a job that exceeds a test threshold)
# Observe email delivery in the Resend dashboard or recipient inbox
  • Unit tests pass (cd core && pytest tests/)
  • Lint passes (cd core && ruff check .)
  • Manual testing performed

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots (if applicable)

N/A

@RichardTang-Aden
Copy link
Collaborator

Email shouldn't be limit to notifications anymore, since we are focusing on agent generation. Please try to make it usable as a tool for the generated agent.

Refactored email functionality from notification-only system to a
general-purpose tool accessible by generated agents via Model Context
Protocol (MCP).

Changes:
- Added two MCP tools: send_email() and send_templated_email()
- Extended EmailService with generic email methods while preserving
  backward compatibility with existing budget alert system
- Implemented 4 reusable email templates:
  * notification - General updates and alerts
  * report - Report delivery with date metadata
  * approval_request - Human-in-the-loop approvals
  * completion - Task completion notifications
- Integrated with centralized credential management system
- Added comprehensive test coverage (40 tests, 100% passing)

Technical Details:
- Created email_tool package in tools/src/aden_tools/tools/
- Added EMAIL_CREDENTIALS spec for Resend API integration
- Registered tools in MCP server for agent discoverability
- Maintained separation: system uses EmailService directly,
  agents use MCP tools
- Added 16 new tests for generic email methods
- Created 6 integration tests for email tool

Files Added:
- tools/src/aden_tools/credentials/email.py
- tools/src/aden_tools/tools/email_tool/ (package)
- tools/tests/tools/test_email_tool.py
- EMAIL_TOOL_IMPLEMENTATION_SUMMARY.md

Files Modified:
- core/framework/services/email_service.py (+398 lines)
- core/tests/test_email_service.py (+302 lines)
- tools/src/aden_tools/credentials/__init__.py
- tools/src/aden_tools/tools/__init__.py

Agents can now:
- Send custom emails for notifications and reports
- Request human approval via templated emails
- Communicate task completion to stakeholders
- Use flexible HTML or plain text formatting

Closes adenhq#158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support third party email service

2 participants