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:
- The v1 push/CLI surface is no longer shipped (2026-11-25). The host discovers the plugin through its own entry
point (
hermes_agent.plugins/deerflow.extensions); the installer, the door-ops entry (sdk_ops) and the v1 deer-flow adapter left the tree and the wheel with the whole push/CLI surface. Nothing in the package patches a host or spawns a CLI any more. - The v1 hermes adapter is gone (2026-11-25).
pysdk/hermes/was deleted, so the wheel no longer carriesaimail.hermes.aimail_hermesand hermes needs no source patch at all: install ispip install agent-aimailand the host loads thehermes_agent.pluginsentry point. The same applies to deer-flow:pysdk/deer-flow/left too, and the host loadsdeerflow.extensions. - 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.4.1
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.4.1-py3-none-any.whl | Python 3 | none | any | Details for agent_aimail-0.4.1-py3-none-any.whl |
Release files / agent_aimail-0.4.1-py3-none-any.whl
| Download URL | agent_aimail-0.4.1-py3-none-any.whl |
|---|---|
| Size | 188.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6e9d07df64e051fbe37888cc27b644f98ad494d59e133d56e690dfe6c9f1586
|
|
BLAKE2b-256 checksum How to use checksums |
809d69dcb71bbffdab187b3eb46b43aa2c15f265661389b685e76066282e2e5f
|
| 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 28, 2026.
Transparency logSecurity for agent-aimail 0.4.1
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.4.1-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 28, 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.