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)
Vault
The vault is password-manager-style encrypted secret storage (AES-256-GCM at rest). Use client.vault.store() for arbitrary types, or the typed helpers below.
# Simple API key
client.vault.store_api_key("stripe", "sk_live_...")
# OAuth-style client credentials (client id + secret)
client.vault.store_api_key("twitter", {
"clientId": "abc123",
"secret": "def456",
})
# Credit card (encrypted at rest — this is a secret vault, not a payment processor)
client.vault.store_card("personal-visa", {
"cardholder": "Jane Doe",
"number": "4242 4242 4242 4242",
"expMonth": "12",
"expYear": "2029",
"cvc": "123",
"zip": "94103",
}, metadata={"brand": "Visa"})
# Shipping address
client.vault.store_shipping_address("home", {
"name": "Autonomous Agent",
"line1": "1 Demo Way",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
})
Supported credential types: LOGIN, API_KEY, OAUTH, TOTP, SSH_KEY, DATABASE, SMTP, AWS, CERTIFICATE, CARD, SHIPPING_ADDRESS, CUSTOM.
More resources
The SDK also exposes client.mail, client.calendar, 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.2.0.tar.gz.
File metadata
- Download URL: loomal_sdk-0.2.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
935e05a56135c8c0671cdd65d56623c10856ef52b465066456d0a865d3610534
|
|
| MD5 |
dad0b184c6b0cd9b42ac0c347be8223a
|
|
| BLAKE2b-256 |
5067a40cc79d4a1a6058dd163079bbd0f7cccb6ab13a6b1255a9f5b19ca9b251
|
Provenance
The following attestation bundles were made for loomal_sdk-0.2.0.tar.gz:
Publisher:
publish.yml on loomal-ai/loomal-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loomal_sdk-0.2.0.tar.gz -
Subject digest:
935e05a56135c8c0671cdd65d56623c10856ef52b465066456d0a865d3610534 - Sigstore transparency entry: 1324876038
- Sigstore integration time:
-
Permalink:
loomal-ai/loomal-python@8dd625d65686838660278b213c4651e4fd3b580b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/loomal-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dd625d65686838660278b213c4651e4fd3b580b -
Trigger Event:
release
-
Statement type:
File details
Details for the file loomal_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: loomal_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.6 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 |
d995d65bf7b7b463c5b7f37b55ccdefab83b5d3c7cb4f6ab7c01ce2364e3da9a
|
|
| MD5 |
4fedf0a339761110caf3c57c14c19025
|
|
| BLAKE2b-256 |
eabc681be71b6b4ca5ef9fd1d2533f7b83f0e78687316c9c43d77cb5ada6fdf2
|
Provenance
The following attestation bundles were made for loomal_sdk-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on loomal-ai/loomal-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loomal_sdk-0.2.0-py3-none-any.whl -
Subject digest:
d995d65bf7b7b463c5b7f37b55ccdefab83b5d3c7cb4f6ab7c01ce2364e3da9a - Sigstore transparency entry: 1324876183
- Sigstore integration time:
-
Permalink:
loomal-ai/loomal-python@8dd625d65686838660278b213c4651e4fd3b580b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/loomal-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dd625d65686838660278b213c4651e4fd3b580b -
Trigger Event:
release
-
Statement type: