Nexure SDK — Decision visibility for the AI era
Project description
Nexure Python SDK
Decision visibility for the AI era. Record, analyze, and audit AI-influenced decisions with a single API call.
Installation
pip install nexure
Quick Start
from nexure import Nexure
nx = Nexure(api_key="nx_live_...")
# Record a decision in 3 lines
record = nx.decisions.record(
decision_type="credit_underwriting",
evidence={"fico_score": 711, "dti_ratio": 0.38, "loan_amount": 45000},
action="approve",
decided_by="reviewer_schen",
)
print(record.id) # dec_a1b2c3d4e5f6
What You Can Do
# Generate an AI-synthesized decision brief
brief = nx.briefs.generate(
decision_type="credit_underwriting",
evidence={
"fico_score": 711,
"dti_ratio": 0.38,
"loan_amount": 45000,
"loan_purpose": "home_improvement",
"employment_status": "employed",
},
)
print(f"Quality: {brief.quality_score}/100")
for flag in brief.flags:
print(f" [{flag['severity']}] {flag['name']}")
# View analytics
overview = nx.analytics.overview(days=30)
print(f"Override rate: {overview.override_rate:.1%}")
# Detect reviewer anomalies
overrides = nx.analytics.override_rates()
for r in overrides.reviewers:
if r.is_anomaly:
print(f"Anomaly: {r.reviewer} — {r.override_rate:.0%} override rate")
# Verify the immutable ledger
result = nx.ledger.verify()
print(f"Chain valid: {result.valid} ({result.records_checked} records)")
Async Support
from nexure import AsyncNexure
import asyncio
async def main():
async with AsyncNexure(api_key="nx_live_...") as nx:
decisions = await nx.decisions.list(limit=10)
for d in decisions.decisions:
print(f"{d.id}: {d.action} (trust={d.trust_score})")
overview = await nx.analytics.overview()
print(f"Total: {overview.total_decisions}")
asyncio.run(main())
Resource Namespaces
All resources follow the same pattern:
items = nx.decisions.list(limit=50, offset=0) # List
item = nx.decisions.get("dec_...") # Get single
item = nx.decisions.record(**params) # Create
| Namespace | Methods | Description |
|---|---|---|
nx.decisions |
record(), get(), list(), forensics(), export() |
Record and query decisions |
nx.packages |
create(), get() |
Create evidence packages |
nx.briefs |
generate(), get() |
AI-synthesized decision briefs |
nx.analytics |
overview(), override_rates(), drift(), comparisons(), visibility_score() |
Dashboard analytics |
nx.templates |
list(), get(), register(), update() |
Decision templates |
nx.ledger |
verify() |
Hash chain verification |
nx.anomalies |
list(), get(), acknowledge(), resolve(), dismiss(), detect() |
Anomaly alerts |
nx.outcomes |
record(), batch(), for_decision(), stats(), by_reviewer(), by_override() |
Outcome tracking |
nx.explanations |
generate(), list(), portal_link(), templates CRUD |
Customer explanations |
nx.api_keys |
create(), list(), revoke() |
API key management |
Error Handling
from nexure import NexureError, AuthenticationError, RateLimitError, NotFoundError
try:
record = nx.decisions.get("dec_nonexistent")
except NotFoundError:
print("Decision not found")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except NexureError as e:
print(f"API error ({e.status_code}): {e.message}")
Configuration
| Parameter | Env Var | Default |
|---|---|---|
api_key |
NEXURE_API_KEY |
required |
base_url |
NEXURE_API_BASE_URL |
https://api.nexuredata.com/v1 |
timeout |
— | 30.0 seconds |
# From env vars
nx = Nexure() # reads NEXURE_API_KEY and NEXURE_API_BASE_URL
# Explicit
nx = Nexure(api_key="nx_live_...", base_url="https://api.nexuredata.com/v1", timeout=60.0)
# Context manager
with Nexure(api_key="nx_live_...") as nx:
record = nx.decisions.record(...)
Requirements
- Python 3.9+
- httpx
- pydantic 2
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nexure-0.1.0.tar.gz
(25.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
nexure-0.1.0-py3-none-any.whl
(26.6 kB
view details)
File details
Details for the file nexure-0.1.0.tar.gz.
File metadata
- Download URL: nexure-0.1.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc8f87ade6dcaf27e47b9a1c1a907288203cf9f05a5b8b7773a063774dac4205
|
|
| MD5 |
bd6c6fcc9ea6196869b7515b2f9c27ad
|
|
| BLAKE2b-256 |
97a1629d69b7afb646dec7a9d561da58eaac08f5ace23a202cca59b581418a41
|
File details
Details for the file nexure-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nexure-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea251abc515c0562f21643925cb4fe857bfb2cfe91cbc0cfd77481f43cf00e49
|
|
| MD5 |
525343fc287c5a9217b5163a47a54634
|
|
| BLAKE2b-256 |
0455ad3b32994437f4f5c4e51ca58e79c863650fee39ce2cc3ac1687e808e883
|