Skip to main content

Ravi SDK — Python client for the Ravi identity API

Project description

ravi

The Python SDK for Ravi — the identity provider for AI agents.

pip install ravi
import os
from ravi import Ravi

# Keys are ravi_id_... (scoped to one identity) or ravi_mgmt_... (account-wide).
ravi = Ravi(api_key=os.environ["RAVI_API_KEY"])

# Create an identity. The email address is an identifier (local part) plus an
# optional domain; omit both to auto-generate. provision_phone adds a number.
identity = ravi.identities.create(email_identifier="support-agent", provision_phone=True)
print(identity.inbox, identity.phone)   # support-agent@... , +1...

# Place an outbound voice call from the identity's number.
call = ravi.calls.start(to_number="+15551234567")
print(call.uuid, call.status)
transcript = ravi.calls.transcript(call.id)

# Replay events — the deploy-safe companion to the wss://<host>/ws/events/ stream.
for event in ravi.events.list(since=0, event_types=["call.ended", "email.message.received"]):
    print(event.seq, event.type, event.data)

By default the SDK talks to the Ravi API at https://api.ravi.id (override with RAVI_BASE_URL or base_url=).

Status

Getting an API key

Mint a key one of three ways, then pass it as Ravi(api_key=...) (or set RAVI_API_KEY):

  • ravi auth login with the Ravi CLI (one-time human sign-in, then agents self-serve),
  • POST /api/auth/keys/management/ from an authenticated session, or
  • the dashboard at /dashboard/api-keys/.

Keys are ravi_mgmt_... (account-wide) or ravi_id_... (scoped to one identity).

Resources

Accessor Endpoints
ravi.identities identity bundles + provision_phone + voice_agent
ravi.email inboxes, messages (compose/reply/reply_all/forward), threads
ravi.phones provisioned numbers (read-only)
ravi.sms SMS list/get/send + conversations
ravi.calls start/list/get/hangup/transcript
ravi.events durable event replay (list(since=...))
ravi.contacts directory + find + search
ravi.passwords website credentials + generate
ravi.secrets key/value secrets
ravi.mfa TOTP secrets
ravi.domains verified domains (read-only)
ravi.webhooks subscriptions + deliveries log
ravi.api_keys management + identity keys

Verifying inbound webhooks

Ravi signs each webhook with X-Ravi-Timestamp + X-Ravi-Signature: sha256=<hex> over "{timestamp}.{raw_body}". Verify against the raw body:

from ravi import verify_webhook_signature, WebhookSignatureError

try:
    verify_webhook_signature(
        raw_body,                       # bytes/str, exactly as received
        request.headers["X-Ravi-Timestamp"],
        request.headers["X-Ravi-Signature"],
        signing_secret,                 # from the webhook subscription
    )
except WebhookSignatureError as exc:
    ...  # reject: exc.code is "invalid_header" | "expired" | "signature_mismatch"

License

Apache 2.0.

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

ravi_sdk-0.2.0.tar.gz (79.2 kB view details)

Uploaded Source

Built Distribution

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

ravi_sdk-0.2.0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file ravi_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: ravi_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 79.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for ravi_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cbd3f6db4a89ac4a762b770430b0514f6558e046274e9c1d330e24f0390d2ca2
MD5 9197edad058967a959e3192ec8a642eb
BLAKE2b-256 4fc0bb06d38c21c60a5d5e81a1c587627d2be4d6c5373a3f311e0fa8ee0d66a2

See more details on using hashes here.

File details

Details for the file ravi_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ravi_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for ravi_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 936ffab8d1c46dd925deb8b44e8cafb70dd8a06bd11f0534a8232deae089bc4a
MD5 3e9a1d06244eb84b0a09b613942e47b1
BLAKE2b-256 9aa9eed02c8efe15eba6c0f01e6dfb03650ded0ebd6e0b3b8fa5b24621151ee2

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