Metadata-Version: 2.5
Name: reqlo-sdk
Version: 0.1.0
Summary: Server-side Python client for ReQlo: authorization for AI agents.
Project-URL: Homepage, https://reqlo.io
Project-URL: Documentation, https://reqlo-web.vercel.app/docs/sdks/python
Author: ReQlo
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# ReQlo Python SDK

Server-side client for [ReQlo](https://reqlo.io), authorization for AI agents (`pip install reqlo-sdk`, `import reqlo`). Python 3.10+, standard library only,
sync and asyncio. Keep your project API key on your server.

```bash
pip install reqlo-sdk
```

```python
import os
from reqlo import Reqlo, ReqloDeniedError

reqlo = Reqlo(api_key=os.environ["REQLO_API_KEY"])

try:
    reqlo.enforce(
        agent={"id": "agt_7Hq2mK9xR4vTq8Lp"},
        subject={"id": session.user_id, "kind": "user"},   # from your verified session
        action="documents.read",
        resource={"type": "document", "id": doc.id, "attributes": {"owner_id": doc.owner_id}},
        context={"document_classification": doc.classification},
    )
except ReqloDeniedError as denied:
    return {"error": "Not allowed", "reason": denied.decision["reason_code"]}
# Any other ReqloError (timeout, network, HTTP error) propagates: the action does not run.
```

- `authorize(...)` returns the decision dict; act only when `decision["decision"] == "allow"`.
- `enforce(...)` returns only on allow and raises `ReqloDeniedError` on deny or `approval_required`.
- `AsyncReqlo` has the same methods for asyncio.
- `approvals.list(status=)`, `approvals.retrieve(id)`.
- `delegations.create(agent_id, subject, actions, expires_at)`, `list`, `retrieve`, `revoke`. Create is never retried.
- `reqlo.webhooks.verify(body, signature_header, secret)` and `construct_event(...)` check webhook signatures.

Retries `429` and `5xx` twice with backoff (3-second timeout). Timeouts and network errors are never retried and
never mean allow. Documentation: <https://reqlo-web.vercel.app/docs/sdks/python>
