Python SDK Reference
The rodiun package provides sync and async Python clients for the Rodiun platform, plus the rodiun CLI.
Installation
pip install rodiun
Quick example
from rodiun import RodiuClient
client = RodiuClient.from_config() # reads RODIUN_API_KEY from env
result = client.run("rodiun.notification-email@1.0.0", inputs={
"to": "user@example.com",
"from_address": "noreply@app.com",
"subject": "Hello",
"body": "World",
})
print(result["receipt"]["trust_score"])
RodiuClient
Class methods
RodiuClient.from_config(env_file: str | None = None) -> RodiuClient
Creates a client from environment variables (RODIUN_API_KEY, RODIUN_BASE_URL).
RodiuClient(api_key: str, base_url: str = "https://api.rodiun.io") -> RodiuClient
Instance methods
| Method | Description |
|---|---|
run(orb_id, inputs) | Execute an Orb synchronously |
get_receipt(receipt_id) | Retrieve an OPAL Trust Receipt |
list_orbs() | List available Orbs |
swap_provider(orb_id, provider) | Trigger a hot-swap for an Orb |
Async client
from rodiun import AsyncRodiuClient
import asyncio
async def main():
client = AsyncRodiuClient.from_config()
result = await client.run("rodiun.notification-email@1.0.0", inputs={...})
print(result["status"])
asyncio.run(main())
Error handling
from rodiun.exceptions import OrbNotFoundError, RateLimitError, RodiuError
try:
result = client.run("unknown.orb@1.0.0", inputs={})
except OrbNotFoundError as e:
print(f"Orb not found: {e.orb_id}")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after_ms}ms")
except RodiuError as e:
print(f"Error: {e}")