AgentMail SDK Integration
Overview
Use this skill to turn AgentMail requirements into production-ready Python or Node implementations.
Prefer generated references for endpoint contracts and types instead of guessing SDK signatures.
Workflow
- Identify language target (
Python or Node) and integration mode (SDK, REST, Webhook, WebSocket).
- Load
references/documentation-guide.md for architecture and operational guidance.
- Load language file:
- Python:
references/python-sdk.md
- Node:
references/node-sdk.md
- Validate endpoint contract against
references/endpoint-matrix.md.
- Resolve field-level structure from
references/data-structures.md.
- Implement with idempotency (
client_id) for create operations and signature verification for webhooks.
Language Selection Rules
- Use
references/python-sdk.md when generating Python code with AgentMail / AsyncAgentMail.
- Use
references/node-sdk.md when generating TypeScript/Node code with AgentMailClient.
- Use
references/endpoint-matrix.md for cross-language parity checks and unsupported SDK convenience paths.
- Use
references/documentation-guide.md when designing flow-level behavior (send/receive loop, webhook lifecycle, deliverability, IMAP/SMTP fallback).
Implementation Rules
- Always include both
text and html when sending messages, unless requirements explicitly constrain format.
- Always use deterministic
client_id for create operations (inbox, webhook, pod, etc.).
- Always verify webhook signatures (
svix-id, svix-timestamp, svix-signature) before trusting payload.
- Always model reply/forward flows with
message_id and thread_id to preserve conversation continuity.
- Always handle
from_ compatibility in payload parsing (from_ vs from).
- Always treat list management APIs (
/lists, /pods/{pod_id}/lists) as REST-first if SDK helper methods are not available.
- Always confirm filtering/pagination inputs (
limit, page_token, before, after, labels, ascending, include_spam, include_blocked) from reference before coding.
Output Expectations
When asked to generate code, produce:
- Runnable snippet(s) for the requested language.
- Explicit method/interface used and parameter mapping.
- Input/output type annotations aligned with references.
- Notes for error handling, retries, and idempotency.
- Event handling path if real-time behavior is involved (webhook or websocket).
Refresh References
Run this script to re-sync docs and regenerate references from docs.agentmail.to:
python scripts/sync_agentmail_references.py --skill-dir .
References
references/documentation-guide.md: product-level behavior and best practices.
references/python-sdk.md: Python interface map, IO types, and examples.
references/node-sdk.md: Node interface map, IO types, and examples.
references/endpoint-matrix.md: full endpoint contract matrix across protocols.
references/data-structures.md: schema field inventory.
1---2name: agentmail-sdk-integration3description: Integrate AgentMail into Python or Node.js applications with accurate API/SDK interfaces, input-output types, and data structures. Use when implementing inbox/message/thread/draft/domain/webhook/websocket/metrics/pod workflows, generating AgentMail client code, reviewing AgentMail integration correctness, or mapping business requirements to concrete AgentMail endpoints.4---56# AgentMail SDK Integration78## Overview910Use this skill to turn AgentMail requirements into production-ready Python or Node implementations.11Prefer generated references for endpoint contracts and types instead of guessing SDK signatures.1213## Workflow14151. Identify language target (`Python` or `Node`) and integration mode (`SDK`, `REST`, `Webhook`, `WebSocket`).162. Load `references/documentation-guide.md` for architecture and operational guidance.173. Load language file:18 - Python: `references/python-sdk.md`19 - Node: `references/node-sdk.md`204. Validate endpoint contract against `references/endpoint-matrix.md`.215. Resolve field-level structure from `references/data-structures.md`.226. Implement with idempotency (`client_id`) for create operations and signature verification for webhooks.2324## Language Selection Rules2526- Use `references/python-sdk.md` when generating Python code with `AgentMail` / `AsyncAgentMail`.27- Use `references/node-sdk.md` when generating TypeScript/Node code with `AgentMailClient`.28- Use `references/endpoint-matrix.md` for cross-language parity checks and unsupported SDK convenience paths.29- Use `references/documentation-guide.md` when designing flow-level behavior (send/receive loop, webhook lifecycle, deliverability, IMAP/SMTP fallback).3031## Implementation Rules32331. Always include both `text` and `html` when sending messages, unless requirements explicitly constrain format.342. Always use deterministic `client_id` for create operations (`inbox`, `webhook`, `pod`, etc.).353. Always verify webhook signatures (`svix-id`, `svix-timestamp`, `svix-signature`) before trusting payload.364. Always model reply/forward flows with `message_id` and `thread_id` to preserve conversation continuity.375. Always handle `from_` compatibility in payload parsing (`from_` vs `from`).386. Always treat list management APIs (`/lists`, `/pods/{pod_id}/lists`) as REST-first if SDK helper methods are not available.397. Always confirm filtering/pagination inputs (`limit`, `page_token`, `before`, `after`, `labels`, `ascending`, `include_spam`, `include_blocked`) from reference before coding.4041## Output Expectations4243When asked to generate code, produce:44451. Runnable snippet(s) for the requested language.462. Explicit method/interface used and parameter mapping.473. Input/output type annotations aligned with references.484. Notes for error handling, retries, and idempotency.495. Event handling path if real-time behavior is involved (webhook or websocket).5051## Refresh References5253Run this script to re-sync docs and regenerate references from `docs.agentmail.to`:5455```bash56python scripts/sync_agentmail_references.py --skill-dir .57```5859## References6061- `references/documentation-guide.md`: product-level behavior and best practices.62- `references/python-sdk.md`: Python interface map, IO types, and examples.63- `references/node-sdk.md`: Node interface map, IO types, and examples.64- `references/endpoint-matrix.md`: full endpoint contract matrix across protocols.65- `references/data-structures.md`: schema field inventory.