Communication Tools (Email + WhatsApp)

Optional, side-effecting tools for real-world agent workflows: send, list, and read email/WhatsApp messages.

Safety first

  • These tools can send real messages. Keep them behind an approval boundary / allowlist.
  • Secrets are resolved from env vars at execution time (tool args carry env var names, not secrets).
  • Default toolsets in AbstractRuntime only expose these tools when explicitly enabled.

What exists today

Email tools (SMTP/IMAP)

  • send_email
  • list_emails
  • read_email

WhatsApp tools (v1 provider: Twilio)

  • send_whatsapp_message
  • list_whatsapp_messages
  • read_whatsapp_message

Importing the tools

from abstractcore.tools.comms_tools import (
    send_email,
    list_emails,
    read_email,
    send_whatsapp_message,
    list_whatsapp_messages,
    read_whatsapp_message,
)

Opt-in gating (AbstractRuntime default toolsets)

If you use AbstractRuntime’s default tool discovery/execution, comms tools are disabled unless explicitly enabled:

export ABSTRACT_ENABLE_COMMS_TOOLS=1
# or:
export ABSTRACT_ENABLE_EMAIL_TOOLS=1
export ABSTRACT_ENABLE_WHATSAPP_TOOLS=1

If you manually pass tools=[...] in your own Python host, you control the allowlist directly.

Email (Gmail example)

Send and read email via SMTP/IMAP. Passwords are read from an env var (default: EMAIL_PASSWORD).

export EMAIL_PASSWORD="xxxx xxxx xxxx xxxx"  # Gmail App Password

Send an email (tool call payload)

{
  "name": "send_email",
  "arguments": {
    "smtp_host": "smtp.gmail.com",
    "smtp_port": 587,
    "use_starttls": true,
    "username": "xxx@gmail.com",
    "password_env_var": "EMAIL_PASSWORD",
    "to": "you@example.com",
    "subject": "Daily report",
    "body_text": "Hello! Here is the report..."
  }
}

List unread emails since yesterday

{
  "name": "list_emails",
  "arguments": {
    "imap_host": "imap.gmail.com",
    "imap_port": 993,
    "username": "xxx@gmail.com",
    "password_env_var": "EMAIL_PASSWORD",
    "since": "1d",
    "status": "unread",
    "limit": 20
  }
}

WhatsApp (Twilio example)

WhatsApp automation typically uses a provider (v1 uses Twilio). Credentials are read from env vars by default.

export TWILIO_ACCOUNT_SID="AC..."
export TWILIO_AUTH_TOKEN="..."

Send a WhatsApp message

{
  "name": "send_whatsapp_message",
  "arguments": {
    "provider": "twilio",
    "to": "+3306XXXXXXXX",
    "from_number": "+14155238886",
    "body": "Hello from AbstractCore",
    "account_sid_env_var": "TWILIO_ACCOUNT_SID",
    "auth_token_env_var": "TWILIO_AUTH_TOKEN"
  }
}

Related Documentation

Tool Calling System

Allowlists, execution boundaries, tool_calls

HTTP Server Guide

Gateway execution boundaries