AI-driven reliability SDK for Python applications
Project description
XecureCode Reliability SDK - Python
AI-driven reliability SDK for Python applications.
The official Python SDK for the XecureCode Reliability Platform — a human-first failure analysis and recovery recommendation system.
Why This SDK Exists
Modern backend systems fail in unpredictable ways.
This SDK:
- Captures structured runtime errors
- Generates deterministic fingerprints
- Classifies error types (DATABASE, NETWORK, VALIDATION, etc.)
- Determines severity
- Sends non-blocking telemetry to your backend
- Never crashes your application
AI assists. Humans decide. Nothing executes automatically.
Requirements
- Python 3.8+
- FastAPI, Flask, or Django (optional)
Installation
pip install xecurecode-reliability-sdk
Or install with framework support:
pip install xecurecode-reliability-sdk[fastapi,flask,django]
Quick Start
1️⃣ Initialize the SDK
from reliability import ReliabilityClient, ReliabilityConfig
config = ReliabilityConfig(
api_key="your-api-key",
service_id="your-service",
mode="development"
)
client = ReliabilityClient(config)
Configuration Options:
| Parameter | Required | Description |
|---|---|---|
api_key |
Yes | Your API key |
service_id |
Yes | Service identifier |
mode |
Yes | development or production |
timeout |
No | Request timeout (default: 5000ms) |
2️⃣ Automatic Global Error Capture
The SDK automatically handles:
- Uncaught exceptions
- Thread exceptions
# This will be automatically captured
raise ValueError("Database timeout")
3️⃣ FastAPI Integration
from fastapi import FastAPI
from reliability import ReliabilityClient, ReliabilityConfig
from reliability.fastapi_integration import FastAPIMiddleware
config = ReliabilityConfig(...)
client = ReliabilityClient(config)
app = FastAPI()
app.add_middleware(FastAPIMiddleware, client=client)
4️⃣ Flask Integration
from flask import Flask
from reliability import ReliabilityClient, ReliabilityConfig
from reliability.flask_integration import init_flask
config = ReliabilityConfig(...)
client = ReliabilityClient(config)
app = Flask(__name__)
init_flask(app, client)
5️⃣ Django Integration
In settings.py:
RELIABILITY_API_KEY = "your-api-key"
RELIABILITY_SERVICE_ID = "your-service"
RELIABILITY_MODE = "development"
In settings.py MIDDLEWARE:
MIDDLEWARE = [
...
'reliability.django_integration.ReliabilityMiddleware',
...
]
6️⃣ Manual Capture
try:
risky_operation()
except Exception as e:
client.capture(e)
# With request context
client.capture(e, request)
What Gets Sent
Example structured payload:
{
"message": "Database connection failed",
"name": "ValueError",
"fingerprint": "a8c39c21...",
"timestamp": 1700000000000,
"service": "my-service",
"environment": "development",
"severity": "critical",
"errorType": "DATABASE",
"serviceContext": {
"pid": 12345,
"runtime": "python",
"runtimeVersion": "3.11.0",
"pythonVersion": "3.11.0",
"platform": "Linux-5.10.0",
"hostname": "server-01"
},
"requestContext": {
"method": "GET",
"url": "/api/users",
"ip": "10.0.0.5"
},
"occurrenceCount": 1
}
Error Classification
| Type | Example |
|---|---|
| DATABASE | Timeout, SQL errors, connection issues |
| NETWORK | HTTP failures, socket errors |
| VALIDATION | Invalid input, type errors |
| AUTH | Permission denied |
| RUNTIME | Standard Python errors |
Severity Detection
- Critical → Database, timeout, connection errors
- Medium → Validation, recoverable issues
Design Guarantees
- Non-blocking HTTP calls
- Timeout protected (5s default)
- Retry logic (3 attempts)
- Deduplication (1-minute window)
- Rate limiting (max 100 concurrent)
- Never throws inside SDK
- Never crashes host application
- Works with FastAPI, Flask, Django
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
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
File details
Details for the file xecurecode_reliability_sdk-0.1.1.tar.gz.
File metadata
- Download URL: xecurecode_reliability_sdk-0.1.1.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1a0e8e26f6af954875e921b8dceda155abfc8573076abeb89ad383407eb8dca
|
|
| MD5 |
a2e008065f68f7852f863cb53165cc6a
|
|
| BLAKE2b-256 |
56e0586a86ffb99a24c15c72df6000ff076e75224b1bb1d1f31f64042bab1159
|
File details
Details for the file xecurecode_reliability_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xecurecode_reliability_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51c50a7a6f5377b1cc8f546c1e92a2968f05e34c7f0a0dd4d488d154a2cbfa5e
|
|
| MD5 |
3f36a358ef27eda5978531f8bdaf377a
|
|
| BLAKE2b-256 |
c1adeff76209cfe90414d7f7c21d41a0c1fea90fb2fca4fa730f6e9e765489ff
|