Bridge CAMEL's multi-agent role-playing with real email delivery — using MultiMail's oversight modes to safely transition from simulation to production.
CAMEL is a communicative agents framework for studying multi-agent behaviors through role-playing. Its agents take on specific roles and collaborate on tasks through structured dialogue. When these role-playing scenarios need to interact with the real world via email, MultiMail provides the safe bridge.
MultiMail's oversight modes are particularly valuable for CAMEL because role-playing agents may simulate business communications that shouldn't immediately become real emails. The gated_send mode lets agents compose emails naturally during role-play while a human decides which ones to actually deliver.
Integration uses CAMEL's tool system. Define MultiMail API functions as tools available to ChatAgent instances, giving role-playing agents email capabilities with built-in safety controls.
CAMEL agents role-playing business scenarios may draft realistic emails. MultiMail's gated_send mode lets these drafts exist as reviewable items rather than delivered messages, safely bridging simulation and real communication.
Different CAMEL roles can have different email capabilities. An executive agent might have send access while a research agent only reads. MultiMail's per-mailbox oversight modes enable this fine-grained control.
CAMEL's society framework models group interactions. MultiMail extends this to external email, letting agent societies coordinate on outbound communications while maintaining human oversight.
Studying multi-agent email behavior requires detailed logs. MultiMail's audit trail records every email action with context, providing research-grade data on how role-playing agents handle communications.
import requests
from camel.toolkits import FunctionTool
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) -> str:
"""Send an email via MultiMail. In gated_send mode, the email is
queued for human approval before delivery."""
resp = requests.post(f"{MULTIMAIL_API}/send", headers=HEADERS, json={
"mailbox_id": mailbox_id,
"to": to,
"subject": subject,
"body": body
})
return str(resp.json())
def check_inbox(mailbox_id: str) -> str:
"""Check inbox for recent messages."""
resp = requests.get(
f"{MULTIMAIL_API}/mailboxes/{mailbox_id}/inbox",
headers=HEADERS,
params={"limit": 10}
)
return str(resp.json())
"cm"># Wrap as CAMEL tools
send_email_tool = FunctionTool(send_email)
check_inbox_tool = FunctionTool(check_inbox)Create tool functions that CAMEL ChatAgents can invoke for email operations.
from camel.agents import ChatAgent
from camel.messages import BaseMessage
from camel.types import ModelType
"cm"># Create a role-playing agent with email capabilities
assistant_sys_msg = BaseMessage.make_assistant_message(
role_name="Executive Assistant",
content=(
"You are an executive assistant handling email correspondence. "
"Use the send_email tool to draft emails and check_inbox to "
"review incoming messages. All outbound emails go through "
"gated_send mode — a human approves before delivery."
)
)
assistant = ChatAgent(
system_message=assistant_sys_msg,
model_type=ModelType.GPT_4O,
tools=[send_email_tool, check_inbox_tool]
)
"cm"># The agent can now role-play with email capabilities
user_msg = BaseMessage.make_user_message(
role_name="Manager",
content="Check our inbox and draft a reply to any "
"pending client inquiries."
)
response = assistant.step(user_msg)
print(response.msg.content)Create CAMEL role-playing agents that use email tools in their interactions.
from camel.societies import RolePlaying
from camel.types import TaskType
"cm"># Create a role-playing session focused on email management
role_play = RolePlaying(
assistant_role_name="Customer Success Agent",
user_role_name="Sales Director",
task_prompt=(
"Review the support inbox, categorize inquiries by urgency, "
"and draft professional responses. Use the MultiMail tools "
"to check inbox and send replies. All emails will be queued "
"for approval in gated_send mode before delivery."
),
assistant_agent_kwargs={"tools": [send_email_tool, check_inbox_tool]},
task_type=TaskType.DEFAULT
)
"cm"># Run the role-playing session
for i in range(5): "cm"># Max 5 conversation turns
assistant_response, user_response = role_play.step()
if assistant_response.terminated or user_response.terminated:
break
print(f"Turn {i+1}:")
print(f" Assistant: {assistant_response.msg.content[:100]}...")
print(f" User: {user_response.msg.content[:100]}...")Set up a CAMEL society where agents collaborate on email-driven tasks.
Sign up at multimail.dev, create a mailbox, and generate an API key from your dashboard. Your key will start with mm_live_.
Install CAMEL and the HTTP library for calling the MultiMail API.
pip install camel-ai requestsDefine Python functions for send_email, check_inbox, and reply_email that call the MultiMail REST API. Wrap each with CAMEL's FunctionTool.
Create ChatAgent instances with email tools and system messages that explain the oversight mode. Only assign email tools to roles that need them.
Review pending emails in the MultiMail dashboard. In gated_send mode, no email is delivered until a human approves it.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.