Metadata-Version: 2.5
Name: arrah
Version: 0.2.0
Summary: First-party Python client for Arrah AI outcome capture
Author: Arrah AI
License: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# Arrah Outcomes for Python

First-party, dependency-free client for attaching measured business outcomes to Arrah AI gateway requests.

```python
from arrah import Arrah

client = Arrah(api_key="nx_live_...")
client.record_outcome(
    {
        "request_id": "chatcmpl_...",
        "outcome_type": "ticket_resolved",
        "workflow": "customer support",
        "success": True,
    },
    idempotency_key="ticket-482-resolved-v1",
)
```

Discover the project registry and optionally validate before delivery:

```python
from arrah import validate_outcome

registry = client.get_outcome_schemas()
definition = next(item for item in registry["definitions"] if item["outcome_type"] == "ticket_resolved")
published = next(version for version in definition["versions"] if version["status"] == "published")
violations = validate_outcome(
    {"request_id": "chatcmpl_...", "outcome_type": "ticket_resolved", "success": True},
    published["rules"],
)
```

Use a stable idempotency key derived from the downstream business event when retrying delivery. `record_outcomes` accepts 1–100 items and returns a result for every item; successful items are not rolled back when another item fails.
