Python SDK
cohesion-sdk on PyPI. Type-hinted, retry-aware, async-ready.
Official Python SDK for the COHESION scoring API.
What this is
A thin, typed wrapper around the HTTP API. Handles auth, retries, idempotency keys, and response parsing.
Install
pip install cohesion-sdk
Requires Python 3.11 or newer.
Quickstart
from cohesion import Client
client = Client(api_key="ck_live_...")
resp = client.score(
session_id="sess-001",
operator_id="analyst-42",
domain="financial",
interaction={
"ai_recommendation_presented": True,
"time_to_decision_ms": 1800,
"decision": "modified",
"modification_extent": 0.3,
"ai_available": True,
"scenario_type": "standard",
"outcome_correct": None,
"hover_events": 2,
"scroll_depth": 0.7,
"alternative_views_checked": 1,
},
)
print(resp.jis, resp.band)
Async
from cohesion import AsyncClient
async def main():
async with AsyncClient(api_key="ck_live_...") as client:
resp = await client.score(...)
More
- API reference, every method and return type.
- Cookbook, recipes for common patterns.
- TypeScript SDK, sister SDK.
- Authentication, key handling.