DEV Community

Kumar Deepanshu
Kumar Deepanshu

Posted on • Originally published at lumbox.co

Build an Email Agent with Google ADK and Lumbox

Originally published at lumbox.co

Google's Agent Development Kit (ADK) launched with a simple pitch: a Python framework for building, orchestrating, and deploying agent systems that actually ships to production. It handles tool routing, multi-agent coordination, and state. What it doesn't ship with is email — and in 2026, an agent without an inbox can't sign up for anything, can't receive notifications, and can't talk back to a human. Let's fix that.

What ADK gives you out of the box

ADK models agents as Python classes with tools attached. The runtime handles tool selection via the LLM, executes the call, and feeds the result back. Multi-agent setups use the same primitive — one agent becomes another agent's tool. Lumbox slots into this model naturally.

Setup

pip install google-adk lumbox

import os
from google.adk.agents import Agent
from google.adk.tools import FunctionTool
from lumbox import Lumbox

lumbox = Lumbox(api_key=os.environ["LUMBOX_API_KEY"])

def create_inbox(purpose: str) -> dict:
    """Create a fresh email inbox for a specific task."""
    inbox = lumbox.inboxes.create(display_name=purpose)
    return {"inbox_id": inbox.id, "address": inbox.address}

def wait_for_otp(inbox_id: str, timeout: int = 120) -> str:
    """Block until a verification code arrives."""
    return lumbox.inboxes.wait_for_otp(inbox_id, timeout=timeout).otp

def send_email(inbox_id: str, to: str, subject: str, body: str) -> str:
    """Send an email from the given Lumbox inbox."""
    msg = lumbox.inboxes.send(inbox_id=inbox_id, to=to, subject=subject, text=body)
    return f"sent {msg.id}"

email_tools = [
    FunctionTool(create_inbox),
    FunctionTool(wait_for_otp),
    FunctionTool(send_email),
]
Enter fullscreen mode Exit fullscreen mode

The signup agent

signup_agent = Agent(
    name="signup_agent",
    model="gemini-2.5-pro",
    instruction="""
When asked to register, follow this pattern:
  1. Call create_inbox with a short purpose string.
  2. Submit the signup form with the returned address.
  3. Call wait_for_otp with the inbox_id to retrieve the code.
  4. Submit the code to complete verification.
""",
    tools=email_tools + [browser_tool],
)
Enter fullscreen mode Exit fullscreen mode

Multi-agent: one inbox coordinator, many workers

The cleanest pattern for bigger systems: a dedicated inbox coordinator agent owns all email operations, and worker agents call it as a sub-agent. This keeps inbox lifecycle logic in one place and lets workers focus on their domain.

Webhooks for real-time inbound

lumbox.webhooks.create(
    url="https://my-adk-deployment.run.app/email-inbound",
    events=["email.received"],
)
Enter fullscreen mode Exit fullscreen mode

Your ADK runtime receives parsed emails (sender, subject, body, extracted OTP, extracted links, categorization) as structured JSON and routes to the waiting agent. Start with a free Lumbox key at lumbox.co.

Top comments (0)