Skip to main content

Govern your AI agents. Policy evaluation, compliance, and audit trails for autonomous AI systems.

Project description

Zabta SDK

Python SDK for Zabta — govern, monitor, and manage your AI agents.

Installation

pip install zabta

For local development:

cd sdk/
pip install -e .

Quick Start

from zabta import ZabtaClient

client = ZabtaClient(
    api_key="zbt_your_key_here",
    agent_name="My Agent",
)
client.start()

# Check before acting
result = client.evaluate("send_email", "customer_data", {"has_pii": True})
if result.allowed:
    send_email(customer)
elif result.escalated:
    print(f"Needs approval: {result.reason}")
else:
    print(f"Denied: {result.reason}")

client.stop()

Policy Evaluation

# Full evaluation with details
result = client.evaluate("delete", "customer_record", {"is_irreversible": True})
print(result.decision)     # "allow", "deny", or "escalate"
print(result.policy)       # "Kill Switch"
print(result.citation)     # "OWASP ASI08, EU AI Act Art. 14"
print(result.layer)        # "universal"

# Quick boolean check
if client.is_allowed("read", "public_data"):
    read_data()

# Decorator — auto-checks before executing
@client.governed(action="process_refund", resource="payment")
def process_refund(order_id, amount):
    stripe.refunds.create(charge=order_id, amount=amount)

Monitoring Mode

Just log what your agent does (no enforcement):

client.start()
client.log_action("answered_ticket", input_summary="Resolved billing question")
client.log_action("sent_email", input_summary="Welcome email to new customer")
client.stop()

LLM Middleware

Auto-log every OpenAI or Anthropic call:

from zabta.middleware import wrap_openai
import openai

client = ZabtaClient(api_key="zbt_xxx")
oai = wrap_openai(openai.OpenAI(), client)

# This call is automatically logged with token usage, cost, and latency
response = oai.chat.completions.create(model="gpt-4o", messages=[...])

API Reference

ZabtaClient

Parameter Type Default Description
api_key str required API key (zbt_ or aos_ prefix)
base_url str https://api.zabta.ai API URL
agent_name str "Unnamed Agent" Display name
agent_type str "custom" Agent type

Methods:

  • evaluate(action, resource, context) -> EvaluateResult — check policy
  • check(action, resource, context) -> EvaluateResult — alias for evaluate
  • is_allowed(action, resource) -> bool — quick boolean check
  • governed(action, resource, context) — decorator for auto-checking
  • start() / stop() — lifecycle management with heartbeats
  • log_action(action_type, ...) — fire-and-forget logging
  • request_action(action_type, ...) — request with approval flow

EvaluateResult

  • .decision"allow", "deny", or "escalate"
  • .allowed / .denied / .escalated — boolean helpers
  • .reason — human-readable explanation
  • .policy — deciding policy name
  • .citation — regulatory citation
  • .layer — universal / jurisdiction / sectoral

Backward Compatibility

from agentos import AgentClient still works. aos_ API keys still work.

License

MIT

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

zabta-0.3.0.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

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

zabta-0.3.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file zabta-0.3.0.tar.gz.

File metadata

  • Download URL: zabta-0.3.0.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for zabta-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8c387dc02aba83a84071c38b4f1d2579b6c7dc522871a23151c7e86ef9a067a6
MD5 d9db3584426a424d8c78c58e4ac6dd40
BLAKE2b-256 8e5ccc7c1c2fc97ff80acfa4e26f068c5e321723573979abc1b77ccd1ba562e6

See more details on using hashes here.

File details

Details for the file zabta-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zabta-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for zabta-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a05ab55bc873f27d2b73d15b14e1a5548bbd30b573910a2f207a7b84ce8bfc15
MD5 5471fe93117d829a75ab7eb26734b16f
BLAKE2b-256 ddf9b9e06b3cfb978237a0191e674c5220c4a5fc7b62de9c114c4efd68fb7309

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