Email Protocol • AI Agent SDK
EmailProtocol: Protocol for email bots with inbox lifecycle management.
EmailProtocol
Defined in the protocols module.
AI Agent
Protocol for email bots with inbox lifecycle management.
Extends BotProtocol with email-specific capabilities like programmatic inbox creation, listing, and deletion.
This protocol is optional — only AgentMail-style bots that support API-based inbox management need to implement it. Traditional IMAP/SMTP bots (EmailBot) do not implement this.
Methods
email_address()
The bot’s current email address.
create_inbox()Create a new email inbox programmatically.
list_inboxes()List all inboxes accessible to this bot.
delete_inbox()Delete an inbox.
Usage
# Check if a bot supports inbox management
if isinstance(bot, EmailProtocol):
inbox = await bot.create_inbox(domain="mycompany.com")
print(f"Created: {inbox['email_address']}")Source
View on GitHubpraisonaiagents/bots/protocols.py at line 1463