Skip to main content

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.

PyPI version Python 3.9+ License: MIT

Installation

pip install loomal-sdk

The distribution is loomal-sdk on PyPI, but the import name is loomal.

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 from field in message responses is exposed as from_addrs since from is 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

loomal_sdk-0.1.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loomal_sdk-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

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

Hashes for loomal_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3de96b246f815fd8db0c83b13894c40709a2b0f9fda33b68de04203bc2319ae6
MD5 09368e57a0d0f7a1e4d55db1944a4477
BLAKE2b-256 58bd816d90d255a3135a1423aba4734b27f45d24cc99220d18d3144fab40c127

See more details on using hashes here.

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

Hashes for loomal_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c26e9f947e97dbb625a701df1c6509c9937ab2bf1c941a203e87eaf660a6242
MD5 249036e506aa2721fe5f65ecc6d82498
BLAKE2b-256 c909ff7b1831e8d77b654f193c6b2bdc12bb10e025a9cf1f34bfe30a4a01f0f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page