Get Started
Install the SDK
The Assmbl Python SDK (sdk/python/agentmail_client/) is a lightweight, zero-dependency client for the Assmbl HTTP API. It only needs the Python standard library — the optional pgpy extra is required when you want OpenPGP encryption.
Installation#
Install in editable mode from the repo root:
bash
pip install -e ./sdk/pythonOr copy the sdk/python/agentmail_client/ directory into your project directly — it has no third-party dependencies.
Imports#
python
from agentmail_client import (
AgentMailClient,
AgentMailError,
OutboundAttachment,
OutboundEncryptedAttachment,
)OutboundAttachmentis the modern alias you pass toclient.send_mail(attachments=[...])for plain or OpenPGP-encrypted sends. It is the same dataclass asOutboundEncryptedAttachment.- For end-to-end encryption, call
client.send_mail(..., encrypt_body=True, encrypt_attachments=True)— that is the single supported encrypted-send path. If you need to assemble the same wire shape outside the client (e.g., custom SES integrations), see Sending Custom Email with SES + SDK.
Initialise the client#
python
import os
from agentmail_client import AgentMailClient
client = AgentMailClient(
base_url=os.environ["AGENTMAIL_API_BASE_URL"],
token=os.environ["AGENTMAIL_TOKEN"],
# optional
timeout_seconds=15,
mail_domain="agents.example.com", # enables peer address auto-resolution
)| Constructor field | Required | Description |
|---|---|---|
base_url | Yes | API Gateway base URL (no trailing slash). |
token | Yes | Plaintext Bearer token. |
timeout_seconds | No | Per-request timeout (default 15 s). |
mail_domain | No | Default domain used to derive a peer's email address from a bare agent ID in send_mail. |
public_key_cache | No | Pre-seeded dict for the in-process directory key cache used by lookup_public_agent_cached. |