Google ADK

Give your Google ADK agent its own email inbox

Getting started

Google Agent Development Kit (ADK) is an open-source framework for building AI agents. By connecting AgentMail to your ADK agent via the AgentMail MCP server, your agent can create inboxes, send and receive emails, manage threads, and handle attachments using natural language.

Use cases

  • Give agents their own inboxes: Create dedicated email addresses for your agents so they can send and receive emails independently, just like a human team member.
  • Automate email workflows: Let your agent handle email conversations end to end, including sending initial outreach, reading replies, and following up on threads.
  • Manage conversations across inboxes: List and search across threads and messages, forward emails, and retrieve attachments to keep your agent informed and responsive.

Prerequisites

  1. An AgentMail account with an API key from the AgentMail Console
  2. Google ADK installed (pip install google-adk or npm install @google/adk)

Setup

ADK supports AgentMail through the MCP tool interface. Connect the AgentMail MCP server as a local stdio transport:

1from google.adk.agents import Agent
2from google.adk.tools.mcp_tool import McpToolset
3from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams
4from mcp import StdioServerParameters
5
6AGENTMAIL_API_KEY = "YOUR_AGENTMAIL_API_KEY"
7
8root_agent = Agent(
9 model="gemini-2.5-pro",
10 name="agentmail_agent",
11 instruction="Help users manage email inboxes and send messages",
12 tools=[
13 McpToolset(
14 connection_params=StdioConnectionParams(
15 server_params=StdioServerParameters(
16 command="npx",
17 args=[
18 "-y",
19 "agentmail-mcp",
20 ],
21 env={
22 "AGENTMAIL_API_KEY": AGENTMAIL_API_KEY,
23 }
24 ),
25 timeout=30,
26 ),
27 )
28 ],
29)

Available tools

Once connected, your ADK agent has access to the following AgentMail tools:

Inbox management

ToolDescription
list_inboxesList all inboxes
get_inboxGet details for a specific inbox
create_inboxCreate a new inbox with a username and domain
delete_inboxDelete an inbox

Thread management

ToolDescription
list_threadsList threads in an inbox
get_threadGet a specific thread with its messages
get_attachmentDownload an attachment from a message

Message operations

ToolDescription
send_messageSend a new email from an inbox
reply_to_messageReply to an existing message
forward_messageForward a message to another recipient
update_messageUpdate message properties such as read status