[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M781G050MPJYEK5XEQ6XRV48":3,"skill-same:01M781G050MPJYEK5XEQ6XRV48":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M781G050MPJYEK5XEQ6XRV48","agentmail-sdk",null,"Comprehensive guide to the AgentMail Python and TypeScript SDKs. Use when building AI agents that need their own email inboxes, sending or receiving emails programmatically, managing threads and conversations, handling attachments, creating drafts for human-in-the-loop approval, setting up real-time notifications via webhooks or WebSockets, configuring custom domains, managing allow\u002Fblock lists, using pods for multi-tenant isolation, or integrating email into any AI agent workflow. Covers the full AgentMail API with code examples, best practices, and production patterns.","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_agentmail-to_agentmail-skills_agentmail-sdk\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: agentmail-sdk\ndescription: Comprehensive guide to the AgentMail Python and TypeScript SDKs. Use when building AI agents that need their own email inboxes, sending or receiving emails programmatically, managing threads and conversations, handling attachments, creating drafts for human-in-the-loop approval, setting up real-time notifications via webhooks or WebSockets, configuring custom domains, managing allow\u002Fblock lists, using pods for multi-tenant isolation, or integrating email into any AI agent workflow. Covers the full AgentMail API with code examples, best practices, and production patterns.\nlicense: MIT\nmetadata:\n  author: agentmail-to\n  version: \"1.0\"\n---\n\n# AgentMail SDK\n\nAgentMail is an API-first email platform built for AI agents. Unlike transactional email APIs (Resend, SendGrid) that focus on one-way sending, AgentMail provides full two-way email inboxes that agents can create, send from, receive into, and manage programmatically.\n\nKey capabilities:\n- Instant inbox creation (milliseconds, no domain setup needed)\n- Two-way conversations with native thread management\n- Reply extraction (`extracted_text`) strips quoted history automatically\n- WebSocket and webhook support for real-time inbound\n- Human-in-the-loop drafts for agent oversight\n- Multi-tenant isolation with pods\n- Allow\u002Fblock lists for sender filtering\n- IMAP and SMTP access for legacy integrations\n\n## Installation and setup\n\n```bash\n# Python\npip install agentmail\n\n# TypeScript \u002F Node.js\nnpm install agentmail\n```\n\nGet your API key from https:\u002F\u002Fconsole.agentmail.to\u002F or via the Agent sign-up API (see below).\n\n**Python:**\n```python\nfrom agentmail import AgentMail\nclient = AgentMail(api_key=\"YOUR_API_KEY\")\n# Or set AGENTMAIL_API_KEY env var and omit api_key:\n# client = AgentMail()\n```\n\n**TypeScript:**\n```typescript\nimport { AgentMailClient } from \"agentmail\";\nconst client = new AgentMailClient({ apiKey: \"YOUR_API_KEY\" });\n```\n\n## Agent sign-up (programmatic, no console needed)\n\nCreate an account and get an API key entirely from code. No browser required.\n\n> Requires `agentmail>=0.4.15` (Python) \u002F `agentmail>=0.x` (TypeScript). If your installed\n> SDK raises `AttributeError: 'AgentMail' object has no attribute 'agent'`, upgrade first.\n\n```python\nclient = AgentMail()  # no api_key needed for sign-up\nresponse = client.agent.sign_up(\n    human_email=\"you@example.com\",\n    username=\"my-agent\",\n)\n# response.api_key   -> store this securely\n# response.inbox_id  -> my-agent@agentmail.to\n# response.organization_id\n\n# Verify with OTP sent to your email\nclient = AgentMail(api_key=response.api_key)\nclient.agent.verify(otp_code=\"123456\")\n```\n\n```typescript\nconst client = new AgentMailClient();\nconst response = await client.agent.signUp({\n    humanEmail: \"you@example.com\",\n    username: \"my-agent\",\n});\n\u002F\u002F response.apiKey, response.inboxId, response.organizationId\n\nconst authedClient = new AgentMailClient({ apiKey: response.apiKey });\nawait authedClient.agent.verify({ otpCode: \"123456\" });\n```\n\nThe sign-up endpoint is idempotent: calling again with the same email rotates the API key and resends the OTP.\n\n## Inboxes\n\nCreate scalable inboxes on-demand. Each inbox has a unique email address. No domain verification needed for `@agentmail.to`.\n\n```python\nfrom agentmail.inboxes.types import CreateInboxRequest\n\n# Create inbox (auto-generated address)\ninbox = client.inboxes.create()\n# inbox.inbox_id, inbox.email\n\n# Create with options. All create kwargs go inside a CreateInboxRequest.\ninbox = client.inboxes.create(\n    request=CreateInboxRequest(\n        username=\"support\",\n        domain=\"yourdomain.com\",       # optional, defaults to agentmail.to\n        display_name=\"Support Agent\",\n        client_id=\"support-v1\",        # idempotency key, safe to retry\n    ),\n)\n\n# List all inboxes\ninboxes = client.inboxes.list()\n# Paginate: client.inboxes.list(limit=20, page_token=inboxes.next_page_token)\n\n# Get, update, delete\ninbox = client.inboxes.get(inbox_id=\"support@agentmail.to\")\nclient.inboxes.update(inbox_id=\"support@agentmail.to\", display_name=\"New Name\")\nclient.inboxes.delete(inbox_id=\"support@agentmail.to\")\n```\n\n```typescript\nconst inbox = await client.inboxes.create({\n    username: \"support\",\n    domain: \"yourdomain.com\",\n    displayName: \"Support Agent\",\n    clientId: \"support-v1\",\n});\n\nconst inboxes = await client.inboxes.list();\nconst fetched = await client.inboxes.get(\"support@agentmail.to\");\nawait client.inboxes.update(\"support@agentmail.to\", { displayName: \"New Name\" });\nawait client.inboxes.delete(\"support@agentmail.to\");\n```\n\nCustom domains require a paid plan. Default `@agentmail.to` inboxes are free.\n\n## Messages\n\n### Send\n\nAlways provide both `text` and `html` for best deliverability. Maximum 50 recipients across to + cc + bcc combined.\n\n```python\nsent = client.inboxes.messages.send(\n    inbox_id=\"agent@agentmail.to\",\n    to=\"recipient@example.com\",       # string or list\n    subject=\"Hello from AgentMail\",\n    text=\"Plain text body\",\n    html=\"\u003Cp>HTML body\u003C\u002Fp>\",          # optional but recommended\n    cc=\"cc@example.com\",              # optional, string or list\n    bcc=\"bcc@example.com\",            # optional, string or list\n    reply_to=\"replies@example.com\",   # optional\n    labels=[\"outreach\"],              # optional\n    attachments=[{                    # optional\n        \"filename\": \"report.pdf\",\n        \"content\": base64_content,    # Base64-encoded\n        \"content_type\": \"application\u002Fpdf\",\n    }],\n)\n# sent.message_id, sent.thread_id\n```\n\n```typescript\nconst sent = await client.inboxes.messages.send(\"agent@agentmail.to\", {\n    to: \"recipient@example.com\",\n    subject: \"Hello from AgentMail\",\n    text: \"Plain text body\",\n    html: \"\u003Cp>HTML body\u003C\u002Fp>\",\n    cc: \"cc@example.com\",\n    labels: [\"outreach\"],\n    attachments: [{\n        filename: \"report.pdf\",\n        content: base64Content,\n        contentType: \"application\u002Fpdf\",\n    }],\n});\n```\n\n### List and get\n\n```python\n# List messages in an inbox. Note: .list() returns MessageItem objects\n# (metadata only — subject, from, labels, timestamps, etc.) with NO body\n# content. To read .text \u002F .html \u002F .extracted_text you must fetch the full\n# message with .get().\nresponse = client.inboxes.messages.list(\n    inbox_id=\"agent@agentmail.to\",\n    limit=10,                # optional, default varies\n    labels=[\"unread\"],       # optional, filter by label\n)\nfor item in response.messages:\n    # item is a MessageItem (metadata only). Fetch the full Message for body:\n    msg = client.inboxes.messages.get(\n        inbox_id=item.inbox_id,\n        message_id=item.message_id,\n    )\n    # Use extracted_text for reply content without quoted history\n    content = msg.extracted_text or msg.text\n    print(msg.subject, content)\n\n# Paginate\nwhile response.next_page_token:\n    response = client.inboxes.messages.list(\n        inbox_id=\"agent@agentmail.to\",\n        page_token=response.next_page_token,\n    )\n\n# Get a specific message\nmsg = client.inboxes.messages.get(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n)\n\n# Get raw MIME content\nraw = client.inboxes.messages.get_raw(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n)\n```\n\n```typescript\nconst response = await client.inboxes.messages.list(\"agent@agentmail.to\", {\n    limit: 10,\n    labels: [\"unread\"],\n});\n\nconst msg = await client.inboxes.messages.get(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n);\n```\n\n**Important**: when processing inbound replies, always use `extracted_text` \u002F `extracted_html` instead of `text` \u002F `html`. These fields strip quoted history and signatures, giving you only the new content. This is powered by Talon reply extraction.\n\nAlso note: some email clients (Gmail, Outlook) send forwards as HTML-only. Always treat `html` as the primary content source and `text` as optional.\n\n### Reply\n\nReplying adds the message to the existing thread.\n\n```python\nreply = client.inboxes.messages.reply(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    text=\"Thanks for your email!\",\n    html=\"\u003Cp>Thanks for your email!\u003C\u002Fp>\",   # optional\n    attachments=[...],                       # optional\n    reply_all=False,                         # optional, defaults to False\n)\n```\n\n```typescript\nconst reply = await client.inboxes.messages.reply(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    { text: \"Thanks for your email!\" },\n);\n```\n\n### Forward\n\n```python\nclient.inboxes.messages.forward(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    to=\"colleague@example.com\",\n    text=\"FYI, see below.\",       # optional prepended text\n)\n```\n\n```typescript\nawait client.inboxes.messages.forward(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    {\n        to: \"colleague@example.com\",\n        text: \"FYI, see below.\",\n    },\n);\n```\n\n### Update labels\n\nUse labels to track message processing state. AgentMail does not have a built-in \"read\u002Funread\" flag. Use labels instead.\n\n```python\nclient.inboxes.messages.update(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    add_labels=[\"processed\", \"replied\"],\n    remove_labels=[\"unread\"],\n)\n```\n\n```typescript\nawait client.inboxes.messages.update(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    {\n        addLabels: [\"processed\", \"replied\"],\n        removeLabels: [\"unread\"],\n    },\n);\n```\n\n### Attachments\n\n```python\nimport base64\n\n# Send with attachment\nwith open(\"report.pdf\", \"rb\") as f:\n    content = base64.b64encode(f.read()).decode()\n\nclient.inboxes.messages.send(\n    inbox_id=\"agent@agentmail.to\",\n    to=\"user@example.com\",\n    subject=\"Report attached\",\n    text=\"See attached.\",\n    attachments=[{\n        \"filename\": \"report.pdf\",\n        \"content\": content,\n        \"content_type\": \"application\u002Fpdf\",\n    }],\n)\n\n# Retrieve attachment from received message\nattachment = client.inboxes.messages.get_attachment(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    attachment_id=\"att_456\",\n)\n```\n\n```typescript\nimport { readFileSync } from \"node:fs\";\n\nconst content = readFileSync(\"report.pdf\").toString(\"base64\");\n\nawait client.inboxes.messages.send(\"agent@agentmail.to\", {\n    to: \"user@example.com\",\n    subject: \"Report attached\",\n    text: \"See attached.\",\n    attachments: [{ filename: \"report.pdf\", content, contentType: \"application\u002Fpdf\" }],\n});\n\nconst attachment = await client.inboxes.messages.getAttachment(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    \"att_456\",\n);\n```\n\n## Threads\n\nThreads group related messages in a conversation. When you send a new message, a thread is created. Replies are added to the same thread automatically.\n\n```python\n# List threads in an inbox\nthreads = client.inboxes.threads.list(\n    inbox_id=\"agent@agentmail.to\",\n    labels=[\"unreplied\"],     # optional filter\n)\n\n# Get a specific thread with all messages\nthread = client.inboxes.threads.get(\n    inbox_id=\"agent@agentmail.to\",\n    thread_id=\"thd_123\",\n)\nfor msg in thread.messages:\n    print(msg.subject, msg.extracted_text)\n\n# Org-wide thread listing (across all inboxes)\nall_threads = client.threads.list()\n\n# Delete a thread\nclient.inboxes.threads.delete(\n    inbox_id=\"agent@agentmail.to\",\n    thread_id=\"thd_123\",\n)\n```\n\n```typescript\nconst threads = await client.inboxes.threads.list(\"agent@agentmail.to\", {\n    labels: [\"unreplied\"],\n});\n\nconst thread = await client.inboxes.threads.get(\"agent@agentmail.to\", \"thd_123\");\n\nconst allThreads = await client.threads.list();\n```\n\n## Drafts\n\nCreate drafts for human-in-the-loop approval. The agent composes a draft, a human reviews, then the draft is sent.\n\n```python\n# Create draft\ndraft = client.inboxes.drafts.create(\n    inbox_id=\"agent@agentmail.to\",\n    to=\"recipient@example.com\",\n    subject=\"Pending approval\",\n    text=\"Draft content for review\",\n    html=\"\u003Cp>Draft content for review\u003C\u002Fp>\",\n)\n\n# List drafts\ndrafts = client.inboxes.drafts.list(inbox_id=\"agent@agentmail.to\")\n\n# Get, update\ndraft = client.inboxes.drafts.get(inbox_id=\"agent@agentmail.to\", draft_id=draft.draft_id)\nclient.inboxes.drafts.update(\n    inbox_id=\"agent@agentmail.to\",\n    draft_id=draft.draft_id,\n    text=\"Updated draft content\",\n)\n\n# Send draft (converts to message, removes from drafts)\nclient.inboxes.drafts.send(inbox_id=\"agent@agentmail.to\", draft_id=draft.draft_id)\n\n# Delete draft without sending\nclient.inboxes.drafts.delete(inbox_id=\"agent@agentmail.to\", draft_id=draft.draft_id)\n```\n\n```typescript\nconst draft = await client.inboxes.drafts.create(\"agent@agentmail.to\", {\n    to: \"recipient@example.com\",\n    subject: \"Pending approval\",\n    text: \"Draft content\",\n});\n\nawait client.inboxes.drafts.send(\"agent@agentmail.to\", draft.draftId, {});\n```\n\n## Pods (multi-tenant isolation)\n\nPods provide isolated environments for SaaS platforms. Each pod has its own set of inboxes.\n\n```python\n# Create pod per customer\npod = client.pods.create(\n    name=\"customer-acme\",\n    client_id=\"pod-acme-v1\",   # idempotent\n)\n\n# Create inbox within pod (pods.inboxes.create accepts flat kwargs)\ninbox = client.pods.inboxes.create(\n    pod_id=pod.pod_id,\n    username=\"notifications\",\n    client_id=\"acme-notifications-v1\",\n)\n\n# List inboxes scoped to pod\ninboxes = client.pods.inboxes.list(pod_id=pod.pod_id)\n\n# List threads scoped to pod\nthreads = client.pods.threads.list(pod_id=pod.pod_id)\n\n# List, get, delete pods\npods = client.pods.list()\npod = client.pods.get(pod_id=pod.pod_id)\nclient.pods.delete(pod_id=pod.pod_id)\n```\n\n```typescript\nconst pod = await client.pods.create({ name: \"customer-acme\", clientId: \"pod-acme-v1\" });\nconst inbox = await client.pods.inboxes.create(pod.podId, {\n    username: \"notifications\",\n    clientId: \"acme-notifications-v1\",\n});\nconst inboxes = await client.pods.inboxes.list(pod.podId);\n```\n\n## Allow\u002Fblock lists\n\nControl which external senders can deliver to an inbox. Block list takes priority over allow list.\n\nLists are flat. Each entry is one `(direction, type, entry)` tuple — there is no batch update, no `.allow` \u002F `.block` sub-namespace. `direction` is `\"send\"`, `\"receive\"`, or `\"reply\"`. `type` is `\"allow\"` or `\"block\"`.\n\n```python\n# Allow a sender on incoming mail\nclient.inboxes.lists.create(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n    entry=\"boss@company.com\",\n)\n\n# Block a sender on incoming mail\nclient.inboxes.lists.create(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"block\",\n    entry=\"spammer@example.com\",\n)\n\n# List entries for one (direction, type) pair\nallow = client.inboxes.lists.list(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n)\n\n# Check a single entry\nentry = client.inboxes.lists.get(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n    entry=\"boss@company.com\",\n)\n\n# Remove an entry\nclient.inboxes.lists.delete(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n    entry=\"boss@company.com\",\n)\n```\n\n```typescript\nawait client.inboxes.lists.create(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"allow\",\n    { entry: \"boss@company.com\" },\n);\n\nawait client.inboxes.lists.create(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"block\",\n    { entry: \"spammer@example.com\" },\n);\n\nconst allow = await client.inboxes.lists.list(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"allow\",\n);\n\nawait client.inboxes.lists.delete(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"allow\",\n    \"boss@company.com\",\n);\n```\n\n## Domains\n\nCustom domains let agents send from your own domain (e.g., `agent@yourdomain.com`). SPF, DKIM, and DMARC records are auto-generated. Requires paid plan.\n\n```python\n# Add domain. feedback_enabled is required: set True to route\n# bounce\u002Fcomplaint notifications to your inboxes.\ndomain = client.domains.create(domain=\"yourdomain.com\", feedback_enabled=True)\n# domain.records -> list of VerificationRecord objects to add at your registrar\n\n# Verify after DNS records are set\nclient.domains.verify(domain_id=domain.domain_id)\n\n# List, get, delete\ndomains = client.domains.list()\ndomain = client.domains.get(domain_id=domain.domain_id)\nclient.domains.delete(domain_id=domain.domain_id)\n```\n\n```typescript\nconst domain = await client.domains.create({\n    domain: \"yourdomain.com\",\n    feedbackEnabled: true,\n});\nawait client.domains.verify(domain.domainId);\n```\n\n## Real-time events\n\nAgentMail supports both WebSockets and webhooks for real-time notifications. See `references\u002Fwebhooks.md` and `references\u002Fwebsockets.md` for detailed setup and full code examples.\n\n### WebSockets (recommended for agents)\n\nNo public URL needed. Persistent connection with instant delivery.\n\n**Python (sync):**\n```python\nfrom agentmail import AgentMail, Subscribe, Subscribed, MessageReceivedEvent\n\nclient = AgentMail()\nwith client.websockets.connect() as socket:\n    socket.send_subscribe(Subscribe(inbox_ids=[\"agent@agentmail.to\"]))\n    for event in socket:\n        if isinstance(event, Subscribed):\n            print(f\"Subscribed to: {event.inbox_ids}\")\n        elif isinstance(event, MessageReceivedEvent):\n            print(f\"From: {event.message.from_}\")\n            print(f\"Subject: {event.message.subject}\")\n            print(f\"Body: {event.message.extracted_text}\")\n```\n\n**Python (async):**\n```python\nfrom agentmail import AsyncAgentMail, Subscribe, MessageReceivedEvent\n\nclient = AsyncAgentMail()\nasync with client.websockets.connect() as socket:\n    await socket.send_subscribe(Subscribe(inbox_ids=[\"agent@agentmail.to\"]))\n    async for event in socket:\n        if isinstance(event, MessageReceivedEvent):\n            await process_email(event.message)\n```\n\n**TypeScript:**\n```typescript\nconst socket = await client.websockets.connect();\nsocket.on(\"open\", () => {\n    socket.sendSubscribe({ type: \"subscribe\", inboxIds: [\"agent@agentmail.to\"] });\n});\nsocket.on(\"message\", (event) => {\n    \u002F\u002F Use event.eventType (not event.type — event.type is always \"event\")\n    if (event.eventType === \"message.received\") {\n        \u002F\u002F TypeScript uses .from directly; only Python needs .from_ (reserved keyword)\n        console.log(\"From:\", event.message.from);\n        console.log(\"Subject:\", event.message.subject);\n    }\n});\n```\n\n### Webhooks\n\nHTTP POST to your endpoint on email events. Requires a public URL.\n\n`event_types` is **required** — you must pick at least one event to subscribe to. Pass an explicit list of every event you want to receive.\n\n```python\nwebhook = client.webhooks.create(\n    url=\"https:\u002F\u002Fyour-server.com\u002Fwebhooks\",\n    event_types=[\"message.received\", \"message.bounced\"],\n)\n# webhook.webhook_id, webhook.secret\n\n# List, get, delete\nwebhooks = client.webhooks.list()\nclient.webhooks.delete(webhook_id=webhook.webhook_id)\n```\n\nTyped webhook event types (listed in the SDK's Literal): `message.received`, `message.sent`, `message.delivered`, `message.bounced`, `message.complained`, `message.rejected`, `domain.verified`.\n\nRuntime-only events — accepted by the API but not in the SDK's typed Literal — include `message.received.spam` and `message.received.blocked`. Pass them as plain strings if you need them. Type checkers will flag them; that's expected.\n\nAlways verify webhook signatures before processing. See `references\u002Fwebhooks.md`.\n\n## Idempotency\n\nPass `client_id` \u002F `clientId` on create operations to make them safe to retry:\n\n```python\nfrom agentmail.inboxes.types import CreateInboxRequest\n\ninbox = client.inboxes.create(\n    request=CreateInboxRequest(client_id=\"my-unique-key\"),\n)\n# Calling again with the same client_id returns the existing inbox, not a duplicate\n\npod = client.pods.create(client_id=\"pod-unique-key\")\n# pods.create takes flat kwargs; same idempotency behavior\n```\n\n## Error handling\n\nBoth SDKs raise\u002Fthrow on 4xx and 5xx responses. On 429 (rate limit), read the `Retry-After` header and use exponential backoff. Both SDKs retry automatically (default: 2 retries).\n\n```python\ntry:\n    client.inboxes.messages.send(inbox_id, to=\"user@example.com\", subject=\"Hi\", text=\"Hello\")\nexcept Exception as e:\n    print(f\"Error: {e}\")\n    # e.body.message contains details if available\n\n# Python: override retries per call via request_options\n# (the AgentMail constructor has no max_retries argument)\nclient.inboxes.messages.send(\n    inbox_id,\n    to=\"user@example.com\",\n    subject=\"Hi\",\n    text=\"Hello\",\n    request_options={\"max_retries\": 5},\n)\n```\n\n```typescript\ntry {\n    await client.inboxes.messages.send(inboxId, {\n        to: \"user@example.com\",\n        subject: \"Hi\",\n        text: \"Hello\",\n    });\n} catch (err) {\n    console.error(\"Error:\", err.message);\n    \u002F\u002F err.statusCode, err.body for details\n}\n\n\u002F\u002F TypeScript: override retries globally on the client, or per-call via requestOptions\nconst client = new AgentMailClient({ apiKey: \"...\", maxRetries: 5 });\n```\n\n## IMAP and SMTP\n\nAgentMail inboxes are accessible via standard IMAP and SMTP protocols, enabling integration with traditional email clients and legacy systems. See https:\u002F\u002Fdocs.agentmail.to\u002Fimap-smtp for setup details.\n\n## Pagination\n\nAll list endpoints use cursor-based pagination:\n\n```python\nresponse = client.inboxes.messages.list(inbox_id, limit=20)\nwhile response.next_page_token:\n    response = client.inboxes.messages.list(\n        inbox_id, limit=20, page_token=response.next_page_token\n    )\n```\n\n## Reference files\n\nFor detailed coverage of specific topics:\n- `references\u002Fwebhooks.md` -- webhook setup, event types, payload structure, signature verification\n- `references\u002Fwebsockets.md` -- WebSocket connection, sync\u002Fasync patterns, event handler pattern, subscribe options\n- `references\u002Ffull-api-reference.md` -- complete endpoint and SDK method table with all parameters\n","# AgentMail SDK\n\nAgentMail is an API-first email platform built for AI agents. Unlike transactional email APIs (Resend, SendGrid) that focus on one-way sending, AgentMail provides full two-way email inboxes that agents can create, send from, receive into, and manage programmatically.\n\nKey capabilities:\n- Instant inbox creation (milliseconds, no domain setup needed)\n- Two-way conversations with native thread management\n- Reply extraction (`extracted_text`) strips quoted history automatically\n- WebSocket and webhook support for real-time inbound\n- Human-in-the-loop drafts for agent oversight\n- Multi-tenant isolation with pods\n- Allow\u002Fblock lists for sender filtering\n- IMAP and SMTP access for legacy integrations\n\n## Installation and setup\n\n```bash\n# Python\npip install agentmail\n\n# TypeScript \u002F Node.js\nnpm install agentmail\n```\n\nGet your API key from https:\u002F\u002Fconsole.agentmail.to\u002F or via the Agent sign-up API (see below).\n\n**Python:**\n```python\nfrom agentmail import AgentMail\nclient = AgentMail(api_key=\"YOUR_API_KEY\")\n# Or set AGENTMAIL_API_KEY env var and omit api_key:\n# client = AgentMail()\n```\n\n**TypeScript:**\n```typescript\nimport { AgentMailClient } from \"agentmail\";\nconst client = new AgentMailClient({ apiKey: \"YOUR_API_KEY\" });\n```\n\n## Agent sign-up (programmatic, no console needed)\n\nCreate an account and get an API key entirely from code. No browser required.\n\n> Requires `agentmail>=0.4.15` (Python) \u002F `agentmail>=0.x` (TypeScript). If your installed\n> SDK raises `AttributeError: 'AgentMail' object has no attribute 'agent'`, upgrade first.\n\n```python\nclient = AgentMail()  # no api_key needed for sign-up\nresponse = client.agent.sign_up(\n    human_email=\"you@example.com\",\n    username=\"my-agent\",\n)\n# response.api_key   -> store this securely\n# response.inbox_id  -> my-agent@agentmail.to\n# response.organization_id\n\n# Verify with OTP sent to your email\nclient = AgentMail(api_key=response.api_key)\nclient.agent.verify(otp_code=\"123456\")\n```\n\n```typescript\nconst client = new AgentMailClient();\nconst response = await client.agent.signUp({\n    humanEmail: \"you@example.com\",\n    username: \"my-agent\",\n});\n\u002F\u002F response.apiKey, response.inboxId, response.organizationId\n\nconst authedClient = new AgentMailClient({ apiKey: response.apiKey });\nawait authedClient.agent.verify({ otpCode: \"123456\" });\n```\n\nThe sign-up endpoint is idempotent: calling again with the same email rotates the API key and resends the OTP.\n\n## Inboxes\n\nCreate scalable inboxes on-demand. Each inbox has a unique email address. No domain verification needed for `@agentmail.to`.\n\n```python\nfrom agentmail.inboxes.types import CreateInboxRequest\n\n# Create inbox (auto-generated address)\ninbox = client.inboxes.create()\n# inbox.inbox_id, inbox.email\n\n# Create with options. All create kwargs go inside a CreateInboxRequest.\ninbox = client.inboxes.create(\n    request=CreateInboxRequest(\n        username=\"support\",\n        domain=\"yourdomain.com\",       # optional, defaults to agentmail.to\n        display_name=\"Support Agent\",\n        client_id=\"support-v1\",        # idempotency key, safe to retry\n    ),\n)\n\n# List all inboxes\ninboxes = client.inboxes.list()\n# Paginate: client.inboxes.list(limit=20, page_token=inboxes.next_page_token)\n\n# Get, update, delete\ninbox = client.inboxes.get(inbox_id=\"support@agentmail.to\")\nclient.inboxes.update(inbox_id=\"support@agentmail.to\", display_name=\"New Name\")\nclient.inboxes.delete(inbox_id=\"support@agentmail.to\")\n```\n\n```typescript\nconst inbox = await client.inboxes.create({\n    username: \"support\",\n    domain: \"yourdomain.com\",\n    displayName: \"Support Agent\",\n    clientId: \"support-v1\",\n});\n\nconst inboxes = await client.inboxes.list();\nconst fetched = await client.inboxes.get(\"support@agentmail.to\");\nawait client.inboxes.update(\"support@agentmail.to\", { displayName: \"New Name\" });\nawait client.inboxes.delete(\"support@agentmail.to\");\n```\n\nCustom domains require a paid plan. Default `@agentmail.to` inboxes are free.\n\n## Messages\n\n### Send\n\nAlways provide both `text` and `html` for best deliverability. Maximum 50 recipients across to + cc + bcc combined.\n\n```python\nsent = client.inboxes.messages.send(\n    inbox_id=\"agent@agentmail.to\",\n    to=\"recipient@example.com\",       # string or list\n    subject=\"Hello from AgentMail\",\n    text=\"Plain text body\",\n    html=\"\u003Cp>HTML body\u003C\u002Fp>\",          # optional but recommended\n    cc=\"cc@example.com\",              # optional, string or list\n    bcc=\"bcc@example.com\",            # optional, string or list\n    reply_to=\"replies@example.com\",   # optional\n    labels=[\"outreach\"],              # optional\n    attachments=[{                    # optional\n        \"filename\": \"report.pdf\",\n        \"content\": base64_content,    # Base64-encoded\n        \"content_type\": \"application\u002Fpdf\",\n    }],\n)\n# sent.message_id, sent.thread_id\n```\n\n```typescript\nconst sent = await client.inboxes.messages.send(\"agent@agentmail.to\", {\n    to: \"recipient@example.com\",\n    subject: \"Hello from AgentMail\",\n    text: \"Plain text body\",\n    html: \"\u003Cp>HTML body\u003C\u002Fp>\",\n    cc: \"cc@example.com\",\n    labels: [\"outreach\"],\n    attachments: [{\n        filename: \"report.pdf\",\n        content: base64Content,\n        contentType: \"application\u002Fpdf\",\n    }],\n});\n```\n\n### List and get\n\n```python\n# List messages in an inbox. Note: .list() returns MessageItem objects\n# (metadata only — subject, from, labels, timestamps, etc.) with NO body\n# content. To read .text \u002F .html \u002F .extracted_text you must fetch the full\n# message with .get().\nresponse = client.inboxes.messages.list(\n    inbox_id=\"agent@agentmail.to\",\n    limit=10,                # optional, default varies\n    labels=[\"unread\"],       # optional, filter by label\n)\nfor item in response.messages:\n    # item is a MessageItem (metadata only). Fetch the full Message for body:\n    msg = client.inboxes.messages.get(\n        inbox_id=item.inbox_id,\n        message_id=item.message_id,\n    )\n    # Use extracted_text for reply content without quoted history\n    content = msg.extracted_text or msg.text\n    print(msg.subject, content)\n\n# Paginate\nwhile response.next_page_token:\n    response = client.inboxes.messages.list(\n        inbox_id=\"agent@agentmail.to\",\n        page_token=response.next_page_token,\n    )\n\n# Get a specific message\nmsg = client.inboxes.messages.get(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n)\n\n# Get raw MIME content\nraw = client.inboxes.messages.get_raw(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n)\n```\n\n```typescript\nconst response = await client.inboxes.messages.list(\"agent@agentmail.to\", {\n    limit: 10,\n    labels: [\"unread\"],\n});\n\nconst msg = await client.inboxes.messages.get(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n);\n```\n\n**Important**: when processing inbound replies, always use `extracted_text` \u002F `extracted_html` instead of `text` \u002F `html`. These fields strip quoted history and signatures, giving you only the new content. This is powered by Talon reply extraction.\n\nAlso note: some email clients (Gmail, Outlook) send forwards as HTML-only. Always treat `html` as the primary content source and `text` as optional.\n\n### Reply\n\nReplying adds the message to the existing thread.\n\n```python\nreply = client.inboxes.messages.reply(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    text=\"Thanks for your email!\",\n    html=\"\u003Cp>Thanks for your email!\u003C\u002Fp>\",   # optional\n    attachments=[...],                       # optional\n    reply_all=False,                         # optional, defaults to False\n)\n```\n\n```typescript\nconst reply = await client.inboxes.messages.reply(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    { text: \"Thanks for your email!\" },\n);\n```\n\n### Forward\n\n```python\nclient.inboxes.messages.forward(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    to=\"colleague@example.com\",\n    text=\"FYI, see below.\",       # optional prepended text\n)\n```\n\n```typescript\nawait client.inboxes.messages.forward(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    {\n        to: \"colleague@example.com\",\n        text: \"FYI, see below.\",\n    },\n);\n```\n\n### Update labels\n\nUse labels to track message processing state. AgentMail does not have a built-in \"read\u002Funread\" flag. Use labels instead.\n\n```python\nclient.inboxes.messages.update(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    add_labels=[\"processed\", \"replied\"],\n    remove_labels=[\"unread\"],\n)\n```\n\n```typescript\nawait client.inboxes.messages.update(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    {\n        addLabels: [\"processed\", \"replied\"],\n        removeLabels: [\"unread\"],\n    },\n);\n```\n\n### Attachments\n\n```python\nimport base64\n\n# Send with attachment\nwith open(\"report.pdf\", \"rb\") as f:\n    content = base64.b64encode(f.read()).decode()\n\nclient.inboxes.messages.send(\n    inbox_id=\"agent@agentmail.to\",\n    to=\"user@example.com\",\n    subject=\"Report attached\",\n    text=\"See attached.\",\n    attachments=[{\n        \"filename\": \"report.pdf\",\n        \"content\": content,\n        \"content_type\": \"application\u002Fpdf\",\n    }],\n)\n\n# Retrieve attachment from received message\nattachment = client.inboxes.messages.get_attachment(\n    inbox_id=\"agent@agentmail.to\",\n    message_id=\"\u003Cabc123@agentmail.to>\",\n    attachment_id=\"att_456\",\n)\n```\n\n```typescript\nimport { readFileSync } from \"node:fs\";\n\nconst content = readFileSync(\"report.pdf\").toString(\"base64\");\n\nawait client.inboxes.messages.send(\"agent@agentmail.to\", {\n    to: \"user@example.com\",\n    subject: \"Report attached\",\n    text: \"See attached.\",\n    attachments: [{ filename: \"report.pdf\", content, contentType: \"application\u002Fpdf\" }],\n});\n\nconst attachment = await client.inboxes.messages.getAttachment(\n    \"agent@agentmail.to\",\n    \"\u003Cabc123@agentmail.to>\",\n    \"att_456\",\n);\n```\n\n## Threads\n\nThreads group related messages in a conversation. When you send a new message, a thread is created. Replies are added to the same thread automatically.\n\n```python\n# List threads in an inbox\nthreads = client.inboxes.threads.list(\n    inbox_id=\"agent@agentmail.to\",\n    labels=[\"unreplied\"],     # optional filter\n)\n\n# Get a specific thread with all messages\nthread = client.inboxes.threads.get(\n    inbox_id=\"agent@agentmail.to\",\n    thread_id=\"thd_123\",\n)\nfor msg in thread.messages:\n    print(msg.subject, msg.extracted_text)\n\n# Org-wide thread listing (across all inboxes)\nall_threads = client.threads.list()\n\n# Delete a thread\nclient.inboxes.threads.delete(\n    inbox_id=\"agent@agentmail.to\",\n    thread_id=\"thd_123\",\n)\n```\n\n```typescript\nconst threads = await client.inboxes.threads.list(\"agent@agentmail.to\", {\n    labels: [\"unreplied\"],\n});\n\nconst thread = await client.inboxes.threads.get(\"agent@agentmail.to\", \"thd_123\");\n\nconst allThreads = await client.threads.list();\n```\n\n## Drafts\n\nCreate drafts for human-in-the-loop approval. The agent composes a draft, a human reviews, then the draft is sent.\n\n```python\n# Create draft\ndraft = client.inboxes.drafts.create(\n    inbox_id=\"agent@agentmail.to\",\n    to=\"recipient@example.com\",\n    subject=\"Pending approval\",\n    text=\"Draft content for review\",\n    html=\"\u003Cp>Draft content for review\u003C\u002Fp>\",\n)\n\n# List drafts\ndrafts = client.inboxes.drafts.list(inbox_id=\"agent@agentmail.to\")\n\n# Get, update\ndraft = client.inboxes.drafts.get(inbox_id=\"agent@agentmail.to\", draft_id=draft.draft_id)\nclient.inboxes.drafts.update(\n    inbox_id=\"agent@agentmail.to\",\n    draft_id=draft.draft_id,\n    text=\"Updated draft content\",\n)\n\n# Send draft (converts to message, removes from drafts)\nclient.inboxes.drafts.send(inbox_id=\"agent@agentmail.to\", draft_id=draft.draft_id)\n\n# Delete draft without sending\nclient.inboxes.drafts.delete(inbox_id=\"agent@agentmail.to\", draft_id=draft.draft_id)\n```\n\n```typescript\nconst draft = await client.inboxes.drafts.create(\"agent@agentmail.to\", {\n    to: \"recipient@example.com\",\n    subject: \"Pending approval\",\n    text: \"Draft content\",\n});\n\nawait client.inboxes.drafts.send(\"agent@agentmail.to\", draft.draftId, {});\n```\n\n## Pods (multi-tenant isolation)\n\nPods provide isolated environments for SaaS platforms. Each pod has its own set of inboxes.\n\n```python\n# Create pod per customer\npod = client.pods.create(\n    name=\"customer-acme\",\n    client_id=\"pod-acme-v1\",   # idempotent\n)\n\n# Create inbox within pod (pods.inboxes.create accepts flat kwargs)\ninbox = client.pods.inboxes.create(\n    pod_id=pod.pod_id,\n    username=\"notifications\",\n    client_id=\"acme-notifications-v1\",\n)\n\n# List inboxes scoped to pod\ninboxes = client.pods.inboxes.list(pod_id=pod.pod_id)\n\n# List threads scoped to pod\nthreads = client.pods.threads.list(pod_id=pod.pod_id)\n\n# List, get, delete pods\npods = client.pods.list()\npod = client.pods.get(pod_id=pod.pod_id)\nclient.pods.delete(pod_id=pod.pod_id)\n```\n\n```typescript\nconst pod = await client.pods.create({ name: \"customer-acme\", clientId: \"pod-acme-v1\" });\nconst inbox = await client.pods.inboxes.create(pod.podId, {\n    username: \"notifications\",\n    clientId: \"acme-notifications-v1\",\n});\nconst inboxes = await client.pods.inboxes.list(pod.podId);\n```\n\n## Allow\u002Fblock lists\n\nControl which external senders can deliver to an inbox. Block list takes priority over allow list.\n\nLists are flat. Each entry is one `(direction, type, entry)` tuple — there is no batch update, no `.allow` \u002F `.block` sub-namespace. `direction` is `\"send\"`, `\"receive\"`, or `\"reply\"`. `type` is `\"allow\"` or `\"block\"`.\n\n```python\n# Allow a sender on incoming mail\nclient.inboxes.lists.create(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n    entry=\"boss@company.com\",\n)\n\n# Block a sender on incoming mail\nclient.inboxes.lists.create(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"block\",\n    entry=\"spammer@example.com\",\n)\n\n# List entries for one (direction, type) pair\nallow = client.inboxes.lists.list(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n)\n\n# Check a single entry\nentry = client.inboxes.lists.get(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n    entry=\"boss@company.com\",\n)\n\n# Remove an entry\nclient.inboxes.lists.delete(\n    inbox_id=\"agent@agentmail.to\",\n    direction=\"receive\",\n    type=\"allow\",\n    entry=\"boss@company.com\",\n)\n```\n\n```typescript\nawait client.inboxes.lists.create(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"allow\",\n    { entry: \"boss@company.com\" },\n);\n\nawait client.inboxes.lists.create(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"block\",\n    { entry: \"spammer@example.com\" },\n);\n\nconst allow = await client.inboxes.lists.list(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"allow\",\n);\n\nawait client.inboxes.lists.delete(\n    \"agent@agentmail.to\",\n    \"receive\",\n    \"allow\",\n    \"boss@company.com\",\n);\n```\n\n## Domains\n\nCustom domains let agents send from your own domain (e.g., `agent@yourdomain.com`). SPF, DKIM, and DMARC records are auto-generated. Requires paid plan.\n\n```python\n# Add domain. feedback_enabled is required: set True to route\n# bounce\u002Fcomplaint notifications to your inboxes.\ndomain = client.domains.create(domain=\"yourdomain.com\", feedback_enabled=True)\n# domain.records -> list of VerificationRecord objects to add at your registrar\n\n# Verify after DNS records are set\nclient.domains.verify(domain_id=domain.domain_id)\n\n# List, get, delete\ndomains = client.domains.list()\ndomain = client.domains.get(domain_id=domain.domain_id)\nclient.domains.delete(domain_id=domain.domain_id)\n```\n\n```typescript\nconst domain = await client.domains.create({\n    domain: \"yourdomain.com\",\n    feedbackEnabled: true,\n});\nawait client.domains.verify(domain.domainId);\n```\n\n## Real-time events\n\nAgentMail supports both WebSockets and webhooks for real-time notifications. See `references\u002Fwebhooks.md` and `references\u002Fwebsockets.md` for detailed setup and full code examples.\n\n### WebSockets (recommended for agents)\n\nNo public URL needed. Persistent connection with instant delivery.\n\n**Python (sync):**\n```python\nfrom agentmail import AgentMail, Subscribe, Subscribed, MessageReceivedEvent\n\nclient = AgentMail()\nwith client.websockets.connect() as socket:\n    socket.send_subscribe(Subscribe(inbox_ids=[\"agent@agentmail.to\"]))\n    for event in socket:\n        if isinstance(event, Subscribed):\n            print(f\"Subscribed to: {event.inbox_ids}\")\n        elif isinstance(event, MessageReceivedEvent):\n            print(f\"From: {event.message.from_}\")\n            print(f\"Subject: {event.message.subject}\")\n            print(f\"Body: {event.message.extracted_text}\")\n```\n\n**Python (async):**\n```python\nfrom agentmail import AsyncAgentMail, Subscribe, MessageReceivedEvent\n\nclient = AsyncAgentMail()\nasync with client.websockets.connect() as socket:\n    await socket.send_subscribe(Subscribe(inbox_ids=[\"agent@agentmail.to\"]))\n    async for event in socket:\n        if isinstance(event, MessageReceivedEvent):\n            await process_email(event.message)\n```\n\n**TypeScript:**\n```typescript\nconst socket = await client.websockets.connect();\nsocket.on(\"open\", () => {\n    socket.sendSubscribe({ type: \"subscribe\", inboxIds: [\"agent@agentmail.to\"] });\n});\nsocket.on(\"message\", (event) => {\n    \u002F\u002F Use event.eventType (not event.type — event.type is always \"event\")\n    if (event.eventType === \"message.received\") {\n        \u002F\u002F TypeScript uses .from directly; only Python needs .from_ (reserved keyword)\n        console.log(\"From:\", event.message.from);\n        console.log(\"Subject:\", event.message.subject);\n    }\n});\n```\n\n### Webhooks\n\nHTTP POST to your endpoint on email events. Requires a public URL.\n\n`event_types` is **required** — you must pick at least one event to subscribe to. Pass an explicit list of every event you want to receive.\n\n```python\nwebhook = client.webhooks.create(\n    url=\"https:\u002F\u002Fyour-server.com\u002Fwebhooks\",\n    event_types=[\"message.received\", \"message.bounced\"],\n)\n# webhook.webhook_id, webhook.secret\n\n# List, get, delete\nwebhooks = client.webhooks.list()\nclient.webhooks.delete(webhook_id=webhook.webhook_id)\n```\n\nTyped webhook event types (listed in the SDK's Literal): `message.received`, `message.sent`, `message.delivered`, `message.bounced`, `message.complained`, `message.rejected`, `domain.verified`.\n\nRuntime-only events — accepted by the API but not in the SDK's typed Literal — include `message.received.spam` and `message.received.blocked`. Pass them as plain strings if you need them. Type checkers will flag them; that's expected.\n\nAlways verify webhook signatures before processing. See `references\u002Fwebhooks.md`.\n\n## Idempotency\n\nPass `client_id` \u002F `clientId` on create operations to make them safe to retry:\n\n```python\nfrom agentmail.inboxes.types import CreateInboxRequest\n\ninbox = client.inboxes.create(\n    request=CreateInboxRequest(client_id=\"my-unique-key\"),\n)\n# Calling again with the same client_id returns the existing inbox, not a duplicate\n\npod = client.pods.create(client_id=\"pod-unique-key\")\n# pods.create takes flat kwargs; same idempotency behavior\n```\n\n## Error handling\n\nBoth SDKs raise\u002Fthrow on 4xx and 5xx responses. On 429 (rate limit), read the `Retry-After` header and use exponential backoff. Both SDKs retry automatically (default: 2 retries).\n\n```python\ntry:\n    client.inboxes.messages.send(inbox_id, to=\"user@example.com\", subject=\"Hi\", text=\"Hello\")\nexcept Exception as e:\n    print(f\"Error: {e}\")\n    # e.body.message contains details if available\n\n# Python: override retries per call via request_options\n# (the AgentMail constructor has no max_retries argument)\nclient.inboxes.messages.send(\n    inbox_id,\n    to=\"user@example.com\",\n    subject=\"Hi\",\n    text=\"Hello\",\n    request_options={\"max_retries\": 5},\n)\n```\n\n```typescript\ntry {\n    await client.inboxes.messages.send(inboxId, {\n        to: \"user@example.com\",\n        subject: \"Hi\",\n        text: \"Hello\",\n    });\n} catch (err) {\n    console.error(\"Error:\", err.message);\n    \u002F\u002F err.statusCode, err.body for details\n}\n\n\u002F\u002F TypeScript: override retries globally on the client, or per-call via requestOptions\nconst client = new AgentMailClient({ apiKey: \"...\", maxRetries: 5 });\n```\n\n## IMAP and SMTP\n\nAgentMail inboxes are accessible via standard IMAP and SMTP protocols, enabling integration with traditional email clients and legacy systems. See https:\u002F\u002Fdocs.agentmail.to\u002Fimap-smtp for setup details.\n\n## Pagination\n\nAll list endpoints use cursor-based pagination:\n\n```python\nresponse = client.inboxes.messages.list(inbox_id, limit=20)\nwhile response.next_page_token:\n    response = client.inboxes.messages.list(\n        inbox_id, limit=20, page_token=response.next_page_token\n    )\n```\n\n## Reference files\n\nFor detailed coverage of specific topics:\n- `references\u002Fwebhooks.md` -- webhook setup, event types, payload structure, signature verification\n- `references\u002Fwebsockets.md` -- WebSocket connection, sync\u002Fasync patterns, event handler pattern, subscribe options\n- `references\u002Ffull-api-reference.md` -- complete endpoint and SDK method table with all parameters\n",{"name":5,"license":15,"metadata":24,"description":7},{"author":25,"version":26},"agentmail-to","1.0","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fskills_sh\u002Fs\u002Fskills-sh_agentmail-to_agentmail-skills_agentmail-sdk",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill agentmail-sdk",{"tool":42,"command":43},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill agentmail-sdk",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill agentmail-sdk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_agentmail-to_agentmail-skills_agentmail-sdk\u002FSKILL.md",true,[],[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]