# MAX - Master Email Agent

**CONFIDENTIAL - DO NOT SHARE**

---

## AGENT IDENTITY

**Name:** MAX
**Full Title:** Master Email Agent
**Purpose:** Handles ALL email operations for Helix Media Engine
**Status:** ACTIVE
**Deployed:** Render (github-com-new.onrender.com)

---

## FILE LOCATION

```
C:\Users\Paul\Desktop\helixmediaengine\api\max_agent.py
```

**Integrated into:** `agent_api_protected.py`

---

## RESEND API

**API Key:**
```
re_EqixYSN6_GdCJxHbgk6nPZkcrKhZERZvG
```

**Dashboard:** https://resend.com/emails

---

## SUB-AGENTS (Email Identities)

| Agent | Email | Site | Purpose |
|-------|-------|------|---------|
| VITA | vita@helixmediaengine.com | longevityfutures.online | Longevity Futures emails |
| ASTRO | astro@helixmediaengine.com | eventfollowers.com | Event Followers emails |
| ENTITY | entity@helixmediaengine.com | eventfollowers.com | Premium chat emails |
| SAGE | sage@helixmediaengine.com | silent-ai.com | Silent AI emails |
| MAX | max@helixmediaengine.com | helixmediaengine.com | System emails |
| SUPPORT | support@helixmediaengine.com | helixmediaengine.com | Support emails |

---

## AUDIENCES (Subscriber Lists)

| Name | Purpose |
|------|---------|
| vita | Longevity Futures subscribers |
| astro | Event Followers subscribers |
| sage | Silent AI subscribers |
| all | Master list (everyone) |

Audiences auto-create in Resend if they don't exist.

---

## CAPABILITIES

- Welcome emails (auto-send on signup)
- Newsletter sending (manual trigger)
- AI-powered auto-responses (inbound email handling)
- Purchase confirmations
- Affiliate notifications
- Subscriber database management
- Open/click tracking via Resend

---

## API ENDPOINTS

**Base URL:** https://github-com-new.onrender.com

| Endpoint | Method | What it does |
|----------|--------|--------------|
| `/api/email/subscribe` | POST | Subscribe + send welcome email |
| `/api/email/subscribers` | GET | Get all subscribers |
| `/api/newsletter/send` | POST | Send newsletter to all |
| `/api/newsletter/test` | POST | Test newsletter to one email |
| `/api/vita/subscribers/add` | POST | Add VITA subscriber |
| `/api/vita/subscribers/stats` | GET | Get VITA stats |
| `/api/vita/test-email` | POST | Send test welcome email |
| `/api/webhook/email/vita` | POST | Resend inbound webhook |

---

## KEY FUNCTIONS

```python
# Welcome emails
send_welcome_vita(email, name)
send_welcome_astro(email, name)
send_welcome_sage(email, name)
send_welcome_entity(email, name)

# Subscriber management
add_contact(email, agent, first_name, last_name)
remove_contact(email, agent)
get_contacts(agent)
get_stats()

# Wrapper (used by API)
send_welcome_email(email, agent, name)
add_subscriber(email, agent, name)
```

---

## PROJECT IMMORTAL FLOW

```
longevityfutures.online/project-immortal.html
                |
                v
    User enters email, clicks Join
                |
                v
    POST /api/email/subscribe
    { email, agent: 'vita', source: 'project-immortal' }
                |
                v
    MAX calls send_welcome_email(email, 'vita')
                |
                v
    Welcome email sent instantly
                |
                v
    Subscriber added to VITA audience
                |
                v
    Ready for weekly newsletters
```

---

## DASHBOARD

**Status Page:** `helix-command-centre/max-vita-status.html`

Shows:
- Total subscribers
- Today's signups
- This week's signups
- Unsubscribed count
- Recent subscriber list
- Add/remove subscribers
- Send test emails

---

## NOTES

- All emails sent FROM @helixmediaengine.com domain
- Resend handles deliverability, tracking, bounces
- No Mailchimp needed - Resend does it all
- Audiences persist in Resend (cloud storage)

---

**Last Updated:** January 2026
**Status:** ACTIVE
