Email Agent
Description
Manage the agent's email inbox — create inboxes, send/receive/reply to emails,
search messages, and handle verification flows for service signups.
Supports two providers: AgentMail (cloud API) and SMTP/IMAP (your own server).
Triggers
- send email
- check email
- check inbox
- read email
- sign up with email
- create email
- create inbox
- verify email
- email verification
- forward email
- reply to email
- search email
Instructions
Provider Awareness
EloPhanto supports two email providers:
- AgentMail (provider: agentmail) — cloud-hosted, API-based, agent-native
- SMTP/IMAP (provider: smtp) — your own email server (Gmail, Outlook, etc.)
All 6 email tools work identically regardless of provider. Key differences:
email_create_inbox on SMTP verifies config instead of creating a new inbox.
email_search on SMTP uses keyword matching (not semantic search).
- For SMTP, credentials are SMTP/IMAP username and password (not an API key).
Key Behaviors
First-time setup — If any email tool returns a "credentials not found"
error, handle it conversationally:
- For AgentMail: Ask for an AgentMail API key
(from https://console.agentmail.to), store with
vault_set agentmail_api_key.
- For SMTP: Ask for SMTP/IMAP server details and credentials,
store with
vault_set smtp_username, vault_set smtp_password, etc.
- Then retry the original email operation.
- NEVER tell the user to run CLI commands — handle everything in chat.
Check if you have an inbox first — Use identity_status to check
if you already have an email address in your beliefs before creating a
new one. Only call email_create_inbox if no inbox exists.
Service signups — When signing up for a service:
- Check for existing inbox (
identity_status)
- Create inbox if needed (
email_create_inbox)
- Use browser tools to fill signup forms with your email
- Poll for verification email (
email_list with retries, wait a few seconds between)
- Read verification email, extract link (
email_read)
- Navigate to verification link with browser tools
- Store new account in identity beliefs (
identity_update)
Sending emails — Use email_send for new messages. Be professional
and concise. Never include internal system details, vault credentials,
or private keys in outbound emails.
Responding to emails — Use email_reply to maintain threading.
Always quote relevant context. Use reply_all only when all recipients
need to see the response.
Checking inbox — Use email_list to see recent messages. Use
email_read for full content of a specific message.
Searching — Use email_search with natural language queries.
Examples: "verification emails", "invoices from last week",
"messages from support@hetzner.com".
Never share credentials — API keys and passwords are in the vault.
Only share your inbox address when needed for signups or communication.
Common Workflows
First-Time Setup (AgentMail)
User: "get me an email"
→ Present both providers (AgentMail vs SMTP), ask preference
→ User chooses AgentMail
→ Ask for API key (point to https://console.agentmail.to)
→ vault_set agentmail_api_key <user's key>
→ email_create_inbox → new address created
→ Tell user their new email address
First-Time Setup (SMTP)
User: "use my Gmail for email"
→ Ask for SMTP/IMAP details (host, port, credentials)
→ vault_set smtp_username <email>
→ vault_set smtp_password <app password>
→ Update config.yaml with server details
→ email_create_inbox → verifies connection
→ Tell user their email is verified and ready
Verification Flow
email_create_inbox (if needed)
→ browser: navigate to signup page
→ browser: fill form with agent email
→ browser: submit form
→ email_list (poll with retries for verification email)
→ email_read (extract verification link)
→ browser: navigate to verification link
→ identity_update (store new account)
Invoice Handling
email_list (check for invoice emails)
→ email_read (get invoice details/attachment)
→ document_analyze (parse invoice PDF if attached)
→ payment_preview (show cost)
→ payment_process / crypto_transfer (pay with approval)
→ email_reply (confirm payment)
Verify
- The intended other agent / tool / channel actually received the message; an ack, message ID, or response payload is captured
- Identity, scopes, and permissions used by the call were the minimum required; over-permissioned tokens are called out
- Failure handling was exercised: at least one retry/timeout/permission-denied path is shown to behave as designed
- Hand-off context passed to the next actor is complete enough that the receiver could act without a follow-up question
- Any state mutated (config, memory, queue, file) is listed with before/after values, not just 'updated'
- Sensitive material (keys, tokens, PII) was redacted from logs/transcripts shared in the verification evidence
Notes
- AgentMail creates cloud-hosted inboxes via API — real email addresses
- SMTP/IMAP connects to existing email accounts — emails stay on your server
- Custom domains require a paid AgentMail plan
- Gmail SMTP requires an App Password when 2FA is enabled
- All email operations are logged to the email_log table for audit
1---2name: email-agent3description: Email Agent4---5# Email Agent67## Description8Manage the agent's email inbox — create inboxes, send/receive/reply to emails,9search messages, and handle verification flows for service signups.10Supports two providers: AgentMail (cloud API) and SMTP/IMAP (your own server).1112## Triggers13- send email14- check email15- check inbox16- read email17- sign up with email18- create email19- create inbox20- verify email21- email verification22- forward email23- reply to email24- search email2526## Instructions2728### Provider Awareness2930EloPhanto supports two email providers:31- **AgentMail** (provider: agentmail) — cloud-hosted, API-based, agent-native32- **SMTP/IMAP** (provider: smtp) — your own email server (Gmail, Outlook, etc.)3334All 6 email tools work identically regardless of provider. Key differences:35- `email_create_inbox` on SMTP verifies config instead of creating a new inbox.36- `email_search` on SMTP uses keyword matching (not semantic search).37- For SMTP, credentials are SMTP/IMAP username and password (not an API key).3839### Key Behaviors40411. **First-time setup** — If any email tool returns a "credentials not found"42 error, handle it conversationally:43 - **For AgentMail**: Ask for an AgentMail API key44 (from https://console.agentmail.to), store with `vault_set agentmail_api_key`.45 - **For SMTP**: Ask for SMTP/IMAP server details and credentials,46 store with `vault_set smtp_username`, `vault_set smtp_password`, etc.47 - Then retry the original email operation.48 - NEVER tell the user to run CLI commands — handle everything in chat.49502. **Check if you have an inbox first** — Use `identity_status` to check51 if you already have an email address in your beliefs before creating a52 new one. Only call `email_create_inbox` if no inbox exists.53543. **Service signups** — When signing up for a service:55 - Check for existing inbox (`identity_status`)56 - Create inbox if needed (`email_create_inbox`)57 - Use browser tools to fill signup forms with your email58 - Poll for verification email (`email_list` with retries, wait a few seconds between)59 - Read verification email, extract link (`email_read`)60 - Navigate to verification link with browser tools61 - Store new account in identity beliefs (`identity_update`)62634. **Sending emails** — Use `email_send` for new messages. Be professional64 and concise. Never include internal system details, vault credentials,65 or private keys in outbound emails.66675. **Responding to emails** — Use `email_reply` to maintain threading.68 Always quote relevant context. Use `reply_all` only when all recipients69 need to see the response.70716. **Checking inbox** — Use `email_list` to see recent messages. Use72 `email_read` for full content of a specific message.73747. **Searching** — Use `email_search` with natural language queries.75 Examples: "verification emails", "invoices from last week",76 "messages from support@hetzner.com".77788. **Never share credentials** — API keys and passwords are in the vault.79 Only share your inbox address when needed for signups or communication.8081### Common Workflows8283#### First-Time Setup (AgentMail)84```85User: "get me an email"86 → Present both providers (AgentMail vs SMTP), ask preference87 → User chooses AgentMail88 → Ask for API key (point to https://console.agentmail.to)89 → vault_set agentmail_api_key <user's key>90 → email_create_inbox → new address created91 → Tell user their new email address92```9394#### First-Time Setup (SMTP)95```96User: "use my Gmail for email"97 → Ask for SMTP/IMAP details (host, port, credentials)98 → vault_set smtp_username <email>99 → vault_set smtp_password <app password>100 → Update config.yaml with server details101 → email_create_inbox → verifies connection102 → Tell user their email is verified and ready103```104105#### Verification Flow106```107email_create_inbox (if needed)108 → browser: navigate to signup page109 → browser: fill form with agent email110 → browser: submit form111 → email_list (poll with retries for verification email)112 → email_read (extract verification link)113 → browser: navigate to verification link114 → identity_update (store new account)115```116117#### Invoice Handling118```119email_list (check for invoice emails)120 → email_read (get invoice details/attachment)121 → document_analyze (parse invoice PDF if attached)122 → payment_preview (show cost)123 → payment_process / crypto_transfer (pay with approval)124 → email_reply (confirm payment)125```126127## Verify128129- The intended other agent / tool / channel actually received the message; an ack, message ID, or response payload is captured130- Identity, scopes, and permissions used by the call were the minimum required; over-permissioned tokens are called out131- Failure handling was exercised: at least one retry/timeout/permission-denied path is shown to behave as designed132- Hand-off context passed to the next actor is complete enough that the receiver could act without a follow-up question133- Any state mutated (config, memory, queue, file) is listed with before/after values, not just 'updated'134- Sensitive material (keys, tokens, PII) was redacted from logs/transcripts shared in the verification evidence135136## Notes137- AgentMail creates cloud-hosted inboxes via API — real email addresses138- SMTP/IMAP connects to existing email accounts — emails stay on your server139- Custom domains require a paid AgentMail plan140- Gmail SMTP requires an App Password when 2FA is enabled141- All email operations are logged to the email_log table for audit