Skip to main content
Use Python against the live ThreeTone API today with requests. When the official SDK is published, these auth and payload conventions will remain the same, so you can migrate incrementally.

Install dependencies

pip install requests

Create an agent

import requests

url = "https://api.threetone.in/v1/convai/agents/create"
headers = {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json",
}
payload = {
    "name": "Customer Support Agent",
    "system_prompt": "You are a helpful customer support representative.",
}

response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.json()["agent_id"])
Canonical source file: /examples/python/create_agent.py

Verify a webhook signature

import hashlib
import hmac

def is_valid_signature(payload: bytes, signature: str, secret: str) -> bool:
    digest = hmac.new(secret.encode("utf-8"), payload, hashlib.sha256).hexdigest()
    return hmac.compare_digest(f"sha256={digest}", signature)
Canonical source file: /examples/python/verify_webhook.py

Next steps