Skip to main content

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 root next to the binding that sent it
  • one Status line 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 carries aimail.hermes.aimail_hermes and hermes needs no source patch at all: install is pip install agent-aimail and the host loads the hermes_agent.plugins entry point. The same applies to deer-flow: pysdk/deer-flow/ left too, and the host loads deerflow.extensions.
  • Activation is code-only. aimail_address(action="bind", code=…) returns a binding that carries agent_system_id and workspace_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_mail records the outbound Message-ID alias, so an external reply to our reply lands in the same host session (before, it opened a new one).
  • 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for agent-aimail 0.4.0
File Interpreter ABI Platform Actions
agent_aimail-0.4.0-py3-none-any.whl Python 3 none any Details for agent_aimail-0.4.0-py3-none-any.whl

Release files / agent_aimail-0.4.0-py3-none-any.whl

Download URL agent_aimail-0.4.0-py3-none-any.whl
Size 188.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
063cbc04f7ff063b11ec79e3a06aa1a09538b8e9f0640bde50a2486a8936c660
BLAKE2b-256 checksum
How to use checksums
6a4dc66c868874e7571364bf5faf3ee70ed1403d3696fbd71e2c1c0e8cb58f4e
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 26, 2026.

Transparency log

Security for agent-aimail 0.4.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.4.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 26, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page