Xpersona
A

AgentMail

CLAWHUB · Unverified

API-first email platform designed for AI agents. Create and manage dedicated email inboxes, send and receive emails programmatically, and handle email-based workflows with webhooks and real-time events. Use when you need to set up agent email identity, send emails from agents, handle incoming email workflows, or replace traditional email providers like Gmail with agent-friendly infrastructure.

62
Rank
84
Safety
32k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 32.2K downloads reported by the source. Last updated 5/14/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install publishers:adboio:agentmail
  1. Install using `clawhub skill install publishers:adboio:agentmail` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/adboio/agentmail before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-adboio-agentmail-2/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

96,518 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: agentmail
description: API-first email platform designed for AI agents. Create and manage dedicated email inboxes, send and receive emails programmatically, and handle email-based workflows with webhooks and real-time events. Use when you need to set up agent email identity, send emails from agents, handle incoming email workflows, or replace traditional email providers like Gmail with agent-friendly infrastructure.
---

# AgentMail

AgentMail is an API-first email platform designed specifically for AI agents. Unlike traditional email providers (Gmail, Outlook), AgentMail provides programmatic inboxes, usage-based pricing, high-volume sending, and real-time webhooks.

## Core Capabilities

- **Programmatic Inboxes**: Create and manage email addresses via API
- **Send/Receive**: Full email functionality with rich content support
- **Real-time Events**: Webhook notifications for incoming messages
- **AI-Native Features**: Semantic search, automatic labeling, structured data extraction
- **No Rate Limits**: Built for high-volume agent use

## Quick Start

