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

Email for your Codex agent

AgentMail is the fastest way to give a Codex agent its own email inbox. It can send email, receive replies, and manage full conversation threads from a dedicated inbox it owns.

[ Install ]

One command

AgentMail works with OpenAI Codex out of the box. Install the SDK, set your API key, and your Codex agent has a dedicated inbox in under a minute.

1. Install the SDK
pip install agentmail
# or
npm install agentmail
2. Set your API key
export AGENTMAIL_API_KEY="am_us_your_key_here"
3. Import and use
from agentmail import AgentMail

client = AgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))
[ Why email ]

Why your Codex agent needs its own inbox

Dedicated agent identity

Your Codex agent gets its own inbox with its own email address. It never sends from your personal email or shares your credentials.

Full programmatic control

Create inboxes, send messages, read replies, and manage threads - all through a clean SDK that works with any Python or Node.js environment.

Real-time notifications

Set up webhooks to get notified instantly when new emails arrive. Your agent can react immediately, not after a polling interval.

[ Code ]

Working code

import os
from agentmail import AgentMail

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

# Create a dedicated inbox for your agent
inbox = client.inboxes.create()
print(f"Agent inbox: {inbox.inbox_id}")

# Send an email
client.inboxes.messages.send(
    inbox_id=inbox.inbox_id,
    to="user@example.com",
    subject="Hello from your Codex agent",
    text="This email was sent by a Codex agent via AgentMail.",
)

# Check for replies
messages = client.inboxes.messages.list(inbox_id=inbox.inbox_id)
for msg in (messages.messages or []):
    print(f"{msg.from_address}: {msg.subject}")
[ FAQ ]

FAQ

Common questions about AgentMail and Codex.

Does AgentMail work with OpenAI Codex?
Yes. The AgentMail SDK works with any Python or Node.js environment, including Codex agents. Install the SDK, set your API key, and your agent can create inboxes, send emails, and manage threads.
Can my Codex agent receive emails, not just send them?
Yes. Every AgentMail inbox is a real email address that can receive messages. Use webhooks or poll the API to get notified when new mail arrives.
How do I handle attachments?
The SDK supports sending and receiving attachments. Attach files when sending, and access attachment content when reading received messages.
How many inboxes can I create?
Free tier: 3 inboxes. Developer plan ($20/mo): 10 inboxes. Startup plan ($200/mo): 150 inboxes. Enterprise: unlimited.
Is there a free tier?
Yes. The free tier includes 3 inboxes and 3,000 emails per month. No credit card required to start.
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 Codex 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 Codex 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