AIMail SDK for Python
AIMail = AI + Mail: the native email system for the AI age, built for human-Agent-Agent collaboration.
AIMail is a globe-reaching, tightly-controllable, collaboration-ready email system for AI agents. It lets an Agent communicate, interact, and collaborate with the outside world over email the way a person does.
This package is the Python SDK: the gateway client, the 15 mail/contact/note/board/identity tools, the inbound preprocessing chain, and host adapters for Hermes and DeerFlow.
Install
pip install agent-aimail
That is the whole installation. There is no CLI install step, no source patch and no per-profile port: the package declares two host entry points and each host discovers it on its own.
| Host | Entry point | What the host does |
|---|---|---|
| Hermes | hermes_agent.plugins → aimail.hermes_plugin:register |
registers the platform adapter + the mail tools, then starts one aggregate stream per (AgentSystemId, Gateway) |
| DeerFlow | deerflow.extensions → aimail.deerflow_plugin:install |
registers the 15 mail tools and starts the same aggregate stream |
A host needs an activation first (aimail_address tool, action bind, plus an activation
code). Until a binding exists the adapters register their tools and bind no port.
How mail flows (SSE-V2)
gateway ──SSE /stream──▶ one aggregate stream per (AgentSystemId, Gateway)
│ delivery: {id, email, headers, body}
├─ binding re-read at delivery time (pause/archive wins)
├─ thread root (references[0] → in-reply-to → message-id)
├─ outbound alias chase (reply-to-our-reply → same thread)
├─ host session / run (hermes chat_id · deerflow thread run)
└─ ack — only after the host accepted the mail
- a delivery the host did not take stays pending on the gateway (
skip⇒ paused/unknown target, a raise ⇒ transport/host refusal); nothing is silently lost - replies stay in their thread: every outbound mail records
message-id → thread rootnext to the binding that sent it - one
Statusline per stream, refreshed by the reconcile loop (SSE reconcile: N …)
Requirements
- Python ≥ 3.9 (the host's own interpreter; the adapters import the SDK through the package, not through a path)
- An AIMail gateway ≥ v1.0.15 for the aggregate SSE endpoint (
/stream); older gateways fall back to long-pull automatically
0.3.0 — breaking
This release replaces the webhook/push transport with the SSE-V2 contract. Upgrading from 0.2.x:
- push/webhook is gone. No inbound HTTP listener, no
webhook_*binding fields, no patch of the host's webhook module. Mail arrives by pulling the gateway's own stream. aimail installis retired. The host discovers the plugin through its entry point; the source-patch helpers (patch_webhook,patch_profiles,register_profiles,ensure_config,toolsets) are no longer shipped in the wheel. They remain in the repository for the audit trail only. Three legacy modules still ship and are importable for compatibility (aimail.install,aimail.sdk_ops,aimail.hermes.aimail_hermes); no console entry point wires them andaimail installis not a command any more — removal in 0.3.1.- Activation is code-only.
aimail_address(action="bind", code=…)returns a binding that carriesagent_system_idandworkspace_path; a single-address host refuses a second address instead of silently replacing the first. - Transport semantics changed: ack happens only after the host accepted the mail, and a
paused/unknown target is reported as
skip(not ack, not an error) so it is re-evaluated on the next round. - Reply threading is explicit:
send_mailrecords the outbound Message-ID alias, so an external reply to our reply lands in the same host session (before, it opened a new one).
Related
- aimail — CLI (
cli/), TypeScript SDK (tssdk/), bridge. - aimail-gateway — the mail service this SDK talks to.
Building an adapter for a new platform: see docs/agent-adapter-playbook.md and the host contract in docs/aimail-host-sse-contract-v2.md.
Metadata
Release files for agent-aimail 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_aimail-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for agent_aimail-0.3.0-py3-none-any.whl |
Release files / agent_aimail-0.3.0-py3-none-any.whl
| Download URL | agent_aimail-0.3.0-py3-none-any.whl |
|---|---|
| Size | 258.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40e5d1597407605682418139aecd418788a5508e8e97d571732c0bb8f3df7182
|
|
BLAKE2b-256 checksum How to use checksums |
11a5b4d9b2b9e03dff099497e1be1a44d8f3caf818d98738ff26ac38e27c895c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for agent-aimail 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
1 file in this release has been uploaded with provenance metadata.
Attestation for agent_aimail-0.3.0-py3-none-any.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.