Skip to main content
The Email interface connects agents to email, polling for new messages via IMAP and sending responses via SMTP.

Quick Start

from definable.agent import Agent
from definable.agent.interface.email import EmailInterface

agent = Agent(model="gpt-4o", instructions="You are a helpful email assistant.")

email = EmailInterface(
    imap_host="imap.gmail.com",
    smtp_host="smtp.gmail.com",
    email_address="[email protected]",
    password="app-password",
)

agent.serve(email)

Features

  • IMAP polling for new messages
  • SMTP sending with TLS
  • Thread tracking via In-Reply-To and References headers
  • Multipart body extraction
  • Session management per email thread

Constructor Reference

imap_host
str
required
IMAP server hostname.
smtp_host
str
required
SMTP server hostname.
email_address
str
required
Email address to monitor.
password
str
required
Email password or app-specific password.
imap_port
int
default:"993"
IMAP port (993 for SSL).
smtp_port
int
default:"587"
SMTP port (587 for TLS).
poll_interval
int
default:"30"
Seconds between IMAP polls.

Imports

from definable.agent.interface.email import EmailInterface