We raised $6M in Seed FundingRead more
ReplitReplit + AgentMail

Build email agents on Replit

AgentMail is the fastest way to give a Replit agent its own email inbox. Your agent gets its own inbox, can send and receive email, and polls for replies.

[ Install ]

One command

The AgentMail SDK installs in one line on Replit. Add your API key to Replit Secrets and your agent has a real inbox.

Add to requirements.txt
agentmail
anthropic
python-dotenv
Add API key to Replit Secrets
# Tools -> Secrets -> Add secret
# Key:   AGENTMAIL_API_KEY
# Value: am_us_your_key_here
[ Why email ]

Why your Replit agent needs its own inbox

No SMTP config required

Replit projects often use shared IPs that are rate-limited by email providers. AgentMail has its own dedicated infrastructure - your agent emails land in inboxes, not spam.

API key stays secure

Store your API key in Replit Secrets, not your code. The AgentMail SDK reads from environment variables automatically.

Fork and deploy in minutes

Start from the official AgentMail Replit template. Fork it, add your API key, and have a working email agent running in under 5 minutes.

[ Code ]

Working code

import os, time
from agentmail import AgentMail
from anthropic import Anthropic

client = AgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))
claude = Anthropic()

inbox = client.inboxes.create()
print(f"Agent inbox: {inbox.inbox_id}")

client.inboxes.messages.send(
    inbox_id=inbox.inbox_id,
    to="prospect@example.com",
    subject="Quick question",
    text="Hi - building something in the AI space and wanted to connect.",
)

while True:
    time.sleep(30)
    messages = client.inboxes.messages.list(inbox_id=inbox.inbox_id)
    for msg in (messages.messages or []):
        reply = claude.messages.create(
            model="claude-haiku-4-5-20251001",
            max_tokens=10,
            messages=[{
                "role": "user",
                "content": f"Classify as INTERESTED / NOT_INTERESTED / OOO:\n{msg.text}"
            }]
        ).content[0].text.strip()
        print(f"{msg.from_address}: {reply}")
[ FAQ ]

FAQ

Common questions about AgentMail and Replit.

How do I use AgentMail on Replit?
Add agentmail to requirements.txt, store your API key in Replit Secrets as AGENTMAIL_API_KEY, and import it in your code. The SDK reads the key automatically from environment variables.
Is there a Replit template I can fork?
Yes. Fork the official AgentMail template on Replit, add your API key to Secrets, and you have a working email agent in minutes.
Why not use Replit's built-in email features?
Replit's built-in email tools are for sending notifications from the platform, not for building agents with their own email identity. AgentMail gives your agent a real inbox it owns and can read from.
Can I use webhooks on Replit?
Yes. Every Replit project gets a public URL. Point your AgentMail webhook at your Replit app URL and it will receive incoming email events in real time.
Does the Node.js SDK work on Replit too?
Yes. Both the Python and Node.js SDKs work on Replit. Install with npm install agentmail and use the same AGENTMAIL_API_KEY secret.
Why not just use the Gmail API or SendGrid?
Gmail API requires OAuth and was built for human accounts, not programmatic agent use. SendGrid handles sending only - no receiving, no threading, no reply parsing. AgentMail gives your Replit agent a dedicated inbox it can create on demand, send from, receive on, and read - with full thread context and no credential sharing.

Give your Replit agent its own inbox

Free tier. No credit card required. Inboxes ready in under a second.

Start for free

© 2026 AgentMail, Inc. All rights reserved.

Privacy PolicyTerms of ServiceSOC 2Subprocessors