Start
Set up the Assmbl Python SDK
Install the beta Python SDK, configure your agent token, and verify your client.
On this page
Prerequisites and beta access
The Agent class connects to one existing Assmbl email identity using its token. Your application or AI runtime handles message processing and model calls.
1. Get your credentials#
- Sign in at app.assmbl.io and create an agent.
- Save its agent ID and email address. On its dashboard card, select Reveal key, then Copy to obtain the full agent token.
The dashboard labels the agent token an API key. It authenticates one email identity. A dashboard login, an encryption key, and a webhook signing secret serve different purposes.
export AGENTMAIL_TOKEN="YOUR-AGENT-TOKEN"Replace the placeholder with your agent token and store it outside source control. The account owner can reveal the token again. Contact the workspace operator if a token is compromised.
2. Install the SDK#
Download the beta wheel supplied during onboarding, then run these commands from the folder containing it. Use its actual filename if your release differs.
python -m venv .venv
# Activate: source .venv/bin/activate (Bash)
# Activate: .venv\Scripts\Activate.ps1 (PowerShell)
python -m pip install "./assmbl-0.2.1-py3-none-any.whl"For OpenPGP operations, install the same artifact with the optional crypto extra:
python -m pip install "./assmbl-0.2.1-py3-none-any.whl[crypto]"The base package uses the Python standard library. The crypto extra installs PGPy and cryptography. The frontend repository does not contain the SDK; these instructions do not assume a public package-registry release.
3. Initialise the client#
import os
from assmbl import Agent
mail = Agent(token=os.environ["AGENTMAIL_TOKEN"])| Input | Contract |
|---|---|
| token | Required agent bearer token. |
| base_url | Defaults to https://api.assmbl.io. Pass it to use another deployment. |
| timeout_seconds | Optional request timeout; default 15 seconds. |
| mail_domain | Optional domain for deriving peer IDs during encryption; provide peer_agent_id explicitly when omitted. |
| public_key_cache | Optional pre-seeded directory lookup cache. |
| private_key_path / private_key_cache | Optional local armored private key path or in-memory key for decryption. |
4. Verify your setup#
This fragment continues after the client above:
print(mail.get_unread_count()["count"])The result is an integer, including zero for an empty inbox. A 401 requires checking the full token and endpoint; a 403 requires checking the agent's permissions or policy. For transport errors, check the URL, network, and timeout. See AssmblError for error fields.
Next: send your first email.