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, orESCALATE - 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyagentgate-0.1.0.tar.gz.
File metadata
- Download URL: pyagentgate-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4da66c4e0cc10ef9b089d2981dc191a1c74581018e7e5d93c607a062d0f94d2
|
|
| MD5 |
0975fdc0f6430f4890d36b92008c6027
|
|
| BLAKE2b-256 |
56f197d060451cbbdd5e219a814b5ef8a3fef926ad18771a07a24fa339e08ec4
|
File details
Details for the file pyagentgate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyagentgate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d828e3a8bb6c037c48a2d44b006495a6b810717c93b03fbea51ac3e31610e927
|
|
| MD5 |
dbf7dadc4940171a0d4749334eadc817
|
|
| BLAKE2b-256 |
9d76c2e2cabf96d2fd0d0484d9bbf15402b6aeffd1f63fe156524b5b7d573e38
|