Email Capabilities for ChatDev Agent Teams

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.

Built for ChatDev developers

Safe External Communications

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.

Phase-Based Email Workflows

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.

Role-Specific Email Access

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.

Collaborative Email Drafting

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.


Get started in minutes

Email Helper Functions
python
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.

ChatDev Phase with Email Integration
python
"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 results

Create a ChatDev phase that processes inbox emails and drafts responses through agent collaboration.

MCP Server Integration
python
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 phases

Connect ChatDev to MultiMail using the MCP server for automatic tool discovery.


Step by step

1

Create a MultiMail Account and API Key

Sign up at multimail.dev, create a mailbox, and generate an API key from your dashboard. Your key will start with mm_live_.

2

Install Dependencies

Install ChatDev and the HTTP library for calling the MultiMail API.

bash
pip install chatdev requests
3

Define Email Functions

Create Python functions that wrap MultiMail API endpoints for send, read, reply, and inbox operations.

4

Add Email Phases to ChatDev

Configure ChatDev phases that include email operations. Assign email capabilities to the appropriate agent role, such as a communications manager.

5

Approve Pending Emails

Review and approve pending emails in the MultiMail dashboard before they are delivered. All emails from gated_send mode appear here.


Common questions

Which ChatDev role should handle email?
Create a dedicated communications role or assign email capabilities to the CEO role, since it handles external-facing decisions. Avoid giving every role email access, as this can lead to duplicate or contradictory outbound messages from different agents in the chain.
Can ChatDev agents collaborate on drafting an email?
Yes. ChatDev's chat chain system lets multiple agents contribute to a message. One agent drafts, another reviews the tone, and a third handles the actual send through MultiMail. The gated_send mode adds a final human review layer before delivery.
How does oversight work with ChatDev's autonomous phases?
MultiMail enforces oversight at the API level regardless of how ChatDev structures its phases. Even if a phase runs autonomously without human involvement, any email sent through the MultiMail API in gated_send mode will be queued for approval before delivery.
Can I test email integration without sending real messages?
Yes. Use MultiMail's gated_send mode during development. All emails are queued for review rather than delivered, so you can inspect the output of your ChatDev email phases without any messages reaching real recipients.

Explore more

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.