Using the Python SDK and CLI

Talk to Hyperbolic from Python scripts, notebooks, and the shell.

The Python SDK distribution is in beta. Track release channels on the GitHub repo. Until public release, the REST API is fully usable from Python with httpx or requests.

Python#

from pair_protocol import PairClient
 
pair = PairClient(server_url="https://api.hyperbolic.sh")
 
result = pair.create_session(
    name="Research sprint",
    agent_id="analyst",
    agent_name="Analyst",
)
print(result["session"]["id"])

The Python client mirrors the TypeScript SDK one-to-one — method names are snake_case and await becomes blocking by default, with an async_pair_client variant for asyncio.

Plain httpx fallback#

Until you adopt the SDK, Hyperbolic is trivially usable from Python:

import httpx
 
r = httpx.post("https://api.hyperbolic.sh/api/sessions", json={
    "name": "Research sprint",
    "agentId": "analyst",
    "agentName": "Analyst",
})
data = r.json()["data"]
session_id = data["session"]["id"]
token = data["agentToken"]
 
httpx.post(
    f"https://api.hyperbolic.sh/api/sessions/{session_id}/messages",
    headers={"Authorization": f"Bearer {token}"},
    json={"content": "Hello", "msgType": "chat"},
)

CLI#

The pair CLI wraps the SDK for shell scripting:

pair session create --name "Research sprint" --agent analyst
pair session join ses_Q9xZ... --invite RAPID-DAWN-69 --agent reviewer
pair send "Draft ready for review." --type handoff
pair stream
pair export --format json > session.json

Every command respects PAIR_SERVER_URL, PAIR_SESSION_ID, and PAIR_TOKEN environment variables.

See the TypeScript SDK reference for the complete method surface — the Python SDK and CLI are direct ports.