Skip to main content

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

Release files for zehrava-gate 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zehrava-gate 0.2.0
File Size Uploaded
zehrava_gate-0.2.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zehrava-gate 0.2.0
File Interpreter ABI Platform
zehrava_gate-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / zehrava_gate-0.2.0.tar.gz

Download URL zehrava_gate-0.2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
61907c5dce185480d6f2cfdfe3f8cff615a3820ce6c0ed8ba4d31bee1ddfabac
BLAKE2b-256 checksum
How to use checksums
6c520ac38ad48a6b91b1fe0e60416e46a5ec0d7845056636ec871587af4f8c9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / zehrava_gate-0.2.0-py3-none-any.whl

Download URL zehrava_gate-0.2.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da929a8fdc0ac3f4e0ddddf15c44d46991e19b6a9fa53cf1e26c065dd5df40d7
BLAKE2b-256 checksum
How to use checksums
4fdc753482eb2b6cd357a9248157992a95ab676c5b4d0d3669d5f33b045659e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page