Metadata-Version: 2.4
Name: niyam-sdk
Version: 0.1.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Intended Audience :: Developers
Summary: The unified Niyam SDK: embed the centrally-governed AI action gate in your own agent code
Author: Chirotpal Das
License: LicenseRef-Elastic-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/SarthiAI/Niyam

# niyam (Python SDK)

The unified Niyam SDK for Python. Embed the centrally-governed AI action gate in
your own agent code: enroll once, then wrap `dispatch` around your tool-dispatch
layer. Enforcement is deterministic and in-process (no per-call network hop);
policy is pulled from the control plane and can never be overridden locally.

```python
import niyam

# Enroll to the control plane (like a data-plane node): pulls the compiled policy,
# the capability-token issuer, and the revocation set, and builds an in-process gate
# over its own post-quantum audit chain.
gate = niyam.GovernedGate(
    "http://127.0.0.1:9090",   # control plane
    "enrollment-token",         # bootstrap token
    "billing-agent",            # this instance's name in the registry
)

# Wrap your tool dispatch once. `capability_token` was minted centrally for the agent.
decision = gate.dispatch(capability_token, "tools.email.send", "mailbox/support")
if decision.allowed:
    send_email()                # every decision is signed into the audit chain
else:
    raise PermissionError(decision.reason)

# Route model calls through a governed gateway so model traffic + safety + budgets
# are enforced centrally (never re-implemented per app).
gw = niyam.Gateway("http://gateway.internal:8080", client_key)
# openai.base_url = gw.openai_base_url()
```

## Build

```
maturin build --release        # one abi3 wheel per platform (CPython >= 3.9)
# or during development:
maturin develop
```

Everything is post-quantum from day one (ML-DSA-65 hybrid with Ed25519), matching
the rest of Niyam. The SDK never authors policy; it only pulls and enforces.

