Agent Letter — Python SDK
The physical-mail API for AI agents. Send a real, tracked, compliant letter with one call — the postal equivalent of giving an agent an email address.
Private beta. Request access at agentletter.dev.
Install
pip install agentletter
Quickstart
from agentletter import AgentLetter
client = AgentLetter() # reads AGENTLETTER_API_KEY from the environment
letter = client.send(
to={
"name": "Jane Doe",
"line1": "1 Market St",
"city": "San Francisco",
"state": "CA",
"zip": "94105",
},
body=pdf_bytes, # PDF bytes — or html="..." / template="..."
certified=True, # proof of delivery
)
print(letter.id, letter.status) # "ltr_9f2a" "in_transit"
Set your key once:
export AGENTLETTER_API_KEY="sk_live_..."
Sending content
Provide exactly one of:
client.send(to=addr, body=pdf_bytes) # a PDF
client.send(to=addr, html="<h1>Notice</h1>...") # rendered HTML
client.send(to=addr, template="tmpl_123",
variables={"name": "Jane", "amount": "$420"}) # a saved template
Typed addresses are supported too:
from agentletter import Address
client.send(
to=Address(name="Jane Doe", line1="1 Market St",
city="San Francisco", state="CA", zip="94105"),
body=pdf_bytes,
)
Tracking
letter = client.get("ltr_9f2a")
print(letter.status, letter.tracking_number, letter.expected_delivery)
Async
import asyncio
from agentletter import AsyncAgentLetter
async def main():
async with AsyncAgentLetter() as client:
letter = await client.send(to=addr, body=pdf_bytes, certified=True)
print(letter.id)
asyncio.run(main())
Errors
All errors subclass AgentLetterError:
from agentletter import AgentLetterError, AuthenticationError, RateLimitError
try:
client.send(to=addr, body=pdf_bytes)
except AuthenticationError:
... # bad / missing key
except RateLimitError:
... # back off and retry
except AgentLetterError as e:
print(e.status_code, e.message)
License
MIT
Metadata
Release files for agentletter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agentletter-0.1.0.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentletter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.0 kB
Release files / agentletter-0.1.0.tar.gz
| Download URL | agentletter-0.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d78d16e2da9888b0336e9b292fae8c5e39e8c5bf5383f32c2349ebaba7107f0b
|
|
BLAKE2b-256 checksum How to use checksums |
b82be9e6992ee286ac2204b96f89628aaf523f10fa639bdf6ac7cc4b2b619284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / agentletter-0.1.0-py3-none-any.whl
| Download URL | agentletter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33f0264d5eef01dabe5295eab66683349ee4eee04218ebca4fda489284d761b6
|
|
BLAKE2b-256 checksum How to use checksums |
a4119e7e213a5487ea7c368ab24d700e9e6141ca3d101f249aa439a0dd38b0a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for agentletter 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.