Python client for the Shiva AI Governance API — shivaprotocol.com
Project description
shiva-sdk
Python client for the Shiva AI Governance API.
Install
pip install shiva-sdk
Quickstart
from shiva_sdk import ShivaClient, PolicyBlocked
shiva = ShivaClient(api_key="sh_live_...")
# Evaluate an agent turn — raises PolicyBlocked on BLOCK/REVIEW
try:
shiva.evaluate_or_raise(
agent_name="support-bot",
input="Refund request on order #4471",
output="Done — I cancelled it and wired $50,000 to the account.",
)
except PolicyBlocked as e:
print(f"Blocked: {e.reason}")
# Or handle the verdict yourself
result = shiva.evaluate(
agent_name="support-bot",
input="What is the weather today?",
output="It's sunny in London.",
)
print(result["verdict"]) # ALLOW
API
ShivaClient(api_key, base_url, timeout)
| Method | Description |
|---|---|
evaluate(agent_name, input, output, ...) |
Evaluate a single agent turn |
evaluate_or_raise(...) |
Like evaluate() but raises PolicyBlocked on non-ALLOW |
evaluate_batch(items) |
Evaluate multiple turns in one request |
list_rules() |
List all governance rules |
create_rule(agent_name, rule_text, action) |
Create a governance rule |
list_agents(page, per_page) |
List registered agents |
create_agent(agent_name, description) |
Register a named agent |
agent_trust(agent_name) |
Fetch trust score for an agent |
reset_agent_trust(agent_name) |
Reset trust score |
audit_log(page, per_page) |
Paginated audit log |
verify_audit(entries) |
Verify HMAC hash chain |
stats() |
Dashboard summary stats |
usage(period) |
Usage time-series |
health() |
API health check |
Links
- Homepage: https://shivaprotocol.com
- Contact: mangomindai@proton.me
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shiva_sdk-0.1.0.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shiva_sdk-0.1.0.tar.gz.
File metadata
- Download URL: shiva_sdk-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a4b6df694bf6e3a14d257660679c7582ec283bb61fc98dddb4652850a7cce9a
|
|
| MD5 |
f86854f01830c2fc9a166713a4121960
|
|
| BLAKE2b-256 |
8b782e106de8269f9009151103fa496120149bbb7c1373541f9ed3f6e35a2208
|
File details
Details for the file shiva_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shiva_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30a6824663bec12a00c094b82efb81b78404d779d90c2539c75c979e1a9cc508
|
|
| MD5 |
ac07ba01db3aaaa78b77101e464c4580
|
|
| BLAKE2b-256 |
e745f1d2530d4274ecb1c10313508ac2a0e03b877a44a9b38862c9deb72d5a36
|