Official Python SDK for the Loomal API — identity infrastructure for AI agents
Project description
Loomal Python SDK
The official Python SDK for the Loomal API -- identity infrastructure for AI agents.
Installation
pip install loomal-sdk
The distribution is
loomal-sdkon PyPI, but the import name isloomal.
Quick start
from loomal import Loomal
client = Loomal(api_key="loid-...")
me = client.identity.whoami()
print(me.email)
client.mail.send(
to=["colleague@example.com"],
subject="Hello from my agent",
text="Sent via the Loomal Python SDK.",
)
Async usage
from loomal import AsyncLoomal
async with AsyncLoomal(api_key="loid-...") as client:
me = await client.identity.whoami()
await client.mail.send(
to=["colleague@example.com"],
subject="Hello",
text="Sent asynchronously.",
)
Authentication
Pass your API key directly, or set the LOOMAL_API_KEY environment variable:
# Explicit
client = Loomal(api_key="loid-...")
# From environment
import os
os.environ["LOOMAL_API_KEY"] = "loid-..."
client = Loomal()
Both Loomal and AsyncLoomal support context managers for automatic resource cleanup:
with Loomal() as client:
me = client.identity.whoami()
Usage
Identity
me = client.identity.whoami()
print(me.email, me.display_name)
More resources
The SDK also exposes client.mail, client.calendar, client.vault, client.logs, and client.did. See the full reference at docs.loomal.ai for request/response shapes, pagination, and end-to-end examples.
Error handling
All API errors raise LoomalError with structured fields:
from loomal import LoomalError
try:
client.mail.send(to=["a@b.com"], subject="Hi", text="Hello")
except LoomalError as e:
print(e.status) # HTTP status code
print(e.code) # Error code string
print(e.message) # Human-readable message
Types
The SDK returns typed dataclasses, not raw dictionaries. API responses are automatically converted from camelCase to snake_case.
| Type | Description |
|---|---|
IdentityResponse |
Agent identity details |
MessageResponse |
Email message |
ThreadResponse |
Thread summary |
ThreadDetailResponse |
Thread with messages |
CredentialMetadata |
Vault credential metadata |
CredentialWithData |
Credential with decrypted data |
ActivityLog |
Single activity log entry |
LogsStats |
Aggregated log statistics |
TotpResponse |
Generated TOTP code |
DidDocument |
DID document |
Note: The
fromfield in message responses is exposed asfrom_addrssincefromis a reserved keyword in Python.
Requirements
- Python 3.9+
httpx(installed automatically)
Links
License
MIT
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 loomal_sdk-0.1.0.tar.gz.
File metadata
- Download URL: loomal_sdk-0.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de96b246f815fd8db0c83b13894c40709a2b0f9fda33b68de04203bc2319ae6
|
|
| MD5 |
09368e57a0d0f7a1e4d55db1944a4477
|
|
| BLAKE2b-256 |
58bd816d90d255a3135a1423aba4734b27f45d24cc99220d18d3144fab40c127
|
File details
Details for the file loomal_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: loomal_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c26e9f947e97dbb625a701df1c6509c9937ab2bf1c941a203e87eaf660a6242
|
|
| MD5 |
249036e506aa2721fe5f65ecc6d82498
|
|
| BLAKE2b-256 |
c909ff7b1831e8d77b654f193c6b2bdc12bb10e025a9cf1f34bfe30a4a01f0f0
|