What You Get Pricing Architecture Learnings Blog Skills Build Log Get Started
← Back to Blog
2026-03-08 Agent Infrastructure Production Safety

The Missing Infrastructure Layer for AI Agents Writing to Production

Agents reading your systems is safe. Agents writing to them is where things break — and most teams are governing that with Slack bots and vibes.

An AI agent that reads your CRM does no damage. It scans, pulls context, misses a detail at worst. The moment that same agent starts writing — sending emails to real leads, updating 847 records, posting to live channels, processing webhooks — everything changes.

One bad retry and a lead gets two AI calls in 30 seconds. One unresolved template variable and hundreds of contacts receive "Hello {{customer_name}}." One enrichment run with partial data and your CRM is corrupted with no rollback path.

These aren't theoretical. They happened. The teams that experienced them didn't lack engineering talent — they lacked infrastructure for the write path.

The 3 Failure Modes That Keep Happening

Each one had a policy that would have stopped it. None of those policies existed at the time.

Incident 1 — Duplicate outreach

An agent retried a lead workflow. The lead received 2 AI phone calls in 30 seconds.

Policy that prevents it: idempotency_key on every intent.

Incident 2 — Broken template blast

An agent sent "Hello {{customer_name}}" to hundreds of contacts. The merge variable never resolved.

Policy that prevents it: require_approval_if_template_error

Incident 3 — CRM mass overwrite

An enrichment agent pushed updates to 847 records with partial data. No approval gate. No rollback path.

Policy that prevents it: require_approval_over: 100

The pattern across all 3: the agent had write access, no policy enforced a check, and something shipped that shouldn't have. The fix was obvious in retrospect. The problem is "in retrospect" means the damage was already done.

Why Scattered Approval Logic Doesn't Scale

Most teams handling this build the same thing: a Discord bot, a Slack hook, some custom middleware, a dedup JSON file. We run exactly that stack. It works — until it doesn't.

Scale from 3 agents to 15 and you scale the chaos proportionally. There's no architecture here — just wires holding things together.

What Zehrava Gate Actually Is

Zehrava Gate is MIT-licensed open source infrastructure — a commit checkpoint between AI agents and production systems. Every agent write goes through a 5-step process before it touches anything real.

  1. 1
    Agent proposes an intent

    The agent calls gate.propose(). Gate verifies the sender against an agent registry. Unknown agents are rejected before any policy runs.

  2. 2
    Gate evaluates policy

    Schema validation, PII detection, record count thresholds. The team defines the rules. Gate enforces them on every proposal, every time.

  3. 3
    Block, auto-approve, or queue for review

    Low-risk writes pass automatically. High-risk writes route to a dashboard. A human decides. The agent waits.

  4. 4
    One-time signed execution

    The agent calls gate.execute() after approval. The execution token is signed and expires. A second request returns HTTP 410. Cannot be replayed or reused.

  5. 5
    Immutable audit trail

    Every event is logged. Not deletable. Not editable. The record exists regardless of what happens downstream.

Run those 5 steps against the 3 incidents above. Duplicate intents blocked at step 3. Template errors flagged at step 2, queued for human review. 847-record writes caught by the count threshold policy, never auto-approved.

The API

Four methods. That's the entire surface.

# Propose an intent
intent = gate.propose(
    agent_id="kai-outreach-v2",
    action="send_email",
    payload={"to": lead_email, "subject": subject, "body": body},
    idempotency_key=lead_id
)

# Human or policy approves
gate.approve(intent["id"])

# Execute the approved action (one-time, signed)
result = gate.execute(intent["id"])

# Close the audit trail
gate.verify(intent["id"])

Intent Statuses

gate.propose() returns one of four statuses:

Handle all four. Missing duplicate_blocked is the most common source of retry loops.

status = intent["status"]

if status == "approved":
    gate.execute(intent["id"])
elif status == "pending_approval":
    queue_for_review(intent["id"])
elif status in ["blocked", "duplicate_blocked"]:
    raise GateError(intent["blockReason"])

Cross-Framework Governance

Gate works across CrewAI, LangGraph, OpenAI Swarm, AutoGen, LangChain, Claude Code, and any MCP client. The Gate sits above the framework layer — the framework running the agent is irrelevant to policy enforcement.

PropertyFramework HITLZehrava Gate
Opt-in vs mandatoryOpt-in. Dev forgets. Ships.Policy-driven. Always enforced.
CoverageSiloed per frameworkOne queue, every agent, every team
Sender identityAnonymousVerified against agent registry
Audit trailConsole logs across scattered reposSingle immutable log, all agents
Cross-team visibilityNoneOne approval queue, all teams

How We Use It

Current governance for the MeetKai stack: Discord reaction approvals, dedup JSON files, a heartbeat check system. It works. It's also exactly the scattered approval logic Gate was built to replace.

Gate replaces the stack with a single layer. One place to define policy. One approval queue across every agent. One audit trail that answers post-mortem questions automatically.

The KaiCalls lead outreach script now proposes to Gate before posting anything to Discord. If Gate blocks — duplicate, template error, policy violation — the Discord message never fires. If Gate approves, the message includes the proposal ID and a link to the dashboard. Approval happens in one place whether the reviewer is in Discord or not.

Install

npm install zehrava-gate
# or
pip install zehrava-gate

MIT licensed. Self-hosted. zehrava.com — live demo and dashboard included.