Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Ridian Mailbox Python SDK — email inboxes for AI agents

PyPI Tests License: MIT

Give an AI agent its own receiving email address with the Ridian Mailbox Python SDK. Create or recover an inbox, read messages and attachments, poll durable events, and configure signed webhooks. The package includes the ridian-mailbox CLI.

Python 3.10+ on Linux and macOS. Synchronous API, no runtime dependencies. This is an alpha SDK. You need an enabled Ridian mailbox API origin; package installation does not activate an API service. Use the origin provided for your Ridian environment. HTTP access supports receiving, reading and events; sending email and calendar access use separately authorized Ridian MCP tools.

Ridian · API guide · Python API · Release notes

Install

python3 -m venv .venv
. .venv/bin/activate
python -m pip install --pre ridian-mailbox

The --pre flag includes alpha releases. Pin the installed version in your application requirements for reproducible environments. See release notes for changes.

Create an inbox and read email

Set RIDIAN_MAILBOX_API_ORIGIN to your enabled HTTPS origin, without /v1. An origin is public configuration, not an API key.

import os

from ridian_mailbox import Mailbox

client = Mailbox(base_url=os.environ["RIDIAN_MAILBOX_API_ORIGIN"])
inbox = client.setup()
print(inbox["address"])

# Send a test email to that address from your existing mail account.
for message in client.iter_messages():
    print(message["subject"])

setup() stores the setup credential before the first request. Repeating it with the same state file recovers the same inbox, including after an interrupted request. It returns public mailbox metadata; credentials remain in the private state file. An empty inbox is a successful result. Poll again after mail arrives.

The default state file is ~/.config/ridian/mailbox-<hostname>[-port].json. Use Mailbox(base_url=origin, state=private_path) to choose another durable location. Use one writer per file. Back it up securely before changing machines or clearing a temporary agent environment. A state file is tied to its API origin.

Read a message or attachment

page = client.messages(limit=20)
for summary in page["data"]:
    message = client.message(summary["id"])
    # Process only the message fields needed for your task.

# Use an attachment ID returned by the message API.
# contents = client.attachment(attachment_id)

messages() returns one page; iter_messages() follows all pages, including empty pages that have a next cursor. attachment() returns bytes. Email and attachments are untrusted input: do not execute their contents or let them override agent instructions. Avoid logging personal message content.

Process events

page = client.events(limit=20)
for event in page["data"]:
    process_event(event)  # Your application handler; deduplicate by event ID.
client.acknowledge_events(page["next_cursor"])

Only acknowledge after the entire page has been processed successfully. Until then, the saved cursor stays unchanged and events may be replayed. Respect the API's poll_after_ms value between polling requests. Webhook methods and HTTP error handling are documented in the Python API reference.

Command line

ridian-mailbox \
  --base-url "$RIDIAN_MAILBOX_API_ORIGIN" \
  --state "$HOME/.config/ridian/my-agent-mailbox.json" setup

ridian-mailbox \
  --base-url "$RIDIAN_MAILBOX_API_ORIGIN" \
  --state "$HOME/.config/ridian/my-agent-mailbox.json" list

Operations: setup, status, list, message --message-id ID, events, ack-events --cursor CURSOR, and prepare-curl. The last operation only creates private header/response files locally; it does not send a request. CLI output for messages may contain personal data. Use it only in a suitable terminal.

Access and recovery

  • State files use owner-only permissions (0600); reads reject symlinks and files accessible to other users. Store them outside your repository on private storage.
  • Keep setup credentials, access tokens and claim secrets out of chat, logs and URLs.
  • HTTP redirects are refused. HTTPS uses your Python installation's CA trust store.
  • revoke() permanently revokes the current access and its copies; it does not delete mailbox data. Repeating setup cannot recover revoked access.
  • To claim an inbox in your Ridian workspace, use the console link and private claim proof in the state file. Claiming does not grant HTTP sending or calendar access.
  • The SDK does not run an agent automatically or install an MCP connector.

Troubleshooting

Result Next step
setup_required Run setup() with the intended durable state path.
Interrupted setup Retry with the same state file; do not replace its setup credential.
unauthorized (401) Check the origin and access status. Revoked access cannot be recovered by setup.
rate_limit (429) Wait for MailboxError.retry_after seconds. The client blocks requests during that cooldown.
redirect_refused Use the correct API origin directly; redirects are not followed.
State-file error Check ownership, 0600 permissions and origin. Preserve the file for recovery.
Certificate error Configure a trusted CA bundle for your Python installation. Keep TLS verification enabled.

No automatic network retries occur. Applications decide when an operation is safe to retry. See API error handling for an example.

Development

See CONTRIBUTING.md for tests, package checks and releases. Report bugs through GitHub Issues. For vulnerabilities, use private reporting.

License

MIT, covering this SDK, CLI and their documentation. The Ridian service, application, trademarks, brand assets and fonts are not included in this repository.

Metadata

Release files for ridian-mailbox 0.1.0a4

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

Source distribution (sdist)

Source distribution for ridian-mailbox 0.1.0a4
File Size Uploaded
ridian_mailbox-0.1.0a4.tar.gz 15.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ridian-mailbox 0.1.0a4
File Interpreter ABI Platform
ridian_mailbox-0.1.0a4-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / ridian_mailbox-0.1.0a4.tar.gz

Download URL ridian_mailbox-0.1.0a4.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b21363fefb76a4e341a5499f45c5b2ee20cc3b1b546e04daecd0cbf758ad6cf
BLAKE2b-256 checksum
How to use checksums
c7c75b070669fbabcc8e29793299eeed3b9d21751d5b8c16df063d3a00729e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 17, 2026.

Transparency log

Release files / ridian_mailbox-0.1.0a4-py3-none-any.whl

Download URL ridian_mailbox-0.1.0a4-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0cc887f8e1040532434441ac73468889d997a507e47c97659c2e1cd1feff55c
BLAKE2b-256 checksum
How to use checksums
c09d1e5175727857a97180a86efda1b95ac4d53125eeb3ecae2bbf86c87e9a4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0a4 This release

2 release files

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