Ultra-Fast Email Agents Powered by Groq LPU

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.

Built for Groq API developers

Real-Time Email Processing

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.

Graduated Trust via Oversight Modes

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.

OpenAI-Compatible API

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.

Async Approval Queue

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.

Cost-Effective at Scale

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.


Get started in minutes

Define MultiMail Tools for Groq
python
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.

Build a Fast Email Agent with Groq
python
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.

Batch Email Triage at Speed
python
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 results

Leverage Groq's speed to process and categorize large batches of emails quickly.


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 the Groq Python SDK and requests library for calling the MultiMail API.

bash
pip install groq requests
3

Define Email Tool Schemas

Create tool definitions for send_email, check_inbox, and other MultiMail operations. Groq uses the same OpenAI-compatible format.

4

Build the Agent Loop

Implement a loop that sends messages to Groq, checks for tool_calls, executes tools against MultiMail, and returns results.

bash
response = client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    tools=email_tools,
    messages=messages
)
5

Approve Pending Emails

If your mailbox uses gated_send mode (the default), review and approve pending emails in the MultiMail dashboard before they are delivered.


Common questions

Which Groq model should I use for email agents?
For general email tasks including composition and reasoning, llama-3.3-70b-versatile offers the best balance of speed and quality. For simple triage and categorization tasks, smaller models like llama-3.1-8b-instant are even faster and more cost-effective.
How fast is Groq for email processing?
Groq's LPU typically generates responses in under 500ms for tool calling tasks. This means your email agent can triage an inbox of 20 emails in under 10 seconds, including MultiMail API round trips. The bottleneck shifts from inference to network latency.
What happens when my agent sends an email in gated_send mode?
In gated_send mode, the MultiMail API returns a success response with a pending status. The email is queued for human review in the MultiMail dashboard. The agent can draft dozens of emails rapidly, and the human reviews them at their own pace.
Can I migrate from OpenAI to Groq easily?
Yes. Groq's API is OpenAI-compatible, so your existing email tool definitions and agent loop work with minimal changes. Replace the client initialization with Groq's client and update the model name. The MultiMail integration code stays the same.
Is there rate limiting on the MultiMail API?
Rate limits depend on your plan tier. The Starter (free) plan allows 200 emails per month, while paid plans range from 5,000 to 150,000. The API returns standard 429 responses when limits are reached, which your agent can handle with retry logic.

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.