Enterprise Email Agents on Google Vertex AI

Connect Vertex AI's Gemini models and Agent Builder to MultiMail for sending, reading, and managing email — with enterprise governance and human oversight.


Google Cloud's Vertex AI provides enterprise access to Gemini models along with Agent Builder for creating grounded agents with tool use and security controls. MultiMail gives Vertex AI agents the email infrastructure layer they need to send, receive, and manage email within the GCP ecosystem.

By integrating MultiMail with Vertex AI, enterprises get compliance-ready email capabilities for their AI agents. Vertex AI's IAM controls handle model access, and MultiMail's oversight modes handle send authorization. The default gated_send mode means your agent drafts emails but a human approves before delivery.

Connect Vertex AI to MultiMail by defining email functions using Vertex AI's function calling format, or by configuring email tools as extensions in Vertex AI Agent Builder.

Built for Vertex AI developers

Enterprise Compliance

Vertex AI's enterprise focus requires compliance-ready integrations. MultiMail's oversight modes and audit trails satisfy GCP enterprise customers' requirements for AI governance in email communications.

Gemini Function Calling

Vertex AI provides access to Gemini models with function calling. Define MultiMail email operations as function declarations with typed parameters that Gemini fills reliably.

Agent Builder Integration

Vertex AI Agent Builder supports custom tools and extensions. Configure MultiMail email operations as tools in your Agent Builder agent for managed, scalable email agent deployments.

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 rollout strategies for AI capabilities.

GCP Ecosystem Integration

MultiMail complements existing GCP services. Use Cloud Functions or Cloud Run for tool execution, Secret Manager for API key storage, and Cloud Logging for end-to-end observability.


Get started in minutes

Define MultiMail Functions for Vertex AI
python
import vertexai
from vertexai.generative_models import (
    GenerativeModel, Tool, FunctionDeclaration
)
import requests

vertexai.init(project="your-gcp-project", location="us-central1")
MULTIMAIL_API = "https://api.multimail.dev/v1"
MM_HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}

send_email_fn = FunctionDeclaration(
    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"]
    }
)

check_inbox_fn = FunctionDeclaration(
    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"]
    }
)

email_tool = Tool(function_declarations=[send_email_fn, check_inbox_fn])

Create function declarations for email tools using Vertex AI's Gemini SDK.

Build an Email Agent with Vertex AI
python
from vertexai.generative_models import Part, Content

def execute_function(name, args):
    if name == "send_email":
        resp = requests.post(f"{MULTIMAIL_API}/send", headers=MM_HEADERS, json=dict(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=dict(args))
    else:
        return {"error": f"Unknown function: {name}"}
    return resp.json()

model = GenerativeModel(
    model_name="gemini-2.0-flash",
    tools=[email_tool],
    system_instruction="You are an email assistant. Emails use gated_send mode "
    "and queue for human approval before delivery."
)

chat = model.start_chat()
response = chat.send_message("Check my inbox and summarize new messages")

while response.candidates[0].content.parts[0].function_call.name:
    fc = response.candidates[0].content.parts[0].function_call
    result = execute_function(fc.name, fc.args)
    response = chat.send_message(
        Part.from_function_response(name=fc.name, response={"result": result})
    )

print(response.text)

Create an agentic loop using Vertex AI's Gemini SDK with MultiMail email tools.

Cloud Function for Email Tool Execution
python
import functions_framework
from google.cloud import secretmanager
import requests
import json

def get_api_key():
    client = secretmanager.SecretManagerServiceClient()
    name = "projects/your-project/secrets/multimail-api-key/versions/latest"
    response = client.access_secret_version(request={"name": name})
    return response.payload.data.decode("UTF-8")

@functions_framework.http
def handle_email_tool(request):
    """Cloud Function for Vertex AI Agent Builder email tool."""
    data = request.get_json()
    action = data.get("action")
    params = data.get("parameters", {})

    api_key = get_api_key()
    headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
    api = "https://api.multimail.dev/v1"

    if action == "send_email":
        resp = requests.post(f"{api}/send", headers=headers, json=params)
    elif action == "check_inbox":
        mailbox_id = params.pop("mailbox_id")
        resp = requests.get(f"{api}/mailboxes/{mailbox_id}/inbox",
                           headers=headers, params=params)
    elif action == "reply_email":
        resp = requests.post(f"{api}/reply", headers=headers, json=params)
    else:
        return json.dumps({"error": "Unknown action"}), 400

    return json.dumps(resp.json()), 200

Deploy a Cloud Function to handle MultiMail API calls for Vertex AI Agent Builder.


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 it in Google Secret Manager for secure access.

2

Install Dependencies

Install the Vertex AI SDK and requests library for calling the MultiMail API.

bash
pip install google-cloud-aiplatform requests
3

Initialize Vertex AI

Configure the Vertex AI SDK with your GCP project and region. Define email function declarations for Gemini's tool use.

bash
vertexai.init(project="your-project", location="us-central1")
4

Build the Agent

Create a GenerativeModel with email tools and implement the chat-based agent loop with function call handling.

bash
model = GenerativeModel(model_name="gemini-2.0-flash", tools=[email_tool])
chat = model.start_chat()
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 Vertex AI's Gemini SDK or Agent Builder?
Use the Gemini SDK for custom agent implementations where you control the execution loop. Use Agent Builder for managed agents with built-in grounding, memory, and deployment features. Both approaches integrate with MultiMail's email tools.
How does Vertex AI's security model work with MultiMail?
Vertex AI uses GCP IAM for model access control and Secret Manager for credential storage. Store your MultiMail API key in Secret Manager and use service account permissions to access it. MultiMail's oversight modes add email-specific authorization on top of GCP's security.
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 via the list_pending endpoint.
Can I use Vertex AI's grounding features with email agents?
Yes. Vertex AI's grounding can connect your agent to Google Search or custom data stores for context when composing emails. The agent retrieves relevant information through grounding and uses MultiMail to send context-rich emails.
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.