> ## Documentation Index
> Fetch the complete documentation index at: https://docs.threetone.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Python Examples

> Runnable Python examples for authenticating and creating agents

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

## Create an agent

```python theme={null}
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

```python theme={null}
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`
