Reliability primitives for Python applications.
Project description
RelPrim
Reliability primitives for external operations in Python.
RelPrim is a production resilience SDK that helps developers build reliable integrations with AI providers, APIs and external services.
Status
🚧 Early development.
RelPrim is currently in active development and APIs may change before the first stable release.
Installation
pip install relprim
Quickstart
import asyncio
from relprim import (
ExponentialBackoff,
RetryPolicy,
TimeoutPolicy,
async_operation,
)
class TemporaryProviderError(Exception):
pass
async def call_external_provider(prompt: str) -> str:
# Replace this with an OpenAI, Gemini, HTTP, payment or any other external call.
return f"Generated response for: {prompt}"
async def main() -> None:
result = await (
async_operation("generate_response", call_external_provider)
.with_retry(
RetryPolicy(
max_attempts=3,
retry_on=(TemporaryProviderError,),
backoff=ExponentialBackoff(
base_delay_seconds=0.2,
max_delay_seconds=2.0,
jitter=True,
),
)
)
.with_timeout(TimeoutPolicy(seconds=10))
.run("Write a short product summary")
)
print(result.value)
print(result.report.to_dict())
asyncio.run(main())
Current Features
- Retry policies
- Async timeout enforcement
- Structured execution reports
- Operation results
- Typed execution errors
Planned Features
- Circuit breakers
- Fallback chains
- Validation
- Idempotency
- Rate limit handling
- Structured events
- SQLite event store
- OpenTelemetry exporter
What RelPrim is not
RelPrim is not a workflow engine, agent framework, task queue, chatbot framework or AI provider wrapper.
It is a reliability SDK for external operations.
License
Apache License 2.0
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 relprim-0.2.0.tar.gz.
File metadata
- Download URL: relprim-0.2.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fcbc75a9365504c26a4651acaa2378f46e45ec5578e92c9edf3f25f2303679d
|
|
| MD5 |
72b940f3e4f5e3e12d888a0d1020c453
|
|
| BLAKE2b-256 |
b33bf5c1767eb2794cbb1374678a54169eb02eaf0f1c57f7e4cc5c7542d50f9d
|
File details
Details for the file relprim-0.2.0-py3-none-any.whl.
File metadata
- Download URL: relprim-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f7d583f299d87892a711ac0fa37f2dede2df81b47da059b1ef0dee32bc84371
|
|
| MD5 |
52a24bc75aecf3d38a764e659353026b
|
|
| BLAKE2b-256 |
e6f960b417263ef02490cb00d164436533d404baed449ee893870a87d3a62d0d
|