Combine Groq's low-latency LPU inference with MultiMail's email infrastructure for agents that process email in milliseconds — with human oversight built in.
Groq's LPU inference engine delivers extremely low latency for open-source models with tool use support. MultiMail provides the email infrastructure layer that turns this speed advantage into real-time email processing agents capable of triaging, composing, and managing email nearly instantly.
By integrating MultiMail with the Groq API, your agents can process email at speeds that make them practical for real-time workflows. The default gated_send mode means your agent drafts emails instantly but a human still approves before delivery, so speed does not compromise safety.
Connect Groq to MultiMail by defining email tools in Groq's function calling format (OpenAI-compatible) and routing calls to the MultiMail REST API. The familiar API format means minimal migration effort if you are coming from OpenAI.
Groq's LPU delivers sub-second inference times. Combined with MultiMail's API, your agent can triage an inbox, compose replies, and categorize emails faster than any human could read them.
Speed without safety is dangerous. MultiMail's oversight modes ensure that even ultra-fast agents respect human authorization boundaries. Start with gated_send and graduate to autonomous as trust builds.
Groq's API follows OpenAI's function calling format, making it easy to define MultiMail email tools. If you have existing OpenAI email agent code, switching to Groq requires minimal changes.
MultiMail's approval queue means the human review step does not bottleneck Groq's fast inference. The agent drafts dozens of emails in seconds, and the human reviews them at their own pace.
Groq's competitive pricing for open models combined with MultiMail's tiered plans means you can run high-volume email agents without breaking the budget.
from groq import Groq
import requests
import json
client = Groq(api_key="your_groq_api_key")
MULTIMAIL_API = "https://api.multimail.dev/v1"
MM_HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}
email_tools = [
{
"type": "function",
"function": {
"name": "send_email",
"description": "Send an email through MultiMail. In gated_send mode, queues for human approval.",
"parameters": {
"type": "object",
"properties": {
"mailbox_id": {"type": "string", "description": "Mailbox to send from"},
"to": {"type": "string", "description": "Recipient email"},
"subject": {"type": "string", "description": "Subject line"},
"body": {"type": "string", "description": "Email body"}
},
"required": ["mailbox_id", "to", "subject", "body"]
}
}
},
{
"type": "function",
"function": {
"name": "check_inbox",
"description": "Check inbox for recent messages.",
"parameters": {
"type": "object",
"properties": {
"mailbox_id": {"type": "string", "description": "Mailbox to check"},
"limit": {"type": "integer", "description": "Max messages"}
},
"required": ["mailbox_id"]
}
}
}
]Create tool definitions using Groq's OpenAI-compatible function calling format.
def execute_tool(name, args):
if name == "send_email":
resp = requests.post(f"{MULTIMAIL_API}/send", headers=MM_HEADERS, json=args)
elif name == "check_inbox":
resp = requests.get(
f"{MULTIMAIL_API}/mailboxes/{args[&"cm">#039;mailbox_id']}/inbox",
headers=MM_HEADERS, params={"limit": args.get("limit", 10)}
)
elif name == "reply_email":
resp = requests.post(f"{MULTIMAIL_API}/reply", headers=MM_HEADERS, json=args)
elif name == "tag_email":
resp = requests.post(
f"{MULTIMAIL_API}/emails/{args[&"cm">#039;message_id']}/tag",
headers=MM_HEADERS, json={"tag": args["tag"]}
)
else:
return {"error": f"Unknown tool: {name}"}
return resp.json()
def run_email_agent(user_message, mailbox_id):
messages = [
{"role": "system", "content": f"You are a fast email assistant for mailbox {mailbox_id}. "
f"Emails use gated_send mode and queue for human approval."},
{"role": "user", "content": user_message}
]
while True:
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=messages,
tools=email_tools
)
msg = response.choices[0].message
if msg.tool_calls:
messages.append(msg)
for tc in msg.tool_calls:
result = execute_tool(tc.function.name, json.loads(tc.function.arguments))
messages.append({
"role": "tool", "tool_call_id": tc.id,
"content": json.dumps(result)
})
else:
return msg.content
print(run_email_agent("Triage my inbox and tag urgent emails", "mbx_abc123"))Create an agentic loop leveraging Groq's speed for rapid email processing.
import time
def triage_inbox(mailbox_id, batch_size=20):
"""Use Groq&"cm">#039;s speed to triage an entire inbox rapidly."""
# Fetch emails via MultiMail API
resp = requests.get(
f"{MULTIMAIL_API}/mailboxes/{mailbox_id}/inbox",
headers=MM_HEADERS, params={"limit": batch_size}
)
emails = resp.json().get("messages", [])
start = time.time()
results = []
for email in emails:
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[
{"role": "system", "content": "Categorize this email as: urgent, "
"action_required, informational, or spam. Reply with JSON: "
&"cm">#039;{"category": "...", "summary": "..."}'},
{"role": "user", "content": f"From: {email[&"cm">#039;from']}\n"
f"Subject: {email[&"cm">#039;subject']}\nBody: {email['body']}"}
]
)
category = json.loads(response.choices[0].message.content)
# Tag in MultiMail
requests.post(
f"{MULTIMAIL_API}/emails/{email[&"cm">#039;id']}/tag",
headers=MM_HEADERS, json={"tag": category["category"]}
)
results.append({"id": email["id"], **category})
elapsed = time.time() - start
print(f"Triaged {len(emails)} emails in {elapsed:.1f}s")
return resultsLeverage Groq's speed to process and categorize large batches of emails quickly.
Sign up at multimail.dev, create a mailbox, and generate an API key from your dashboard. Your key will start with mm_live_.
Install the Groq Python SDK and requests library for calling the MultiMail API.
pip install groq requestsCreate tool definitions for send_email, check_inbox, and other MultiMail operations. Groq uses the same OpenAI-compatible format.
Implement a loop that sends messages to Groq, checks for tool_calls, executes tools against MultiMail, and returns results.
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
tools=email_tools,
messages=messages
)If your mailbox uses gated_send mode (the default), review and approve pending emails in the MultiMail dashboard before they are delivered.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.