Metadata-Version: 2.4
Name: qerexa
Version: 0.1.1
Summary: Qerexa clients for verifiable credentials and fail-closed gate checks (preview).
Project-URL: Homepage, https://qerexa.com
Project-URL: Documentation, https://qerexa.com/docs
Project-URL: Repository, https://github.com/rodriguew/Trust-Rails/tree/main/packages/sdk-python
Project-URL: Issues, https://github.com/rodriguew/Trust-Rails/issues
Author: Qerexa
License-Expression: MIT
License-File: LICENSE
Keywords: ai-agents,autogen,governance,trust,verifiable-credentials
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: requests<3,>=2.28
Provides-Extra: dev
Requires-Dist: build<2,>=1; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff>=0.1; extra == 'dev'
Requires-Dist: twine<7,>=5; extra == 'dev'
Description-Content-Type: text/markdown

# qerexa (Python, preview)

Python clients for Qerexa:

- `QerexaGateMiddleware` puts a Qerexa check in front of any Python function:
  AutoGen functions, CrewAI or LangChain tools, or your own code.
- `QerexaVCClient` issues and verifies credentials, federation tokens and
  trust relationships between organizations.

## Install

```bash
pip install qerexa
```

## Gate a function

```python
import os
from qerexa import (
    ExecutionAuthorizationRequiredError,
    GateBlockedError,
    QerexaGateMiddleware,
)

gate = QerexaGateMiddleware(api_key=os.environ["QEREXA_API_KEY"])

@gate.gate_check(action="report.export", reasoning="Monthly compliance export")
def export_report(report_id: str) -> str:
    ...

try:
    export_report("rpt_123")
except ExecutionAuthorizationRequiredError as e:
    # Human review was requested (flow e.flow_id). Approval of that review does
    # not authorize this call; stop here or use an action-bound execution flow.
    ...
except GateBlockedError as e:
    ...
```

Your function runs only when Qerexa gives a clear, current yes: an `allowed`
decision with its own ID and an expiry still in the future. Anything else
raises before your code starts, whether that's a block, a pending review, an
expired or garbled answer, a redirect, or a network failure. Every one of those
errors derives from `QerexaError`.

Your function's arguments never leave your process. Qerexa sees the action,
the actor, the `reasoning` you pass (the function name by default) and any
`metadata`, so keep credentials and customer data out of those.

With CrewAI, decorate the function behind the tool before handing it over.
The check then runs on every call, whatever CrewAI's callbacks do.

## Verifiable credentials

```python
from qerexa import VCClientConfig, create_vc_client

vc = create_vc_client(VCClientConfig(org_id="org_123", api_key=os.environ["QEREXA_API_KEY"]))
relationships = vc.list_trust_relationships(limit=10)
```

Requests time out after 10 seconds by default (`VCClientConfig(timeout=...)`).

## Preview limits

This is a preview, not a certified execution control. It doesn't verify
receipts, wait on review flows, or tie an approval to one specific execution,
so keep payments, deployments and other high-impact actions behind the
documented API proof flow and an execution contract you've reviewed
independently.

## Development

```bash
python -m pip install -e "./packages/sdk-python[dev]"
ruff check packages/sdk-python
pytest packages/sdk-python
```

Releases follow [the SDK release runbook](../../apps/sdk/SDK_RELEASE.md).
