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.2.0.tar.gz (3.9 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.2.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zehrava_gate-0.2.0.tar.gz
  • Upload date:
  • Size: 3.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 61907c5dce185480d6f2cfdfe3f8cff615a3820ce6c0ed8ba4d31bee1ddfabac
MD5 da91a1149c1746cc61d14898b906c4c3
BLAKE2b-256 6c520ac38ad48a6b91b1fe0e60416e46a5ec0d7845056636ec871587af4f8c9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zehrava_gate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da929a8fdc0ac3f4e0ddddf15c44d46991e19b6a9fa53cf1e26c065dd5df40d7
MD5 664922df66c780310737e762134e72c8
BLAKE2b-256 4fdc753482eb2b6cd357a9248157992a95ab676c5b4d0d3669d5f33b045659e8

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