Skip to main content

AgentGate

Open-source policy engine for agentic payments. Not a payment processor. Not a toll booth. The authorization layer between an AI agent and whatever payment API it's calling.

Why

Every "agentic payments" startup is racing to insert themselves as middleware and clip 1-5 cents per transaction. AgentGate is the open alternative: a framework-agnostic policy engine that lets you define what an agent is allowed to spend, where, how much, and how often — without surrendering control to a rent-seeking intermediary.

What It Does

  • Policy Schema — Define spending rules in YAML or Python: per-transaction limits, daily/weekly/monthly caps, merchant category allowlists/blocklists, time-of-day restrictions
  • Evaluation Engine — Takes a proposed transaction + policy → returns ALLOW, DENY, or ESCALATE
  • Human-in-the-Loop Hooks — Pluggable escalation when transactions exceed policy bounds
  • Audit Trail — Structured log of every decision with agent reasoning attached
  • Cooldown & Velocity Controls — Prevent rapid-fire purchasing and runaway loops

What It Doesn't Do

  • Process payments (use Stripe, Square, PayPal, etc.)
  • Store card numbers or tokens (use your payment provider's vault)
  • Replace PCI compliance (that's between you and your provider)

Install

pip install agentgate

Quick Start

from agentgate import Policy, Gate, Transaction

# Define a policy
policy = Policy(
    max_per_transaction=50.00,
    max_daily=200.00,
    max_monthly=2000.00,
    allowed_categories=["groceries", "office_supplies", "saas"],
    blocked_merchants=["casino-online.com"],
    require_escalation_above=100.00,
)

# Create a gate
gate = Gate(policy=policy)

# Evaluate a transaction
tx = Transaction(
    amount=42.99,
    currency="USD",
    merchant="staples.com",
    category="office_supplies",
    agent_id="purchasing-agent-01",
    reasoning="Need printer paper for office",
)

result = gate.evaluate(tx)
# result.decision = Decision.ALLOW
# result.policy_checks = [...]

Policy Schema (YAML)

version: "1"
name: office-purchasing-agent
limits:
  per_transaction: 50.00
  daily: 200.00
  weekly: 750.00
  monthly: 2000.00
  currency: USD
merchants:
  allowed_categories:
    - office_supplies
    - saas
    - groceries
  blocked:
    - casino-online.com
    - gambling.*
velocity:
  max_transactions_per_hour: 10
  max_transactions_per_day: 50
  cooldown_seconds: 30
escalation:
  above_amount: 100.00
  on_new_merchant: true
  on_new_category: true
time_restrictions:
  allowed_hours: [9, 17]  # 9am-5pm only
  allowed_days: [0, 1, 2, 3, 4]  # Mon-Fri

Custom Escalation Handlers

from agentgate import Gate, EscalationHandler

class SlackEscalation(EscalationHandler):
    async def escalate(self, transaction, reasons):
        # Post to Slack, wait for approval
        approved = await self.post_to_slack(transaction, reasons)
        return approved

gate = Gate(policy=policy, escalation_handler=SlackEscalation())

Audit Log

Every evaluation produces an AuditEntry:

result = gate.evaluate(tx)
print(result.audit)
# AuditEntry(
#   timestamp=2026-08-30T...,
#   transaction_id="tx_abc123",
#   agent_id="purchasing-agent-01",
#   decision=Decision.ALLOW,
#   checks_passed=["amount_limit", "category_allowed", "velocity_ok"],
#   checks_failed=[],
#   reasoning="Need printer paper for office",
#   policy_version="1",
# )

Framework Integration

AgentGate is framework-agnostic. Use it with any agent framework:

# LangChain tool wrapper
from agentgate.integrations import langchain_tool

# CrewAI tool wrapper  
from agentgate.integrations import crewai_tool

# Raw function — wrap any payment call
from agentgate import gated

@gated(policy=policy)
async def buy_item(merchant, amount, item):
    return await stripe.checkout(...)

License

MIT — because the whole point is that nobody gets to gatekeep this.

Metadata

Release files for pyagentgate 0.1.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 pyagentgate 0.1.0
File Size Uploaded Provenance Actions
pyagentgate-0.1.0.tar.gz 12.2 kB Without provenance Details for pyagentgate-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyagentgate 0.1.0
File Interpreter ABI Platform Actions
pyagentgate-0.1.0-py3-none-any.whl Python 3 none any Details for pyagentgate-0.1.0-py3-none-any.whl

Total release size: 25.2 kB

Release files / pyagentgate-0.1.0.tar.gz

Download URL pyagentgate-0.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c4da66c4e0cc10ef9b089d2981dc191a1c74581018e7e5d93c607a062d0f94d2
BLAKE2b-256 checksum
How to use checksums
56f197d060451cbbdd5e219a814b5ef8a3fef926ad18771a07a24fa339e08ec4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pyagentgate-0.1.0-py3-none-any.whl

Download URL pyagentgate-0.1.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d828e3a8bb6c037c48a2d44b006495a6b810717c93b03fbea51ac3e31610e927
BLAKE2b-256 checksum
How to use checksums
9d76c2e2cabf96d2fd0d0484d9bbf15402b6aeffd1f63fe156524b5b7d573e38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for pyagentgate 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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