Skip to main content

relivio

Primitive Python client for Relivio deploy registration, ingest, and exception capture.

PyPI · GitHub

Status

  • current package scope: 0.2.0
  • supported Python versions: 3.9+
  • current public surface:
    • deployments.register()
    • deployments.register_from_environment()
    • ingest.send()
    • ingest.asend()
    • ingest.send_batch()
    • capture_exception()
    • acapture_exception()
    • protection.get_status()
    • verdicts.latest()
    • status()
  • automatic retry only for 429 RATE_LIMITED

Non-goals

  • full verdict consumer surface
  • feedback/history/list/search APIs
  • guard or middleware implementation
  • broad auto instrumentation or metric collection
  • framework adapters
  • request object parsing

Installation

pip install relivio

Verify the installed package:

python -c "import relivio; print(relivio.__all__)"

For local development:

pip install -e ".[dev]"

Quick Start

from relivio import Relivio, IngestLogInput

relivio = Relivio(api_key="rk_...")

deployment = relivio.deployments.register()
print(deployment.deployment_id)

result = relivio.ingest.send(
    IngestLogInput(
        level="ERROR",
        message="checkout failed",
        api_path="/api/orders/finalize",
    )
)
print(result.log_event_id)

verdict = relivio.verdicts.latest()
if verdict is not None:
    print(verdict.verdict, verdict.decision_tier)

Capture exceptions explicitly from the boundary that already knows the safe path/context:

try:
    run_usecase()
except Exception as exc:
    relivio.capture_exception(
        exc,
        service="checkout-api",
        api_path="/api/orders/{id}",
        trace_id="req_123",
    )
    raise

If service and trace_id are repetitive across calls, set them once at client init. They apply only to capture_exception / acapture_exception — explicit ingest.send() payloads are passed through unchanged.

import contextvars
from typing import Optional

request_id_var: contextvars.ContextVar[Optional[str]] = contextvars.ContextVar(
    "request_id", default=None
)

relivio = Relivio(
    api_key="rk_...",
    default_service="checkout-api",
    trace_id_provider=request_id_var.get,  # called per capture; exceptions are swallowed
)

# Per-call only api_path needs to be passed.
relivio.capture_exception(exc, api_path=request.path)

Read protection status explicitly from guard code:

from relivio import ProtectionStatusInput

status = relivio.protection.get_status(
    ProtectionStatusInput(
        service="checkout-api",
        api_path="/api/orders/{id}",
        method="POST",
    )
)

print(status.decision_tier, status.matched_api_path)

Async Example

import asyncio
from relivio import Relivio, RegisterDeploymentInput

relivio = Relivio(api_key="rk_...")

async def main() -> None:
    deployment = await relivio.deployments.aregister(
        RegisterDeploymentInput(version="1.2.3")
    )
    print(deployment.deployment_id)

    try:
        await run_usecase()
    except Exception as exc:
        await relivio.acapture_exception(
            exc,
            service="checkout-api",
            api_path="/api/orders/{id}",
        )
        raise

asyncio.run(main())

Development

python -m venv .venv
./.venv/bin/pip install -e ".[dev]"
./.venv/bin/pytest
./.venv/bin/python -m build

Behavior Notes

  • API key is sent through X-API-Key
  • Idempotency-Key is supported for v0 writer endpoints
  • 429 responses are retried with Retry-After
  • 5xx responses are not retried
  • server can accept gzip payloads, but SDK v0 sends plain JSON only
  • SDK code never receives framework request objects
  • capture_exception() is an ingest helper, not a framework adapter
  • capture_exception() swallows Relivio delivery failures and records them in local status()
  • protection.get_status() is a thin read over /api/v1/protection/status; it does not make block/allow decisions
  • verdicts.latest() is intentionally narrow and only exists to support service-side guard logic
  • verdicts.latest() returns None on 404 when a verdict is not available yet
  • status() reports SDK self-diagnostics locally; it does not send host metrics to Relivio

Related Repos

  • relivio-server: server-side deploy registration, ingest, and summary generation
  • relivio-mcp: agent-facing verdict consumer surface

Security

Do not commit project API keys. Keep X-API-Key values in environment variables or local secret storage outside source control.

Contributing

Small, behavior-preserving changes are preferred. Keep transport, resource, type, and error responsibilities separate, and run the smallest effective test/build checks before sending a change.

Metadata

Release files for relivio 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for relivio 0.2.1
File Size Uploaded Provenance
relivio-0.2.1.tar.gz 14.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for relivio 0.2.1
File Interpreter ABI Platform
relivio-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.7 kB

Release files / relivio-0.2.1.tar.gz

Download URL relivio-0.2.1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7b7b31009b8c90f640458e9b4551669b744a4211dc833772cd656c85ad361c63
BLAKE2b-256 checksum
How to use checksums
c069971bb370d0711cc0d361a5e182da55534b28219652c96593068f25a53a93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / relivio-0.2.1-py3-none-any.whl

Download URL relivio-0.2.1-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ec1f30afb6fc2a3fc214d609011b5d5b01c4d6b2e350a595f42df73317eb9fb
BLAKE2b-256 checksum
How to use checksums
383e6dd757d4f0eec78537c9e0e897e459391dc5f33ba242717ed1f8554d8a70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for relivio 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page