Skip to content

Python SDK

The rymi Python package provides a server-side wrapper around the Rymi REST API. Use it from backend services, workers, and data pipelines that need to manage agents, calls, numbers, and webhook verification.

INFO

The product brief lists Node, Browser, React, and Shared Types as the primary SDKs. The Python package is maintained in-repo and should be treated as a server-side SDK surface for teams that need Python integration.

Installation

bash
pip install rymi

Initialization

python
from rymi import Rymi

rymi = Rymi(api_key="rymi_your_secret_key")

# Or use the RYMI_API_KEY environment variable:
rymi = Rymi()

Agents

python
agent = rymi.agents.create(
    name="Customer Support",
    system_prompt="You are a helpful customer support assistant for Acme Corp.",
    voice="Aoede",
    language="en-US",
    agent_role="operator"
)

agent_id = agent["id"]
agents = rymi.agents.list(limit=20)
options = rymi.agents.llm_options()
python
# Clone an agent
clone = rymi.agents.clone(agent_id)

# List calls for an agent
calls = rymi.agents.list_calls(agent_id, limit=20)

# Validate before publishing
report = rymi.agents.validate_publish(agent_id=agent_id)

# Apply a change-set (does not persist — follow up with update())
result = rymi.agents.apply_changes(
    current_config={"name": "Support", "voice": "Aoede"},
    changes=[{"key": "voice", "value": "Charon"}],
    mode="edit"
)
rymi.agents.update(agent_id, **result["config"])

# Enrich company from website
info = rymi.agents.enrich_company("Acme Corp", "https://acme.example.com")
if info["enriched"]:
    print(info["companyDescription"])

Calls

python
call = rymi.calls.create(
    agent_id=agent_id,
    participants=[
        {
            "transport": "pstn",
            "identity": "+15551234567",
            "from_number": "+15559876543"
        }
    ],
    metadata={"customer_name": "Alice"},
    variables={"customer_segment": "renewal"}
)

details = rymi.calls.retrieve(call["id"])
transcript = rymi.calls.transcript(call["id"])

Batch Calls

python
batch = rymi.calls.batch(
    agent_id=agent_id,
    to=["+15551234567", "+15557654321"],
    from_number="+15559876543",
    variables={"batch_label": "renewal-q2"}
)

print(batch["batch_id"], batch["queued"])

Numbers

python
rymi.numbers.register("+15559876543")

numbers = rymi.numbers.list()
rymi.numbers.attach(numbers["numbers"][0]["number"], agent_id)

Webhooks

python
import json
from flask import Flask, request, jsonify
from rymi import Rymi

app = Flask(__name__)
rymi = Rymi()

@app.route("/webhook", methods=["POST"])
def handle_webhook():
    signature = request.headers.get("x-rymi-signature")
    timestamp = request.headers.get("x-rymi-timestamp")
    payload_raw = request.get_data(as_text=True)

    rymi.webhooks.verify_signature(
        payload_raw,
        signature,
        timestamp,
        "whsec_your_webhook_secret"
    )

    event = json.loads(payload_raw)
    if event["type"] == "call.intelligence.ready":
        print("Summary:", event["data"]["summary"])

    return jsonify(status="OK"), 200