Quickstart

Getting Started with AgentMail

SDK’s

We currently support Python and TypeScript/Node.js. If you would like us to support another language, please reach out to us.

Quick Install

Install AgentMail using your preferred package manager:

$pip install agentmail

Prerequisites

Verify Installation

Test your installation:

1from agentmail import AgentMail
2
3# Should print the version number
4print(AgentMail.__version__)

Basic Usage

Here’s how to initialize the client and create your first inbox:

1from agentmail import AgentMail
2
3# Initialize the client
4
5client = AgentMail(api_key="YOUR_API_KEY")
6
7# Create an inbox
8
9inbox = client.inboxes.create(domain="yourdomain.com")

💡 We recommend using environment variables for your API key in production. Create a .env file and use python-dotenv to load it: bash AGENTMAIL_API_KEY=your_api_key_here

Error Handling

Handle API errors gracefully with built-in error types:

1from agentmail.core.api_error import ApiError
2
3try:
4 client.inboxes.create(domain="yourdomain.com")
5except ApiError as e:
6 print(f"Error {e.status_code}: {e.body}")

Async Support

Python users can also use our async client for non-blocking operations:

Python Async
1import asyncio
2from agentmail import AsyncAgentMail
3
4async_client = AsyncAgentMail(api_key="YOUR_API_KEY")
5
6async def main():
7 await async_client.inboxes.create(domain="yourdomain.com")
8
9asyncio.run(main())

Environment Support

  • Python: Python 3.8+
  • TypeScript/Node.js: Node.js 18+, Vercel, Cloudflare Workers, Deno v1.25+, Bun 1.0+, React Native

Need Help?

Looking for a different language? Email us at support@agentmail.to and we’ll get you set up.