Arrah Outcomes for Python
First-party, dependency-free client for attaching measured business outcomes to Arrah AI gateway requests.
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:
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.
Metadata
Release files for arrah 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arrah-0.2.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arrah-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / arrah-0.2.0.tar.gz
| Download URL | arrah-0.2.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6318b141648ce431873ead52aa074b4e789fb6a4ce00f943a295087713a00fbe
|
|
BLAKE2b-256 checksum How to use checksums |
7cb6683a3cf488c1052374190ce8e8c752fb5e0c879d818a5f1f9d31ca2ab9b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / arrah-0.2.0-py3-none-any.whl
| Download URL | arrah-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c42b7e6880bff57108d43c61a1ef3fbd6a6940496e7546bd49f79064a91c791f
|
|
BLAKE2b-256 checksum How to use checksums |
d62f7d947bbd94e5fd17da937bdb4fe4342682a2236cf5f93d92f9775ac096ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|