agentmail
agentmail-to/agentmail-skills
AgentMail API を使用して、AI エージェントに独自のメール受信トレイを割り当てることができます。メールエージェントの構築、プログラムによるメールの送受信、受信トレイの管理、添付ファイルの処理、ラベルによる整理、人間による承認のための下書き作成、あるいは Webhook や WebSocket によるリアルタイム通知の設定などに活用できます。Pod によるマルチテナント分離に対応しています。
...すべて拡張します概要agentmail
AgentMail は、AIエージェント向けに特別に設計されたAPIファーストのメールプラットフォームであり、開発者に優しいSDKを通じてプログラムによるメール機能を提供します。これにより、AIエージェントに独自のメールIDを付与し、メールの送受信や管理を自律的に行えるようにするという課題を解決します。 開発者は、複雑なメールインフラをゼロから構築する代わりに、わずか数行のコードでAIエージェント用のメール受信箱を迅速にプロビジョニングし、アプリケーションにメール機能を統合することができます。
本プラットフォームは、自動生成またはカスタムメールアドレスによるスケーラブルなオンデマンド受信箱作成、送信・返信機能を備えたメッセージのライフサイクル全体にわたる管理、スレッドベースの会話グループ化、ラベルによる整理、添付ファイルの処理など、包括的なメール管理機能を提供します。 最適な配信率を実現するため、プレーンテキストとHTMLの両方のメール形式をサポートしており、WebhookやWebSocketを通じたリアルタイム通知機能も備えています。SDKはTypeScript/Node.jsおよびPython環境の両方で利用可能で、両言語にわたって一貫したAPIを提供します。
AgentMail AIを活用したメールエージェント、カスタマーサポートの自動化システム、アウトリーチおよびコミュニケーションツール、あるいはプログラムによるメール機能が必要なあらゆるアプリケーションを構築する開発者に最適です。ポッドベースの分離機能を備えたマルチテナントアーキテクチャをサポートしており、複数のエージェントや顧客が個別のメール環境を必要とするSaaSアプリケーションに適しています。 受信トレイを監視する必要があるAIアシスタント、自動フォローアップシステム、あるいはAIがメールを作成し人間が確認する下書き承認ワークフローなど、どのようなケースであっても、AgentMail はこれらのユースケースを効率的に処理するためのインフラストラクチャとAPIを提供します。
よくある質問
AgentMail はどのプログラミング言語をサポートしていますか?
AgentMail [email protected]は、TypeScript/Node.jsおよびPythonに対する公式SDKをサポートしています。どちらのSDKも、受信トレイの管理、メッセージの送受信、ラベルによる整理、スレッドの処理といった、同じコア機能を提供しています。
AgentMail でカスタムメールドメインを使用できますか?
はい、受信トレイを作成する際に、カスタムユーザー名やドメインを使用して受信トレイを作成できます。カスタムパラメータを指定しない場合、AgentMail はデフォルトのagentmail.toドメインを使用してメールアドレスを自動生成します。
AgentMail では、メールのやり取りはどのように整理されますか?
AgentMail [email protected]は、最新のメールクライアントと同様に、スレッド機能を使用して会話内の関連するメッセージをグループ化します。スレッドを一覧表示したり、ラベルでフィルタリングしたり、スレッド内のすべてのメッセージを取得したりできます。さらに、カスタムラベルを使用してメッセージを整理し、柔軟に分類することも可能です。
メールはプレーンテキスト版とHTML版の両方を送信する必要がありますか?
はい。AgentMail では、最高の配信率を確保するため、メッセージのプレーンテキスト版とHTML版の両方を常に送信することを推奨しています。これにより、さまざまなメールクライアントとの互換性が確保され、メールが正常に配信される可能性が高まります。
AgentMail はリアルタイム通知に対応していますか?
はい、AgentMail はWebhookおよびWebSocketによるリアルタイム通知に対応しており、エージェントの受信トレイに新しいメッセージが届いたり、その他のイベントが発生したりした際に、アプリケーションに即座に通知されます。
AgentMail SDK
AgentMail is an API-first email platform for AI agents. Install the SDK and initialize the client.
Installation
# TypeScript/Nodenpm install agentmail# Pythonpip install agentmail
Setup
import { AgentMailClient } from "agentmail";const client = new AgentMailClient({ apiKey: "YOUR_API_KEY" });
from agentmail import AgentMailclient = AgentMail(api_key="YOUR_API_KEY")
Inboxes
Create scalable inboxes on-demand. Each inbox has a unique email address.
// Create inbox (auto-generated address)const autoInbox = await client.inboxes.create();// Create with custom username and domainconst customInbox = await client.inboxes.create({ username: "support", domain: "yourdomain.com",});// List, get, deleteconst inboxes = await client.inboxes.list();const fetchedInbox = await client.inboxes.get("[email protected]");await client.inboxes.delete("[email protected]");
# Create inbox (auto-generated address)inbox = client.inboxes.create()# Create with custom username and domainfrom agentmail.inboxes.types import CreateInboxRequestinbox = client.inboxes.create( request=CreateInboxRequest(username="support", domain="yourdomain.com"),)# List, get, deleteinboxes = client.inboxes.list()inbox = client.inboxes.get(inbox_id="[email protected]")client.inboxes.delete(inbox_id="[email protected]")
Messages
Always send both text and html for best deliverability.
// Send messageawait client.inboxes.messages.send("[email protected]", { to: "[email protected]", subject: "Hello", text: "Plain text version", html: "<p>HTML version</p>", labels: ["outreach"],});// Reply to messageawait client.inboxes.messages.reply("[email protected]", "msg_123", { text: "Thanks for your email!",});// List and get messagesconst messages = await client.inboxes.messages.list("[email protected]");const message = await client.inboxes.messages.get("[email protected]", "msg_123");// Update labelsawait client.inboxes.messages.update("[email protected]", "msg_123", { addLabels: ["replied"], removeLabels: ["unreplied"],});
# Send messageclient.inboxes.messages.send( inbox_id="[email protected]", to="[email protected]", subject="Hello", text="Plain text version", html="<p>HTML version</p>", labels=["outreach"])# Reply to messageclient.inboxes.messages.reply( inbox_id="[email protected]", message_id="msg_123", text="Thanks for your email!")# List and get messagesmessages = client.inboxes.messages.list(inbox_id="[email protected]")message = client.inboxes.messages.get(inbox_id="[email protected]", message_id="msg_123")# Update labelsclient.inboxes.messages.update( inbox_id="[email protected]", message_id="msg_123", add_labels=["replied"], remove_labels=["unreplied"])
Threads
Threads group related messages in a conversation.
// List threads (with optional label filter)const threads = await client.inboxes.threads.list("[email protected]", { labels: ["unreplied"],});// Get thread detailsconst thread = await client.inboxes.threads.get("[email protected]", "thd_123");// Org-wide thread listingconst allThreads = await client.threads.list();
# List threads (with optional label filter)threads = client.inboxes.threads.list(inbox_id="[email protected]", labels=["unreplied"])# Get thread detailsthread = client.inboxes.threads.get(inbox_id="[email protected]", thread_id="thd_123")# Org-wide thread listingall_threads = client.threads.list()
Attachments
Send attachments with Base64 encoding. Retrieve from messages or threads.
// Send with attachmentconst content = Buffer.from(fileBytes).toString("base64");await client.inboxes.messages.send("[email protected]", { to: "[email protected]", subject: "Report", text: "See attached.", attachments: [ { content, filename: "report.pdf", contentType: "application/pdf" }, ],});// Get attachmentconst fileData = await client.inboxes.messages.getAttachment( "[email protected]", "msg_123", "att_456",);
import base64# Send with attachmentcontent = base64.b64encode(file_bytes).decode()client.inboxes.messages.send( inbox_id="[email protected]", to="[email protected]", subject="Report", text="See attached.", attachments=[{"content": content, "filename": "report.pdf", "content_type": "application/pdf"}])# Get attachmentfile_data = client.inboxes.messages.get_attachment( inbox_id="[email protected]", message_id="msg_123", attachment_id="att_456")
Drafts
Create drafts for human-in-the-loop approval before sending.
// Create draftconst draft = await client.inboxes.drafts.create("[email protected]", { to: "[email protected]", subject: "Pending approval", text: "Draft content",});// Send draft (converts to message)await client.inboxes.drafts.send("[email protected]", draft.draftId, {});
# Create draftdraft = client.inboxes.drafts.create( inbox_id="[email protected]", to="[email protected]", subject="Pending approval", text="Draft content")# Send draft (converts to message)client.inboxes.drafts.send(inbox_id="[email protected]", draft_id=draft.draft_id)
Pods
Multi-tenant isolation for SaaS platforms. Each customer gets isolated inboxes.
// Create pod for a customerconst pod = await client.pods.create({ clientId: "customer_123" });// Create inbox within podconst inbox = await client.pods.inboxes.create(pod.podId, {});// List inboxes scoped to podconst inboxes = await client.pods.inboxes.list(pod.podId);
# Create pod for a customerpod = client.pods.create(client_id="customer_123")# Create inbox within pod (pods.inboxes.create accepts flat kwargs)inbox = client.pods.inboxes.create(pod_id=pod.pod_id)# List inboxes scoped to podinboxes = client.pods.inboxes.list(pod_id=pod.pod_id)
Idempotency
Use clientId for safe retries on create operations.
const inbox = await client.inboxes.create({ clientId: "unique-idempotency-key",});// Retrying with same clientId returns the original inbox, not a duplicate
from agentmail.inboxes.types import CreateInboxRequestinbox = client.inboxes.create( request=CreateInboxRequest(client_id="unique-idempotency-key"),)# Retrying with same client_id returns the original inbox, not a duplicate
Real-Time Events
For real-time notifications, see the reference files:
- webhooks.md - HTTP-based notifications (requires public URL)
- websockets.md - Persistent connection (no public URL needed)
agentmailをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/agentmail-to/agentmail-skills/blob/main/agentmail/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
コピー





家
