Skip to main content

Email Adapter

Requires pip install agentix[gateway-email].

The email adapter uses IMAP polling for inbound email and SMTP for outbound replies. It does not use HTTP webhooks.

Setup

from agentix.gateway.adapters.email import EmailAdapter

gateway.add_channel(
EmailAdapter(
# IMAP (inbound)
imap_host="imap.gmail.com",
imap_port=993,
imap_username="agent@example.com",
imap_password="...",
imap_folder="INBOX",
poll_interval=30, # check for new emails every 30 seconds

# SMTP (outbound)
smtp_host="smtp.gmail.com",
smtp_port=587,
smtp_username="agent@example.com",
smtp_password="...",
smtp_use_tls=True,

from_name="Support Agent",
from_address="agent@example.com",
)
)

YAML config

channels:
email:
type: email
imap_host: imap.gmail.com
imap_port: 993
imap_username: "${EMAIL_USERNAME}"
imap_password: "${EMAIL_PASSWORD}"
poll_interval: 30
smtp_host: smtp.gmail.com
smtp_port: 587
smtp_username: "${EMAIL_USERNAME}"
smtp_password: "${EMAIL_PASSWORD}"
smtp_use_tls: true
from_name: "Support Agent"
from_address: "${EMAIL_USERNAME}"

Gmail setup

For Gmail, use an App Password instead of your regular password. Enable IMAP in Gmail settings.

Session mapping

Each sender email address maps to a dedicated agent session.