1. **Create an account** at [console.agentmail.to](https://console.agentmail.to)
2. **Generate API key** in the console dashboard
3. **Install Python SDK**: `pip install agentmail python-dotenv`
4. **Set environment variable**: `AGENTMAIL_API_KEY=your_key_here`

## Basic Operations

### Create an Inbox

```python
from agentmail import AgentMail

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

# Create inbox with custom username
inbox = client.inboxes.create(
    username="spike-assistant",  # Creates spike-assistant@agentmail.to
    client_id="unique-identifier"  # Ensures idempotency
)
print(f"Created: {inbox.inbox_id}")
```

### Send Email

```python
client.inboxes.messages.send(
    inbox_id="spike-assistant@agentmail.to",
    to="adam@example.com",
    subject="Task completed",
    text="The PDF rotation is finished. See attachment.",
    html="<p>The PDF rotation is finished. <strong>See attachment.</strong></p>",
    attachments=[{
        "filename": "rotated.pdf",
        "content": base64.b64encode(file_data).decode()
    }]
)
```

### List Inboxes

```python
inboxes = client.inboxes.list(limit=10)
for inbox in inboxes.inboxes:
    print(f"{inbox.inbox_id} - {inbox.display_name}")
```

## Advanced Features

### Webhooks for Real-Time Processing

Set up webhooks to respond to incoming emails immediately:

```python
# Register webhook endpoint
webhook = client.webhooks.create(
    url="https://your-domain.com/webhook",
    client_id="email-processor"
)
```

See [WEBHOOKS.md](references/WEBHOOKS.md) for complete webhook setup guide including ngrok for local development.

### Custom Domains

For branded email addresses (e.g., `spike@yourdomain.com`), upgrade to a paid plan and configure custom domains in the console.

## Security: Webhook Allowlist (CRITICAL)

**⚠️ Risk**: Incoming email webhooks expose a **prompt injection vector**. Anyone can email your agent inbox with

_meta.json

{
  "ownerId": "kn774b0rgjymq1xa54gak56sa97zwq1x",
  "slug": "agentmail",
  "version": "1.1.1",
  "publishedAt": 1769407333271
}

references/API.md

# AgentMail API Reference

Base URL: `https://api.agentmail.to/v0`

## Authentication

All requests require Bearer token authentication:

```
Authorization: Bearer YOUR_API_KEY
```

## Inboxes

### Create Inbox

```http
POST /v0/inboxes
```

**Request:**
```json
{
  "username": "my-agent",           // Optional: custom username
  "domain": "agentmail.to",         // Optional: defaults to agentmail.to
  "display_name": "My Agent",       // Optional: friendly name
  "client_id": "unique-id"          // Optional: for idempotency
}
```

**Response:**
```json
{
  "pod_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "inbox_id": "my-agent@agentmail.to",
  "display_name": "My Agent",
  "created_at": "2024-01-10T08:15:00Z",
  "updated_at": "2024-01-10T08:15:00Z",
  "client_id": "unique-id"
}
```

### List Inboxes

```http
GET /v0/inboxes?limit=10&page_token=eyJwYWdlIjoxfQ==
```

**Response:**
```json
{
  "count": 2,
  "inboxes": [...],
  "limit": 10,
  "next_page_token": "eyJwYWdlIjoyMQ=="
}
```

### Get Inbox

```http
GET /v0/inboxes/{inbox_id}
```

## Messages

### Send Message

```http
POST /v0/inboxes/{inbox_id}/messages
```

**Request:**
```json
{
  "to": ["recipient@example.com"],          // Required: string or array
  "cc": ["cc@example.com"],                 // Optional: string or array
  "bcc": ["bcc@example.com"],               // Optional: string or array
  "reply_to": "reply@example.com",          // Optional: string or array
  "subject": "Email subject",               // Optional: string
  "text": "Plain text body",                 // Optional: string
  "html": "<p>HTML body</p>",               // Optional: string
  "labels": ["sent", "important"],          // Optional: array
  "attachments": [{                         // Optional: array of objects
    "filename": "document.pdf",
    "content": "base64-encoded-content",
    "content_type": "application/pdf"
  }],
  "headers": {                              // Optional: custom headers
    "X-Custom-Header": "value"
  }
}
```

**Response:**
```json
{
  "message_id": "msg_123abc",
  "thread_id": "thd_789ghi"
}
```

### List Messages

```http
GET /v0/inboxes/{inbox_id}/messages?limit=10&page_token=token
```

### Get Message

```http
GET /v0/inboxes/{inbox_id}/messages/{message_id}
```

## Threads

### List Threads

```http
GET /v0/inboxes/{inbox_id}/threads?limit=10
```

### Get Thread

```http
GET /v0/inboxes/{inbox_id}/threads/{thread_id}
```

**Response:**
```json
{
  "thread_id": "thd_789ghi",
  "inbox_id": "support@example.com",
  "subject": "Question about my account",
  "participants": ["jane@example.com", "support@example.com"],
  "labels": ["customer-support"],
  "message_count": 3,
  "last_message_at": "2023-10-27T14:30:00Z",
  "created_at": "2023-10-27T10:00:00Z",
  "updated_at": "2023-10-27T14:30:00Z"
}
```

## Webhooks

### Create Webhook

```http
POST /v0/webhooks
```

**Request:**
```json
{
  "url": "https://your-domain.com/webhook",
  "client_id": "webhook-identifier",
  "enabled"

references/EXAMPLES.md

# AgentMail Usage Examples

Common patterns and use cases for AgentMail in AI agent workflows.

## Basic Agent Email Setup

### 1. Create Agent Identity

```python
from agentmail import AgentMail
import os

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

# Create inbox for your agent
agent_inbox = client.inboxes.create(
    username="spike-assistant",
    display_name="Spike - AI Assistant",
    client_id="spike-main-inbox"  # Prevents duplicates
)

print(f"Agent email: {agent_inbox.inbox_id}")
# Output: spike-assistant@agentmail.to
```

### 2. Send Status Updates

```python
def send_task_completion(task_name, details, recipient):
    client.inboxes.messages.send(
        inbox_id="spike-assistant@agentmail.to",
        to=recipient,
        subject=f"Task Completed: {task_name}",
        text=f"Hello! I've completed the task: {task_name}\n\nDetails:\n{details}\n\nBest regards,\nSpike 🦝",
        html=f"""
        <p>Hello!</p>
        <p>I've completed the task: <strong>{task_name}</strong></p>
        <h3>Details:</h3>
        <p>{details.replace(chr(10), '<br>')}</p>
        <p>Best regards,<br>Spike 🦝</p>
        """
    )

# Usage
send_task_completion(
    "PDF Processing", 
    "Rotated 5 pages, extracted text, and saved output to /tmp/processed.pdf",
    "adam@example.com"
)
```

## Customer Support Automation

### Auto-Reply System

```python
def setup_support_auto_reply():
    """Set up webhook to auto-reply to support emails"""
    
    # Create support inbox
    support_inbox = client.inboxes.create(
        username="support",
        display_name="Customer Support",
        client_id="support-inbox"
    )
    
    # Register webhook for auto-replies
    webhook = client.webhooks.create(
        url="https://your-app.com/webhook/support",
        event_types=["message.received"],
        inbox_ids=[support_inbox.inbox_id],
        client_id="support-webhook"
    )
    
    return support_inbox, webhook

def handle_support_message(message):
    """Process incoming support message and send auto-reply"""
    
    subject = message['subject'].lower()
    sender = message['from'][0]['email']
    
    # Determine response based on subject keywords
    if 'billing' in subject or 'payment' in subject:
        response = """
        Thank you for your billing inquiry. 
        
        Our billing team will review your request and respond within 24 hours. 
        For urgent billing issues, please call 1-800-SUPPORT.
        
        Best regards,
        Customer Support Team
        """
    elif 'bug' in subject or 'error' in subject:
        response = """
        Thank you for reporting this issue.
        
        Our technical team has been notified and will investigate. 
        We'll update you within 48 hours with our findings.
        
        If you have additional details, please reply to this email.
        
        Best regards,
        Technical Support
        """
    else:
        response = """
        Thank you

references/WEBHOOKS.md

# AgentMail Webhooks Guide

Webhooks enable real-time, event-driven email processing. When events occur (like receiving a message), AgentMail immediately sends a POST request to your registered endpoint.

## Event Types

### message.received
Triggered when a new email arrives. Contains full message and thread data.

**Use case:** Auto-reply to support emails, process attachments, route messages

```json
{
  "type": "event",
  "event_type": "message.received",
  "event_id": "evt_123abc",
  "message": {
    "inbox_id": "support@agentmail.to",
    "thread_id": "thd_789ghi",
    "message_id": "msg_123abc",
    "from": [{"name": "Jane Doe", "email": "jane@example.com"}],
    "to": [{"name": "Support", "email": "support@agentmail.to"}],
    "subject": "Question about my account",
    "text": "I need help with...",
    "html": "<p>I need help with...</p>",
    "timestamp": "2023-10-27T10:00:00Z",
    "labels": ["received"]
  },
  "thread": {
    "thread_id": "thd_789ghi",
    "subject": "Question about my account",
    "participants": ["jane@example.com", "support@agentmail.to"],
    "message_count": 1
  }
}
```

### message.sent
Triggered when you successfully send a message.

```json
{
  "type": "event",
  "event_type": "message.sent",
  "event_id": "evt_456def",
  "send": {
    "inbox_id": "support@agentmail.to",
    "thread_id": "thd_789ghi",
    "message_id": "msg_456def",
    "timestamp": "2023-10-27T10:05:00Z",
    "recipients": ["jane@example.com"]
  }
}
```

### message.delivered
Triggered when your message reaches the recipient's mail server.

### message.bounced
Triggered when a message fails to deliver.

```json
{
  "type": "event",
  "event_type": "message.bounced",
  "bounce": {
    "type": "Permanent",
    "sub_type": "General",
    "recipients": [{"address": "invalid@example.com", "status": "bounced"}]
  }
}
```

### message.complained
Triggered when recipients mark your message as spam.

## Local Development Setup

### Step 1: Install Dependencies

```bash
pip install agentmail flask ngrok python-dotenv
```

### Step 2: Set up ngrok

1. Create account at [ngrok.com](https://ngrok.com/)
2. Install: `brew install ngrok` (macOS) or download from website
3. Authenticate: `ngrok config add-authtoken YOUR_AUTHTOKEN`

### Step 3: Create Webhook Receiver

Create `webhook_receiver.py`:

```python
from flask import Flask, request, Response
import json
from agentmail import AgentMail
import os

app = Flask(__name__)
client = AgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))

@app.route('/webhook', methods=['POST'])
def handle_webhook():
    payload = request.json
    
    if payload['event_type'] == 'message.received':
        message = payload['message']
        
        # Auto-reply example
        response_text = f"Thanks for your email about '{message['subject']}'. We'll get back to you soon!"
        
        client.inboxes.messages.send(
            inbox_id=message['inbox_id'],
            to=message['from'][0]['email'],
            subject

Sponsored

Ads related to AgentMail and adjacent AI workflows.