Metadata-Version: 2.4
Name: relivio-sdk
Version: 0.1.0
Summary: Python SDK for Relivio deploy registration, log ingestion, and minimal latest verdict reads.
License: MIT
License-File: LICENSE
Keywords: deploy,ingest,python,relivio,sdk,verdict
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx<1,>=0.27
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: respx>=0.22; extra == 'dev'
Description-Content-Type: text/markdown

# relivio-sdk-python

Thin Python SDK for Relivio deploy registration, log ingestion, and one minimal latest verdict read for service-side guard flows.

## Status

- current package scope: `0.1.0`
- supported Python versions: `3.9+`
- current public surface:
  - `deployments.register()`
  - `ingest.send()`
  - `ingest.send_batch()`
  - `verdicts.latest()`
- automatic retry only for `429 RATE_LIMITED`

## Non-goals

- full verdict consumer surface
- feedback/history/list/search APIs
- framework integration
- guard or middleware
- auto instrumentation

## Installation

```bash
pip install relivio-sdk
```

For local development:

```bash
pip install -e ".[dev]"
```

## Quick Start

```python
from relivio import Relivio, IngestLogInput

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

deployment = relivio.deployments.register(version="1.2.3")
print(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)
```

## Async Example

```python
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.id)

asyncio.run(main())
```

## Development

```bash
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
- `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

## 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.
