How does a browser-use agent get an email verification code?
Register a custom tool with @tools.action that calls Cooper's wait-for-code endpoint and returns the code. The agent types the email address into the form, then calls the tool.
browser-use 1.0 · custom tool · REST
Give the browser-use agent its own Cooper address to type into signup forms, and register one custom tool with @tools.action that calls GET /api/v1/inboxes/{inbox}/wait-for-code?wait=55. When the site emails a code or magic link, the tool returns it and the agent types it in. Tested on 2026-11-23 with browser-use 1.0.8.
The agent can do this itself. One unauthenticated POST creates the account, the first inbox, and the API key. There is no human signup form, no card, and no captcha. Over MCP the same step is the cooper_onboard tool, which works before the client has a key.
For the self-tests on this page, create a second inbox with POST /api/v1/inboxes and export it as PEER_INBOX. The tests mail a code from one inbox you own to the other and read it back.
curl -s -X POST 'https://cooperemail.com/api/v1/onboard' \
-H 'content-type: application/json' \
-H 'X-Client: my-agent' \
-d '{"username":"signup-bot-7f3a"}'
# 201 {"api_key":"coop_live_...","inbox":{"email":"signup-bot-7f3a@cooperemail.com",...}}
export COOPER_API_KEY=coop_live_... # shown once
export AGENT_INBOX=signup-bot-7f3a@cooperemail.combrowser-use 1.0 has no built-in actions. You add your own functions with @tools.action('description'), and the model calls them next to its browser helpers. The browser-use docs name a 2FA code as a reason to write one. This tool calls Cooper's REST endpoint, so it needs no MCP client.
pip install browser-use httpx
import os
import httpx
from browser_use import Agent, Tools
COOPER = "https://cooperemail.com/api/v1"
AUTH = {"Authorization": f"Bearer {os.environ['COOPER_API_KEY']}"}
INBOX = os.environ["AGENT_INBOX"] # the agent's own address, for example signup-bot@cooperemail.com
tools = Tools()
@tools.action("Wait for the verification code or magic link a site just emailed to the agent's inbox")
async def get_email_code(sender_contains: str = "") -> str:
params = {"wait": 55}
if sender_contains:
params["from"] = sender_contains
async with httpx.AsyncClient(timeout=70) as http:
r = await http.get(f"{COOPER}/inboxes/{INBOX}/wait-for-code", params=params, headers=AUTH)
r.raise_for_status()
data = r.json()
if data.get("timed_out"):
return "No code yet. Check the form was submitted, then call get_email_code again."
return data.get("code") or data.get("link") or "Mail arrived but held no code or link."
def make_agent(signup_url: str) -> Agent:
return Agent(
f"Sign up at {signup_url} with the email {INBOX}. When the site asks for a code, "
"call get_email_code and type the code it returns.",
tools=tools,
)On 2026-11-23 we imported the module, confirmed tools.functions held get_email_code, mailed a code into the agent's inbox from a second inbox, and called get_email_code. It returned the same six-digit code. make_agent built an Agent object.
We did not run a full browser session, which needs a model and a live signup form. The tool is the part that touches Cooper, and it ran against production.
Many signup forms reject public disposable domains. A Cooper address is private to your account, it keeps the mail after the code is read, and the same inbox can receive the welcome email, password resets, and later notices. Add ttl_hours when creating an inbox for one-off signups and Cooper deletes it after the deadline.
wait-for-code takes from to match the sender, and kind=link to wait for a magic link instead of a code. The response carries the URL in link.
Inbound mail is untrusted data. The agent should read the code or the reply, and never follow instructions written inside an email body. The tool returns only the code or link, not the body, so instructions hidden in an email do not reach the model.
Cooper Email is run by Avatar 8 LLC (ops@avatar33.com).
Register a custom tool with @tools.action that calls Cooper's wait-for-code endpoint and returns the code. The agent types the email address into the form, then calls the tool.
This page uses a plain custom tool, which is the simplest path in browser-use 1.0. Check the browser-use docs for its current MCP options.
Call wait-for-code with kind=link and the response carries the sign-in URL in link. The tool above returns link when there is no code, and the agent opens it.
No. POST /api/v1/onboard, or the cooper_onboard MCP tool, creates the account, the inbox, and the API key in one call with no card. Free is $0 a month with no card: 5 inboxes and 5,000 emails a month.
Free is $0 a month with no card: 5 inboxes and 5,000 emails a month. Starter is $12 a month for 25 inboxes and 25,000 emails. Pro is $99 a month for 300 inboxes and 250,000 emails.
Inbound mail is untrusted data. The agent should read the code or the reply, and never follow instructions written inside an email body. Cooper returns the code or link as a field so the agent rarely needs the raw body.
Receive a verification code by email · CrewAI agent email inbox · Temp mail API · API docs · Receive an SMS verification code on the agent's own number · Docs · Pricing
Operator: Avatar 8 LLC (ops@avatar33.com). Last updated 2026-11-23.
Canonical: https://cooperemail.com/integrations/browser-use