Skip to main content

Zehrava Gate Python SDK — the safe commit layer for AI agents

Project description

zehrava-gate (Python)

The safe commit layer for AI agents.

zehrava.com · Docs · npm package

Install

pip install zehrava-gate

Usage

from zehrava_gate import Gate

gate = Gate(
    endpoint="http://localhost:4000",
    api_key="gate_sk_..."
)

p = gate.propose(
    payload="Thank you — your issue is resolved.",
    destination="zendesk.reply",
    policy="support-reply",
    record_count=1
)

print(p["status"])       # approved | blocked | pending_approval
print(p["block_reason"]) # set if blocked

# Register webhook to be notified on approval
gate.register_webhook(
    proposal_id=p["proposalId"],
    url="https://your-app.com/gate-webhook",
    secret="your-secret"
)

LangGraph example

from langgraph.graph import StateGraph
from zehrava_gate import Gate, GateError

gate = Gate(endpoint="http://localhost:4000", api_key="gate_sk_...")

def send_reply(state):
    p = gate.propose(
        payload=state["reply"],
        destination="zendesk.reply",
        policy="support-reply",
        record_count=1
    )
    if p["status"] == "blocked":
        raise GateError(f"Blocked: {p['blockReason']}")
    if p["status"] == "pending_approval":
        return {**state, "status": "awaiting_approval", "proposal_id": p["proposalId"]}
    # approved — deliver
    return {**state, "status": "sent"}

Methods

Method Description
propose(destination, policy, payload, record_count, ...) Submit action for policy evaluation
approve(proposal_id) Approve a pending proposal
reject(proposal_id, reason) Reject a pending proposal
deliver(proposal_id) Get one-time delivery URL
verify(proposal_id) Full proposal + audit trail
register_webhook(proposal_id, url, secret) Webhook on approve/reject

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

zehrava_gate-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

zehrava_gate-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file zehrava_gate-0.1.0.tar.gz.

File metadata

  • Download URL: zehrava_gate-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zehrava_gate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 08aa923b8b65e0c33351d2f86bbcb169c6d46d2b4e0f8b2644c093ab389b1842
MD5 59cdcbce6a94987cb6b08eabf85e52f0
BLAKE2b-256 0e9fd0590b29980031e57fa830cfe225eb8c15d3179d1102001a1be0ec940626

See more details on using hashes here.

File details

Details for the file zehrava_gate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zehrava_gate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zehrava_gate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f48f2299a760230405990ef452cc89c67326bc4e545a0552274428178bc2995
MD5 5130a670a869684e0ec73af474858948
BLAKE2b-256 bf8c926f1afa6c98fd9b1d071128b073fc2bb3afa042d0f82faaaf9cd125c6e2

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