Skip to main content
These examples are maintained as source files in the repo and syntax-checked in CI.

Create an agent

import requests

response = requests.post(
    "https://api.threetone.in/v1/convai/agents/create",
    headers={
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "name": "Customer Support Agent",
        "system_prompt": "You are a helpful customer support representative.",
    },
    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