Docs/SDKs/Python

Python SDK.

The official Python client. Requires Python 3.10+. MIT-licensed. Source on GitHub at wrxstack/sdk-python.

Install

pip install wrxstack

Verify:

python -c "import wrxstack; print(wrxstack.__version__)"
# 0.4.2

Quickstart

from wrxstack import Client

client = Client()  # reads WRX_API_KEY and WRX_WORKSPACE from env

task = client.tasks.create(
    title="Review MSA",
    assignee="priya@acme.com",
)

run = client.assistants.invoke(
    assistant="redline",
    input={"task_id": task.id},
)

print(run.output)

Configuration

The client accepts every option as a keyword or as an environment variable.

client = Client(
    api_key="sk_live_...",        # or WRX_API_KEY
    workspace="acme",              # or WRX_WORKSPACE
    base_url="https://api.wrxstack.com/v1",
    timeout=30.0,
    max_retries=3,
)

Method index

NamespaceMethods
client.taskscreate, get, list, update, complete, comment
client.assistantscreate, get, list, invoke, audit
client.documentscreate, get, update, versions, diff, comments
client.searchquery
client.webhookscreate, list, get, delete, replay
client.graphquery, get_edges, add_edge, remove_edge
client.auditruns.get, search

Async

Every method has an async twin. Drop the Client in favor of AsyncClient:

import asyncio
from wrxstack import AsyncClient

async def main():
    async with AsyncClient() as c:
        task = await c.tasks.create(title="Async!")
        print(task.id)

asyncio.run(main())

Errors

Every API error becomes a typed Python exception with a stable name.

from wrxstack.errors import NotFound, ScopeInsufficient, RateLimited

try:
    task = client.tasks.get("tsk_does_not_exist")
except NotFound:
    handle_missing()
except RateLimited as e:
    sleep(e.retry_after_seconds)