Python SDK for AgenticEmail — API-first email for AI agents.
Project description
AgenticEmail Python SDK
The official Python library for the AgenticEmail API — programmatic inboxes, send and receive email, webhooks, and real-time events for AI agents.
Installation
pip install agenticemail
Optional extras: agenticemail[events] (WebSocket event stream), agenticemail[langchain] (LangChain toolkit).
Usage
import os
from agenticemail import AgenticEmail
client = AgenticEmail(api_key=os.environ["AGENTICEMAIL_API_KEY"])
# Give your agent an inbox in one call
inbox = client.inboxes.create(username="support", domain="acme.io")
# Send
client.messages.send(
inbox["id"],
to=["customer@example.com"],
subject="Hello",
text="Sent from an agent.",
)
# Read
threads = client.threads.list(inbox["id"])
Responses are plain dicts in the API's snake_case. Get an API key from the dashboard.
Real-time events
Requires the events extra (websocket-client):
for event in client.events.stream(event_types=["message.received"]):
print(event["type"], event["data"])
Webhook verification
from agenticemail import verify_webhook
event = verify_webhook(raw_body, request.headers, os.environ["WEBHOOK_SECRET"])
if event["type"] == "message.received":
...
verify_webhook raises AgenticEmailError when the signature is invalid.
LangChain toolkit
from agenticemail.langchain import AgenticEmailToolkit
tools = AgenticEmailToolkit.from_api_key().get_tools() # reads AGENTICEMAIL_API_KEY
Error handling
All non-2xx responses raise AgenticEmailError with .status, .code, and a message:
from agenticemail import AgenticEmailError
try:
client.inboxes.get("missing")
except AgenticEmailError as err:
print(err.status, err.code)
Self-hosted
client = AgenticEmail(api_key="am_...", base_url="https://your-agenticemail-host")
API surface
See api.md for every resource and method: inboxes, messages, threads, drafts, lists, webhooks, domains, api_keys, events.
Requirements
Python 3.9+. Fully type-annotated (py.typed).
Contributing
See CONTRIBUTING.md. This repo is an exported snapshot of the SDK developed in the AgenticEmail monorepo.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agenticemail-0.1.2.tar.gz.
File metadata
- Download URL: agenticemail-0.1.2.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f58eae8f0dba82fe57314c303535efd6455556a81a91d566e41420feeb37413
|
|
| MD5 |
689291bb070755635889e63953204355
|
|
| BLAKE2b-256 |
90f13c57fb9cb623bf905316e05645950ba843707bba14591dbf3778455b7e02
|
Provenance
The following attestation bundles were made for agenticemail-0.1.2.tar.gz:
Publisher:
publish.yml on AgenticEmail/agenticemail-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenticemail-0.1.2.tar.gz -
Subject digest:
6f58eae8f0dba82fe57314c303535efd6455556a81a91d566e41420feeb37413 - Sigstore transparency entry: 2080046829
- Sigstore integration time:
-
Permalink:
AgenticEmail/agenticemail-python@c2d617ab18420d12168c337f62f37cc7204c0f06 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AgenticEmail
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c2d617ab18420d12168c337f62f37cc7204c0f06 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file agenticemail-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agenticemail-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a70e7ce138a68981a19b7fbc4e8267eee25943344c89873f4e9df6a99acd964a
|
|
| MD5 |
de227dbe5bbc910159e29cc485ac31e2
|
|
| BLAKE2b-256 |
7ddef4f84f4fe4ac0e1598a90b1eda88f27c46ba3816422804c3b6fb407fe6af
|
Provenance
The following attestation bundles were made for agenticemail-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on AgenticEmail/agenticemail-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenticemail-0.1.2-py3-none-any.whl -
Subject digest:
a70e7ce138a68981a19b7fbc4e8267eee25943344c89873f4e9df6a99acd964a - Sigstore transparency entry: 2080046948
- Sigstore integration time:
-
Permalink:
AgenticEmail/agenticemail-python@c2d617ab18420d12168c337f62f37cc7204c0f06 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AgenticEmail
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c2d617ab18420d12168c337f62f37cc7204c0f06 -
Trigger Event:
workflow_dispatch
-
Statement type: