Skip to main content

rydhm

The Rydhm API from Python: voice and chat experts, the Onboarding coach inside your app, and rep calls (a human rep on the phone from the browser, Rydhm transcribing, suggesting and leaving AI voicemails).

  • Sync Rydhm and asyncio AsyncRydhm clients, built on httpx.
  • Typed pydantic v2 models with snake_case attributes, typed errors, retries with backoff, timeouts.
  • Live event streams (Server-Sent Events) as iterators that reconnect by themselves.
  • Python 3.9+.
pip install rydhm

On PyPI: pypi.org/project/rydhm. Docs: docs.rydhm.ai/developers/sdk-python.

Set up

Create a secret API key in the Rydhm app (Developers → API keys) with only the scopes you need. Keep it on your server.

from rydhm import Rydhm

client = Rydhm()  # reads RYDHM_API_KEY
# or: Rydhm(api_key="rydhm_live_...", base_url="https://api-staging.rydhm.ai", timeout=30, max_retries=2)

Every method takes request_options={"timeout": 10, "max_retries": 0, "headers": {...}}. Use the client as a context manager (with Rydhm() as client:) to close its connections when you are done.

Quickstart: Onboarding coach

The coach lives in your web app through @rydhm/web. From your server you sign users and keep the coach's guides and page map in code.

import os
from rydhm import Rydhm, sign_user_id

client = Rydhm()
expert_id = os.environ["RYDHM_EXPERT_ID"]

# 1. A publishable key for your website (experts:write).
key = client.engine.publishable_keys.create(
    expert_id, name="Production", allowed_origins=["https://app.example.com"], require_signed_user=True
)
print(key.key)  # rydhm_pk_live_...: goes in your page

# 2. Sign your users (the workspace's user-signing secret, from the Rydhm app).
user_hash = sign_user_id(os.environ["RYDHM_ENGINE_USER_SECRET"], "user_42")
# page: Rydhm.init({ key, user: { id: "user_42", hash: user_hash } })

# 3. The page map and a guide, as code (nested JSON is the API's camelCase).
client.engine.page_targets.sync(expert_id, [
    {"name": "Invite button", "selector": "[data-test=invite]", "textHint": "Invite", "pagePattern": "/settings/team"},
    {"name": "New project", "selector": "#new-project"},
])
client.engine.guides.create(
    expert_id,
    name="Invite your team",
    nudge="Want me to show you how to invite your team?",
    trigger={"type": "first_visit"},
    steps=[
        {"id": "open", "title": "Open Team settings", "instruction": "Take them to Settings, then Team.",
         "pagePattern": "/settings/team", "completeWhen": {"type": "page", "value": "/settings/team"}},
        {"id": "invite", "title": "Send an invite", "instruction": "Show the Invite button.",
         "target": "Invite button", "completeWhen": {"type": "event", "value": "invite_sent"}},
    ],
)

# 4. See how it goes (experts:read).
stats = client.engine.analytics(expert_id, days=30)
for funnel in stats.guides:
    print(funnel.name, f"{funnel.completed}/{funnel.started}")
for person in client.engine.end_users.list(expert_id, q="acme"):  # every page
    print(person.external_id, person.last_seen_at)

Quickstart: rep calls

Rep calls are in preview: the routes are live for early-access workspaces (https://api-staging.rydhm.ai); small changes are still possible before launch.

A key with calls:write and calls:read:

client.reps.upsert("usr_4821", name="Maya Patel", mobile_number="+14155550101")

# The rep's browser goes online with this (hand the whole thing to the page):
token = client.reps.softphone_token("usr_4821").model_dump(by_alias=True)  # {url, token, presenceRoom, expiresAt}

call = client.rep_calls.create(
    rep="usr_4821",
    to="+14155550199",
    external_ref="act_77120",
    suggestions=True,
    context={"prospect": {"name": "Dana Kim", "company": "Acme"}, "goal": "Book a demo"},
    idempotency_key="act_77120",  # a retried request never dials twice
)
# hand call.join (url, token) to the browser: softphone.join(call)

for event in client.rep_calls.events(call.id):
    if event.type == "call.answered" and event.data.by == "machine":
        client.rep_calls.leave_voicemail(call.id)  # AI waits for the beep, speaks, hangs up
    elif event.type == "call.transcript" and event.data.final:
        print(f"{event.data.speaker}: {event.data.text}")
    elif event.type == "call.suggestion":
        print("Ask:", event.data.text)
    elif event.type == "call.summary":
        print(event.data.outcome, event.data.summary)  # then call.completed, and the stream ends

client.rep_calls.hangup(call.id)  # safe to repeat

Recordings: pass record=True; whether a call is recorded follows your workspace's recording policy and the prospect's state (call.recording says so live). Webhooks stay thin: on call.recording.ready, fetch a signed link (10 minutes).

rec = client.rep_calls.recording(call_id)
if rec.status == "ready":
    print(rec.url, rec.duration_seconds)
client.rep_calls.delete_recording(call_id)  # safe to repeat

# Where the prospect's consent to an AI voice came from, kept on the call and in the audit log:
client.rep_calls.leave_voicemail(call_id, consent={"source": "Demo request form", "obtained_at": "2026-11-10T09:30:00Z"})
# Outside 8 am-9 pm their time, for a reason the rule does not cover:
client.rep_calls.create(rep="usr_4821", to="+19495550199", calling_hours_exception={"reason": "prospect_asked", "note": "Asked for 10 pm"})

Callbacks ring the rep: put numbers in a pool, and listen to the rep's stream.

pool = client.number_pools.create(
    name="West coast",
    strategy="local_presence",
    callback_routing={"order": ["rep_browser", "rep_mobile", "voicemail"], "ringSeconds": 20},
)
# Then put numbers in it in the app (Sales calls > Numbers, inbound mode "rep"): phone-number routes are
# session-only today, so client.phone_numbers.update(...) needs an admin session.

for event in client.events.stream(rep_id="usr_4821"):
    if event.type == "call.incoming":
        print("Callback from", event.data.from_, "about", event.data.external_ref)

Async

import asyncio
from rydhm import AsyncRydhm

async def main() -> None:
    async with AsyncRydhm() as client:
        call = await client.rep_calls.create(rep="usr_4821", to="+14155550199")
        async for event in client.rep_calls.events(call.id, types=["call.transcript"]):
            print(event.data.speaker, event.data.text)
        page = await client.rep_calls.list(rep="usr_4821")
        async for c in client.rep_calls.list():  # every call
            print(c.id, c.status)

asyncio.run(main())

Live events

rep_calls.events(call_id) and events.stream(rep_id=...) return an EventStream of typed events (CallTranscriptEvent, CallAnsweredEvent…; narrow on event.type or with isinstance).

  • Reconnects after a drop with backoff and the server's retry: hint, resuming with Last-Event-ID; duplicates are dropped by event id.
  • Heartbeats are skipped; no bytes for heartbeat_timeout (60 s) counts as a dead connection.
  • A call's stream ends after call.completed, the last event of every call (until="summary", "ended", or "never"); a 4xx is raised at once.
  • types=[...] keeps only some; with ... as stream: or stream.close() stops it; stream.last_event_id resumes later (last_event_id=).
  • An event type this version does not know arrives as a plain EngineEvent (with data as a dict).

Errors

from rydhm import PermissionDeniedError, RateLimitError, RydhmError

try:
    client.rep_calls.create(rep="usr_4821", to="+14155550199")
except PermissionDeniedError as e:
    print("Add these scopes to the key:", e.missing_scopes)
except RateLimitError as e:
    print("Try again in", e.retry_after_seconds, "s")
except RydhmError as e:
    print(e.status, e.code, e.message, e.request_id)
Exception When
BadRequestError 400
AuthenticationError 401
PaymentRequiredError 402 (upgrade_hint)
PermissionDeniedError 403 (missing_scopes)
NotFoundError 404
ConflictError 409 (stale_edit, duplicate names)
UnprocessableEntityError 422
RateLimitError 429 after retries (retry_after_seconds)
InternalServerError 5xx after retries
RydhmConnectionError the API could not be reached (status 0)
RydhmTimeoutError no answer in time (status 0)

Retries

Up to max_retries (2) more tries with exponential backoff or the server's Retry-After: a 429 with Retry-After on any call (the rate limiter: nothing was done; retry_on_rate_limit=False turns it off), and a 5xx, a timeout, a dropped connection or a 429 without Retry-After (pool_exhausted, concurrency_limit) only on calls that are safe to repeat (reads, PUT, DELETE, hangup, decline, revoke, reorder, meetings.leave, and anything with an idempotency_key).

Webhooks

from rydhm import WebhookVerificationError, verify_webhook

@app.post("/webhooks/rydhm")  # Flask
def rydhm_webhook():
    try:
        event = verify_webhook(os.environ["RYDHM_WEBHOOK_SECRET"], request.headers, request.get_data())
    except WebhookVerificationError:
        return "bad signature", 400
    if event.type == "call.summary.ready":
        crm.log(event.data["call"]["external_ref"], event.data["summary"]["snippet"])
    return "", 204

Everything else

experts = client.experts.list()
result = client.chat.ask(experts[0].id, "What can you help with?")
client.chat.ask(experts[0].id, "And pricing?", conversation_id=result.conversation_id)
# Or stream a reply as it is written: send the turn, then read the stream (ask() already read its own).
client.chat.send(result.conversation_id, "Do you offer a free trial?")
for frame in client.chat.stream(result.conversation_id):
    ...
client.knowledge.add(expert_id, filename="faq.md", content="# FAQ\n...")
hits = client.knowledge.search(expert_id, "refund policy")
token = client.voice.session(expert_id)
client.meetings.join(join_url="https://meet.google.com/abc-defg-hij", agent_id=expert_id, idempotency_key="evt-123")
client.request("GET", "/v1/analytics/usage", query={"from": "2026-11-01", "to": "2026-11-08"})  # any route

Development

cd packages/sdk-python
python -m venv .venv && .venv/Scripts/python -m pip install -e ".[test]" build   # (bin/ on macOS and Linux)
python scripts/unasync.py        # regenerate the async resources after editing resources/_sync.py
python -m pytest
python -m build                  # dist/rydhm-0.1.0.tar.gz and the wheel

resources/_sync.py is the one place the routes are written; resources/_async.py is generated from it (a test fails when it is stale). The rep-call routes and models follow backend/api/src/rep-calls and @tony/shared engine/repCalls.ts (the "rep calls" parts of _sync.py and _models.py).

Metadata

Release files for rydhm 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rydhm 0.1.3
File Size Uploaded Provenance Actions
rydhm-0.1.3.tar.gz 68.6 kB Without provenance Details for rydhm-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rydhm 0.1.3
File Interpreter ABI Platform Actions
rydhm-0.1.3-py3-none-any.whl Python 3 none any Details for rydhm-0.1.3-py3-none-any.whl

Total release size: 122.7 kB

Release files / rydhm-0.1.3.tar.gz

Download URL rydhm-0.1.3.tar.gz
Size 68.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1002acdc8e57589de774791686a1d7b62ba6b864a817bf89a3a171b4dfe69b16
BLAKE2b-256 checksum
How to use checksums
01b7acbc54ce84a6b73d863563ef6e8f5737dc6d4a67c36ff06a8853ebaef112
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / rydhm-0.1.3-py3-none-any.whl

Download URL rydhm-0.1.3-py3-none-any.whl
Size 54.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b94e3f510dd63f2614c7f8beb4227d39e75991b263ef790d2d6e177d07fcc71
BLAKE2b-256 checksum
How to use checksums
1aeb0d2d1971a289478c39a6fe7311a58b4fab3cfb0cd9431537181b4872cb1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for rydhm 0.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page