hail-sdk
Python SDK for Hail — give your AI agent a voice, a real phone number, and an inbox.
Install
pip install hail-sdk
Requires Python 3.11+.
Quickstart
import asyncio
from hail import Client
async def main():
async with Client(api_key="sk-...") as client:
# Place an outbound call.
call = await client.calls.create(
to="+15551234567",
system_prompt="You are calling to confirm a reschedule.",
)
print("queued", call.id)
async for event in client.events.tail(id=f"call:{call.id}"):
print(event.kind, event.payload)
# Send an outbound email.
email = await client.emails.create(
to=["alice@example.com"],
subject="Welcome",
body_text="Thanks for signing up.",
)
print(email.status, email.from_address)
asyncio.run(main())
api_key defaults to $HAIL_API_KEY; base_url defaults to $HAIL_API_URL
(falling back to https://api.hail.so).
API surface
Calls
client.calls.create(*, to, system_prompt=None, llm=None, from_=None, first_message=None, metadata=None, idempotency_key=None)— originate an outbound call. Pass eithersystem_prompt(mode A) or a fullllmblock (mode B).idempotency_keydefaults to a fresh UUIDv4.client.calls.get(call_id)— fetch a single call.client.calls.list(*, cursor=None, limit=50, status=None, to=None)— cursor-paginated org list.
Emails
client.emails.create(*, to, subject, body_text=None, body_html=None, from_=None, cc=None, bcc=None, reply_to=None, conversation_id=None, metadata=None, idempotency_key=None)— send an outbound email. At least one ofbody_text/body_htmlis required.from_is optional while the org has one verified sender; with several the server returns 422 and you must name one (readdefault_fromfromclient.email_domains.list()). With none it auto-mints a hail-mail address (operator-configured).idempotency_keydefaults to a fresh UUIDv4.client.emails.get(email_id)— fetch a single email.client.emails.list(*, cursor=None, limit=50, status=None)— cursor-paginated org list.
Identity
client.whoami()— who the API key belongs to:auth_kind,organization_id,user_id,email,name. The user fields areNonefor a shared operator key. Useemailasreply_toso replies reach the person, not the sending domain.
Events
client.events.list(*, id=None, kind=None, cursor=None, limit=100)— one-shot fetch ofGET /events.idis a typed<type>:<uuid>string (v1 only supportscall:).client.events.tail(*, id=None, kind=None, interval_seconds=0.5, follow=True)— async-iterator tail; auto-exits on terminal call status when narrowed toid=call:<uuid>.
Errors
All SDK errors derive from hail.HailError. HTTP-status-coded errors carry .status_code, .detail, and .response_text:
HailAuthError(401)HailNotFoundError(404)HailIdempotencyConflict(409)HailValidationError(422)HailServerError(5xx, after retry budget)HailClientError(other 4xx)HailMalformedResourceId— local validation of<type>:<uuid>stringsHailConfigError— no API key supplied or discoverable
Retries
GET/HEAD/PUT/DELETE — and any POST/PATCH carrying an Idempotency-Key — are retried up to 3 times on 5xx with exponential backoff (0.5s, 1.0s, 2.0s) plus jitter, honoring Retry-After when present. Mutating verbs without an idempotency key fail fast on 5xx so a duplicate side effect can't be silently introduced.
License
Release files for hail-sdk 0.17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hail_sdk-0.17.0.tar.gz | 39.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hail_sdk-0.17.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.1 kB
Release files / hail_sdk-0.17.0.tar.gz
| Download URL | hail_sdk-0.17.0.tar.gz |
|---|---|
| Size | 39.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91e2287b3d5d25d8e6e06be6354ec250fd5b7086ac2e33fd55b4055f1c068211
|
|
BLAKE2b-256 checksum How to use checksums |
d77bf01304014603e7067daeeaa1ad89dd360d9f149840dbe91bb4cb530c1543
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / hail_sdk-0.17.0-py3-none-any.whl
| Download URL | hail_sdk-0.17.0-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab58b19dbcec54e2652a7a17e0e43687e3d8a0de86b7d730cc45f8cd0c9b3dab
|
|
BLAKE2b-256 checksum How to use checksums |
1ff6c42113a8d9ea095a7c8e32a70dca81ea5979c647b7c45bff43814ac76443
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log