Google ADK
Build a Google ADK agent with Scalekit-authenticated Gmail tools. Scalekit returns native ADK tool objects; no schema reshaping needed.
Build a Google ADK agent that reads a user’s Gmail inbox. Scalekit handles OAuth, token storage, and returns tools as native ADK tool objects compatible with any ADK agent.
Full code on GitHubInstall
Section titled “Install”pip install scalekit-sdk-python google-adkInitialize
Section titled “Initialize”import osimport asyncioimport scalekit.client
scalekit_client = scalekit.client.ScalekitClient( client_id=os.getenv("SCALEKIT_CLIENT_ID"), client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"), env_url=os.getenv("SCALEKIT_ENV_URL"),)actions = scalekit_client.actionsConnect the user to Gmail
Section titled “Connect the user to Gmail”response = actions.get_or_create_connected_account( connection_name="gmail", identifier="user_123",)if response.connected_account.status != "ACTIVE": link = actions.get_authorization_link(connection_name="gmail", identifier="user_123") print("Authorize Gmail:", link.link) input("Press Enter after authorizing...")See Authorize a user for production auth handling.
Build and run the agent
Section titled “Build and run the agent”actions.google.get_tools() returns native ADK tool objects. Pass them directly to a Google ADK Agent:
from google.adk.agents import Agentfrom google.adk.runners import Runnerfrom google.adk.sessions import InMemorySessionServicefrom google.genai import types
tools = actions.google.get_tools( identifier="user_123", connection_names=["gmail"],)
agent = Agent( name="gmail_assistant", model="gemini-2.0-flash", instruction="You are a helpful Gmail assistant.", tools=tools,)
async def main(): session_service = InMemorySessionService() runner = Runner(agent=agent, app_name="gmail_app", session_service=session_service) session = await session_service.create_session(app_name="gmail_app", user_id="user_123")
message = types.Content( role="user", parts=[types.Part(text="Fetch my last 5 unread emails and summarize them")], ) async for event in runner.run_async( user_id="user_123", session_id=session.id, new_message=message, ): if event.is_final_response(): print(event.response.text)
asyncio.run(main())Use MCP instead
Section titled “Use MCP instead”Google ADK supports MCP via MCPToolset. Connect to a Scalekit-generated MCP URL to skip tool setup:
from google.adk.agents import Agentfrom google.adk.tools.mcp_tool.mcp_toolset import MCPToolset, StreamableHTTPConnectionParams
agent = Agent( name="gmail_assistant", model="gemini-2.0-flash", instruction="You are a helpful Gmail assistant.", tools=[ MCPToolset( connection_params=StreamableHTTPConnectionParams(url=mcp_url) ) ],)See Generate user MCP URLs to get mcp_url.