Give ChatDev's collaborative agents the ability to send, read, and manage real email — with oversight controls that keep automated communications safe.
ChatDev simulates a virtual software company where LLM agents collaborate through natural language, taking on roles like CEO, CTO, programmer, and tester. When these agents need to communicate externally — sending project updates, client reports, or support responses — MultiMail provides the email infrastructure with safety controls.
MultiMail's oversight modes complement ChatDev's collaborative approach. In gated_send mode, any email drafted by a ChatDev agent is queued for human review before delivery. This means your agent team can autonomously decide when and what to email, but a human always approves the final message.
Integration works by adding email capabilities to ChatDev's phase system. Define custom phases that include MultiMail API calls for sending, reading, and replying to email.
ChatDev agents communicate freely internally through chat chains. When those communications need to extend to real email recipients, MultiMail's oversight ensures a human reviews every outbound message.
ChatDev organizes work into phases. MultiMail integrates naturally — an inbox check phase feeds context to a drafting phase, which creates emails queued in the approval phase before delivery.
Not every ChatDev role should send email. Assign email tools only to appropriate roles (like a communications agent) while other roles focus on their specialties without email access.
Multiple ChatDev agents can contribute to an email draft through their chat chain process. MultiMail's API receives the final collaborative output for delivery after human approval.
import requests
MULTIMAIL_API = "https://api.multimail.dev/v1"
HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}
def send_email(to: str, subject: str, body: str, mailbox_id: str) -> dict:
"""Send an email via MultiMail. Queued for approval in gated_send mode."""
resp = requests.post(f"{MULTIMAIL_API}/send", headers=HEADERS, json={
"mailbox_id": mailbox_id,
"to": to,
"subject": subject,
"body": body
})
return resp.json()
def check_inbox(mailbox_id: str, limit: int = 10) -> dict:
"""Check inbox for new messages."""
resp = requests.get(
f"{MULTIMAIL_API}/mailboxes/{mailbox_id}/inbox",
headers=HEADERS,
params={"limit": limit}
)
return resp.json()
def read_email(message_id: str) -> dict:
"""Read a specific email by ID."""
resp = requests.get(
f"{MULTIMAIL_API}/emails/{message_id}",
headers=HEADERS
)
return resp.json()Define email functions that ChatDev agents can call during their phases.
"cm"># In your ChatDev configuration, add email-capable phases
"cm"># This example shows how agents collaborate on email responses
import json
def email_processing_phase(mailbox_id: str):
"""Phase where ChatDev agents process incoming emails."""
"cm"># Step 1: Check inbox
inbox = check_inbox(mailbox_id)
messages = inbox.get("messages", [])
results = []
for msg in messages:
"cm"># Step 2: Read full email
email = read_email(msg["id"])
"cm"># Step 3: Agent collaboration produces the reply
"cm"># (In ChatDev, this happens through the chat chain
"cm"># between CEO, CTO, and programmer roles)
reply_body = f"""Thank you for reaching out regarding \
{email.get(&"cm">#039;subject', 'your inquiry')}.
Our team has reviewed your message and we will follow up \
with a detailed response shortly.
Best regards,
The Team"""
# Step 4: Queue reply for human approval
result = requests.post(
f"{MULTIMAIL_API}/reply",
headers=HEADERS,
json={"message_id": msg["id"], "body": reply_body}
).json()
results.append(result)
return resultsCreate a ChatDev phase that processes inbox emails and drafts responses through agent collaboration.
import subprocess
import json
"cm"># Start the MultiMail MCP server as a subprocess
"cm"># ChatDev agents can then discover and invoke email tools
mcp_process = subprocess.Popen(
["npx", "-y", "@multimail/mcp-server"],
env={"MULTIMAIL_API_KEY": "mm_live_your_api_key"},
stdin=subprocess.PIPE,
stdout=subprocess.PIPE
)
"cm"># The MCP server exposes these tools:
"cm"># - send_email: Compose and send (queued in gated_send mode)
"cm"># - check_inbox: List recent messages
"cm"># - read_email: Get full email content
"cm"># - reply_email: Reply within a thread
"cm"># - search_contacts: Find contacts
"cm"># - add_contact: Create a new contact
"cm"># - get_thread: Retrieve full thread history
"cm"># - tag_email: Categorize emails
"cm"># - list_mailboxes: List available mailboxes
"cm"># - create_mailbox: Set up a new mailbox
"cm"># Your ChatDev agents interact with these tools
"cm"># through the MCP protocol during their phasesConnect ChatDev to MultiMail using the MCP server for automatic tool discovery.
Sign up at multimail.dev, create a mailbox, and generate an API key from your dashboard. Your key will start with mm_live_.
Install ChatDev and the HTTP library for calling the MultiMail API.
pip install chatdev requestsCreate Python functions that wrap MultiMail API endpoints for send, read, reply, and inbox operations.
Configure ChatDev phases that include email operations. Assign email capabilities to the appropriate agent role, such as a communications manager.
Review and approve pending emails in the MultiMail dashboard before they are delivered. All emails from gated_send mode appear here.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.