Metadata-Version: 2.4
Name: cortexhub
Version: 0.5.15
Summary: CortexHub Python SDK — Runtime governance for AI systems. One decorator, any tool, any framework.
Project-URL: Homepage, https://cortexhub.ai
Project-URL: Documentation, https://docs.cortexhub.ai
Project-URL: Examples, https://github.com/CortexHub-AI/examples/
Author-email: CortexHub <hello@cortexhub.ai>
License: MIT
License-File: LICENSE
Keywords: agents,ai,authorization,governance,policy
Classifier: Development Status :: 4 - Beta
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: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.13,>=3.10
Requires-Dist: cedarpy>=4.0.0
Requires-Dist: cryptography>=43.0.0
Requires-Dist: detect-secrets>=1.5.0
Requires-Dist: httpx>=0.28.0
Requires-Dist: opentelemetry-api>=1.20.0
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20.0
Requires-Dist: opentelemetry-sdk>=1.20.0
Requires-Dist: presidio-analyzer>=2.2.360
Requires-Dist: presidio-anonymizer>=2.2.360
Requires-Dist: pydantic>=2.9.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: spacy-lookups-data>=1.0.0
Requires-Dist: spacy>=3.8.0
Requires-Dist: structlog>=24.4.0
Description-Content-Type: text/markdown

# CortexHub Python SDK

Runtime governance for AI systems. One decorator. Any tool. Any framework.

```bash
pip install cortexhub
```

Python 3.10–3.12.

## Quick start

Identity comes from your **agent key** only — the control plane assigns the canonical agent id. Set `CORTEXHUB_AGENT_KEY` (or pass `agent_key=` to `init()`).

```python
import cortexhub

cx = cortexhub.init()  # requires CORTEXHUB_AGENT_KEY (or pass agent_key=)

@cx.tool
def process_payment(customer_id: str, amount: str, reference: str) -> dict:
    """Process a payment."""
    return payment_service.charge(customer_id, amount, reference)

# Policies, approvals, and audit trail are configured in the control plane.
```

## Configuration

| Env var | Description |
|--------|-------------|
| `CORTEXHUB_AGENT_KEY` | Agent identity secret (required for cloud enforcement) |
| `CORTEXHUB_DEBUG` | Set to `1` or `true` for readable SDK logs: tool + arguments, policy name + condition, and decision |
| `CORTEXHUB_LOG_LEVEL` | e.g. `DEBUG`, `INFO` (default `INFO`) |

### Debug logging

With `CORTEXHUB_DEBUG=1` (or `CORTEXHUB_DEBUG_POLICY=1`), the SDK logs in real time:

- **Tool encountered** — tool name and argument names/values (values redacted when privacy mode is on)
- **Policy evaluated** — policy name, condition/reasoning, and decision (allow / deny / escalate)
- **Decision** — final effect, policy, and reason for the current tool call

Useful for seeing exactly what CortexHub is evaluating and why a tool was allowed, blocked, or sent for approval.

---

[Documentation](https://docs.cortexhub.ai) · [Control plane](https://app.cortexhub.ai)
