Metadata-Version: 2.4
Name: sovr-sdk
Version: 7.0.1
Summary: The Execution Firewall for AI Agents - Official Python SDK for SOVR
Home-page: https://github.com/sovr-ai/sovr-sdk-python
Author: SOVR Team
Author-email: SOVR Team <sdk@sovr.ai>
License: MIT
Project-URL: Homepage, https://sovr.ai
Project-URL: Documentation, https://docs.sovr.ai/sdk/python
Project-URL: Repository, https://github.com/sovr-ai/sovr-sdk-python
Project-URL: Bug Tracker, https://github.com/sovr-ai/sovr-sdk-python/issues
Keywords: sovr,ai,responsibility,layer,sdk,audit,trust,bundle
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
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: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Security
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# SOVR SDK for Python

The Execution Firewall for AI Agents — Official Python SDK for SOVR.

SOVR is the Responsibility Layer that sits between AI intent and real-world execution, providing policy enforcement, decision auditing, and trust verification for autonomous AI systems.

## Installation

```bash
pip install sovr-sdk
```

## Quick Start

```python
from sovr_sdk import SOVRClient

# Initialize client
client = SOVRClient(
    api_key="your-api-key",
    tenant_id="your-tenant-id",
    endpoint="https://sovr.inc"
)

# Evaluate a decision
result = client.evaluate_decision(
    action="payment",
    resource="order/12345",
    context={"amount": 1000, "currency": "USD"}
)

print(f"Verdict: {result.verdict}")
print(f"Risk Score: {result.risk_score}")
print(f"Value Score: {result.value_score}")

# Act on the decision
if result.verdict == "approved":
    print("✓ Action approved, safe to execute")
elif result.verdict == "pending_approval":
    print("⏳ Human approval required")
else:
    print("✗ Action blocked")
```

## Core Features

### Decision Evaluation

```python
result = client.evaluate_decision(
    action="payment",
    resource="order/12345",
    context={"amount": 1000},
    metadata={"trace_id": "abc123"}
)
```

### Trust Bundle Management

```python
# Create a trust bundle
bundle = client.create_trust_bundle(
    name="Payment Decision Bundle",
    description="Evidence package for order #12345 payment decision"
)

# Add evidence
client.add_evidence(
    bundle_id=bundle.id,
    evidence_type="document",
    content={"title": "Contract", "url": "https://..."},
    weight=0.3
)

# Evaluate sufficiency
evaluation = client.evaluate_sufficiency(bundle.id)
print(f"Sufficiency Score: {evaluation.score}")
```

### Audit Log Query

```python
# Query audit logs
logs = client.get_audit_logs(
    start_date="2026-01-01",
    end_date="2026-01-25",
    limit=100
)

for log in logs:
    print(f"{log.created_at}: {log.event_type} - {log.action}")
```

## Environment Variables

The SDK supports configuration via environment variables:

```bash
export SOVR_API_KEY="your-api-key"
export SOVR_TENANT_ID="your-tenant-id"
export SOVR_API_ENDPOINT="https://api.sovr.example.com"
```

```python
# Automatically reads from environment variables
client = SOVRClient()
```

## Error Handling

```python
from sovr_sdk.exceptions import SOVRError, AuthenticationError, RateLimitError

try:
    result = client.evaluate_decision(...)
except AuthenticationError:
    print("Authentication failed. Please check your API key.")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after} seconds.")
except SOVRError as e:
    print(f"SOVR Error: {e.message}")
```

## Documentation

- [API Reference](https://docs.sovr.ai/sdk/python/api)
- [Integration Guide](https://docs.sovr.ai/sdk/python/guide)
- [Examples](https://github.com/sovr-ai/sovr-sdk-python/tree/main/examples)

## License

MIT License
