Enterprise Email Agents on AWS Bedrock

Connect AWS Bedrock Agents to MultiMail for sending, reading, and managing email — with enterprise guardrails and configurable human oversight.


AWS Bedrock provides managed access to foundation models from multiple providers, along with Bedrock Agents for building agentic applications with tool use, knowledge bases, and guardrails. MultiMail gives Bedrock Agents the email infrastructure layer they need to send, receive, and manage email within the AWS ecosystem.

By integrating MultiMail with AWS Bedrock, enterprises get defense-in-depth for AI-initiated email: Bedrock Guardrails filter content at the model level, and MultiMail's oversight modes control send authorization. The default gated_send mode means your Bedrock Agent drafts emails but a human approves before delivery.

Connect Bedrock to MultiMail by defining email actions as Lambda-backed action groups in Bedrock Agents, or by using the Converse API with tool definitions that call the MultiMail REST API.

Built for AWS Bedrock developers

Defense-in-Depth for Enterprise

Bedrock Guardrails filter harmful content at the model level. MultiMail adds email-specific oversight on top — content safety from AWS, send authorization from MultiMail. Two independent safety layers for enterprise compliance.

Bedrock Agents Action Groups

Define MultiMail email operations as action groups in Bedrock Agents. Each action group maps to a Lambda function that calls the MultiMail API, giving your agent structured email capabilities.

Multi-Model Support

Bedrock provides access to Claude, Llama, Mistral, and other models. Test different models for email quality while keeping the same MultiMail integration — switch the model ID without changing your action groups.

Audit Trail and Compliance

MultiMail's comprehensive audit logs complement AWS CloudTrail. Together, they provide end-to-end traceability for every AI-initiated email action, satisfying enterprise governance requirements.

Graduated Trust via Oversight Modes

Start with gated_send (agent composes, human approves) and progress to autonomous as trust builds. MultiMail's oversight modes align with enterprise change management processes.


Get started in minutes

Call MultiMail via Bedrock Converse API
python
import boto3
import requests
import json

bedrock = boto3.client(&"cm">#039;bedrock-runtime', region_name='us-east-1')
MULTIMAIL_API = "https://api.multimail.dev/v1"
MM_HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}

tool_config = {
    "tools": [
        {
            "toolSpec": {
                "name": "send_email",
                "description": "Send an email through MultiMail. In gated_send mode, queues for human approval.",
                "inputSchema": {
                    "json": {
                        "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"]
                    }
                }
            }
        },
        {
            "toolSpec": {
                "name": "check_inbox",
                "description": "Check inbox for recent messages.",
                "inputSchema": {
                    "json": {
                        "type": "object",
                        "properties": {
                            "mailbox_id": {"type": "string", "description": "Mailbox to check"},
                            "limit": {"type": "integer", "description": "Max messages"}
                        },
                        "required": ["mailbox_id"]
                    }
                }
            }
        }
    ]
}

Define email tools using the Bedrock Converse API's tool configuration and call MultiMail.

Build an Email Agent with Bedrock Converse
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)
    else:
        return {"error": f"Unknown tool: {name}"}
    return resp.json()

def run_bedrock_email_agent(user_message, mailbox_id):
    messages = [{"role": "user", "content": [{"text": user_message}]}]
    system = [{"text": f"You are an email assistant for mailbox {mailbox_id}. "
               f"Emails use gated_send mode and queue for human approval."}]

    while True:
        response = bedrock.converse(
            modelId="anthropic.claude-sonnet-4-20250514-v1:0",
            messages=messages,
            system=system,
            toolConfig=tool_config
        )
        output = response["output"]["message"]
        messages.append(output)

        if response["stopReason"] == "tool_use":
            tool_results = []
            for block in output["content"]:
                if "toolUse" in block:
                    result = execute_tool(block["toolUse"]["name"], block["toolUse"]["input"])
                    tool_results.append({
                        "toolResult": {
                            "toolUseId": block["toolUse"]["toolUseId"],
                            "content": [{"json": result}]
                        }
                    })
            messages.append({"role": "user", "content": tool_results})
        else:
            return output["content"][0]["text"]

print(run_bedrock_email_agent("Check my inbox", "mbx_abc123"))

Create an agentic loop using the Bedrock Converse API with MultiMail tools.

Lambda Action Group for Bedrock Agents
python
import json
import urllib3

http = urllib3.PoolManager()
MULTIMAIL_API = "https://api.multimail.dev/v1"

def lambda_handler(event, context):
    """Bedrock Agent action group Lambda for MultiMail email operations."""
    action = event.get("actionGroup")
    api_path = event.get("apiPath")
    parameters = {p["name"]: p["value"] for p in event.get("parameters", [])}
    body = json.loads(event.get("requestBody", {}).get("content", {}).get(
        "application/json", {}).get("properties", "[]"))
    body_dict = {item["name"]: item["value"] for item in body} if body else {}

    api_key = get_secret("multimail-api-key")  "cm"># AWS Secrets Manager
    headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}

    if api_path == "/send":
        resp = http.request("POST", f"{MULTIMAIL_API}/send",
                           headers=headers, body=json.dumps(body_dict))
    elif api_path == "/inbox":
        mailbox_id = parameters.get("mailbox_id")
        resp = http.request("GET", f"{MULTIMAIL_API}/mailboxes/{mailbox_id}/inbox",
                           headers=headers)
    else:
        return {"statusCode": 400, "body": "Unknown action"}

    return {
        "messageVersion": "1.0",
        "response": {
            "actionGroup": action,
            "apiPath": api_path,
            "httpMethod": event.get("httpMethod"),
            "httpStatusCode": resp.status,
            "responseBody": {"application/json": {"body": resp.data.decode()}}
        }
    }

Create a Lambda function that serves as a Bedrock Agent action group for MultiMail email operations.


Step by step

1

Create a MultiMail Account and API Key

Sign up at multimail.dev, create a mailbox, and generate an API key. Store the key in AWS Secrets Manager for secure access from Lambda functions.

2

Install Dependencies

Install boto3 and requests for the Converse API approach, or set up a Lambda function for the Bedrock Agents approach.

bash
pip install boto3 requests
3

Define Email Tools or Action Groups

For the Converse API, define toolSpec objects for email operations. For Bedrock Agents, create an OpenAPI schema and Lambda function for email action groups.

4

Build and Test the Agent

Implement the agent loop using the Converse API, or configure your Bedrock Agent with email action groups and test via the Bedrock console.

bash
response = bedrock.converse(
    modelId="anthropic.claude-sonnet-4-20250514-v1:0",
    messages=messages,
    toolConfig=tool_config
)
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

Should I use Bedrock Agents or the Converse API?
Use Bedrock Agents for managed agent deployments with built-in memory, knowledge bases, and guardrails. Use the Converse API for custom agent implementations where you control the loop. Both approaches work well with MultiMail's email tools.
How do Bedrock Guardrails interact with MultiMail's oversight?
They work as independent safety layers. Bedrock Guardrails filter harmful or off-topic content at the model level before tool calls are generated. MultiMail's oversight modes control whether emails are actually sent — gated_send queues them for human approval regardless of guardrail status.
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. Once approved, it is delivered. Your agent can check the status of pending emails using the list_pending endpoint.
How do I store the MultiMail API key securely in AWS?
Store the API key in AWS Secrets Manager and retrieve it at runtime from your Lambda function or application code. Never hardcode the key in your Bedrock Agent configuration or Lambda code. Use IAM roles to control access to the secret.
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.