Skip to main content

Python client for the Shiva AI Governance API — shivaprotocol.com

Project description

Agent Guard — Shiva SDK (Python)

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

Project details


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.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shiva_sdk-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file shiva_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: shiva_sdk-0.1.1.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

Hashes for shiva_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ccce8e184e850c3bc0f6545617a69363ca2fcfcd70525746496f5c157a19acad
MD5 a792ce6577a91e19f36cd4223dd4baab
BLAKE2b-256 6a90b3a64bf55d1d4150d3ee3c695ccae2ca30d707d5eef45e84d093a3ddea63

See more details on using hashes here.

File details

Details for the file shiva_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: shiva_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for shiva_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c070cddf502a2aafe3e33bae3dbb1c415ce81d2bd248e99c9c378007ed423578
MD5 6abacf61171d497d6041d0ba1199c887
BLAKE2b-256 4b8ce1ba5fdc982fae75764a3c7bcae76305bb1561de6780745b95a318a40fd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page