Metadata-Version: 2.4
Name: vasp-sdk
Version: 0.1.0
Summary: Vascular AI Safety Protocol SDK for policy enforcement, RBAC, auditability, and AI safety governance.
Author: VASP AI Safety
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/SalCodes/VASP-AI-Safety
Project-URL: Repository, https://github.com/SalCodes/VASP-AI-Safety
Project-URL: Documentation, https://github.com/SalCodes/VASP-AI-Safety#readme
Keywords: ai-safety,governance,rbac,policy,llm,security
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == "openai"
Provides-Extra: server
Requires-Dist: fastapi>=0.100.0; extra == "server"
Requires-Dist: uvicorn>=0.22.0; extra == "server"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Provides-Extra: all
Requires-Dist: openai>=1.0.0; extra == "all"
Requires-Dist: fastapi>=0.100.0; extra == "all"
Requires-Dist: uvicorn>=0.22.0; extra == "all"
Dynamic: license-file

# VASP-AI-Safety

**VASP SDK** is a pip-installable Python SDK for the **Vascular AI Safety Protocol**, a biomimetic AI governance layer that wraps LLM calls with input security, RBAC, policy enforcement, output filtering, telemetry, and license-tier controls.

The SDK exposes a developer-friendly freemium tier for local prototyping and paid Pro/Enterprise tiers for production governance capabilities such as middleware deployment, compliance reporting, audit export, and multi-tenant policy packs. The free/community SDK is licensed under **Apache License 2.0** and is provided on an **AS IS / USE AT YOUR OWN RISK** basis; Pro and Enterprise usage is governed by the separate EULA in `docs/PRO_ENTERPRISE_EULA.md`.

## Install

From the repository root:

```bash
pip install -e .
```

After packaging to PyPI, the intended install command is:

```bash
pip install vasp-sdk
```

Optional integrations can be installed with extras:

```bash
pip install "vasp-sdk[openai]"
pip install "vasp-sdk[server]"
```

## Quick Start

```python
import asyncio
from vasp import VASPClient, UserIdentity, UserRole

async def main():
    client = VASPClient.default("mock", "mock-safe")
    response = await client.complete(
        "Show me the customer database records",
        identity=UserIdentity(user_id="analyst@corp.com", role=UserRole.ANALYST, authenticated=True),
    )
    print(response.policy_decision.action.value)
    print(response.content)

asyncio.run(main())
```

## Freemium and Enterprise Tiers

| Capability | Community / Freemium | Developer Pro | Enterprise |
|---|---:|---:|---:|
| Core VASP pipeline | Included | Included | Included |
| Basic RBAC and PII redaction | Included | Included | Included |
| Local audit log | Included | Included | Included |
| Mock provider for no-key testing | Included | Included | Included |
| OpenAI provider support | Paywalled | Included | Included |
| Custom policy rules | Paywalled | Included | Included |
| Audit export | Paywalled | Included | Included |
| Middleware server | Paywalled | Paywalled | Included |
| Compliance reports | Paywalled | Paywalled | Included |
| Multi-tenant policy packs | Paywalled | Paywalled | Included |
| Daily governed requests | 100 | 10,000 | Unlimited |

Set `VASP_LICENSE_KEY=vasp_enterprise_demo` to test enterprise gating locally. For production, this repository now includes a functional SAL AI hosted licensing backend under `license_server/`, deployment resources under `deploy/license-server/`, and operator documentation in `docs/LICENSING_BACKEND_DEPLOYMENT.md`.

## Examples

```bash
python examples/basic_completion.py
python examples/rbac_demo.py
python examples/standalone_test.py
python examples/license_demo.py
```

## CLI

```bash
vasp plans
vasp license status
vasp license activate --key <license-key> --server-url https://licenses.sal-ai.com
vasp license verify --key <license-key> --server-url https://licenses.sal-ai.com
vasp complete "What is the capital of France?" --role analyst
```

## Architecture

VASP uses a cardiovascular metaphor to make governance responsibilities intuitive:

| VASP Component | Biological Analogy | Function |
|---|---|---|
| Mitral Valve | Inflow valve | Canonicalizes prompts, redacts PII, flags injection and manipulation. |
| Policy Engine | Governance myocardium | Applies RBAC, sensitivity levels, domain controls, and policy decisions. |
| SA/AV/Purkinje Conduction | Heart rhythm | Tracks request flow, latency, and operational telemetry. |
| Tool Firewall | Coronary control | Authorizes function/tool calls by role and risk level. |
| Aortic Valve | Outflow valve | Filters model output for secrets, sensitive data, and compliance risk. |
| Audit Logger | Circulatory memory | Records hash-chained JSONL lifecycle events. |
| License Manager | Commercial valve | Separates freemium developer use from paid enterprise capabilities. |

## Tests

```bash
python -m unittest discover -s tests -v
```

## Publishing Notes

1. Update `pyproject.toml` version.
2. Run tests.
3. Build distributions with `python -m build`.
4. Upload with `python -m twine upload dist/*` after configuring PyPI credentials.

## License Model

| Distribution or usage path | Governing terms | Practical meaning |
|---|---|---|
| Community / Freemium SDK source and package | `LICENSE` — Apache License 2.0 | Developers may use, modify, and distribute the free SDK under Apache 2.0 terms, including its patent grant and warranty disclaimer. |
| Community / Freemium runtime use | Apache 2.0 plus project notice | The free SDK is provided **AS IS** and **USE AT YOUR OWN RISK**. You remain responsible for validating safety, security, privacy, and compliance behavior before deployment. |
| Developer Pro and Enterprise features | `docs/PRO_ENTERPRISE_EULA.md` plus order form or accepted commercial terms | Paid features, support, hosted licensing, SLAs, warranties, indemnities, and enterprise commitments are governed separately from the open/free SDK license. |

## Security Note

This repository includes both a local SDK-level paywall for packaging demos and a functional hosted validation backend for SAL AI commercial licensing. Production operators should deploy the backend over HTTPS, protect the admin token, avoid logging plaintext license keys, configure backups, and review Pro/Enterprise terms with counsel. VASP does not guarantee that the SDK will prevent all prompt injection, data leakage, policy bypass, privacy incident, model error, regulatory violation, security event, or harmful output.
