v0.3 — Four Gates + Framework Adapters on PyPI

Intent is cheap.
We guard the last checkpoint.

OPA for AI actions. Composable enforcement primitives that evaluate rate limits, cost caps, policy rules, and audit trails in microseconds — before your agent acts. Not a platform. Not a dashboard. Primitives.

$ pip install actiongate click to copy
$ pip install budgetgate click to copy
$ pip install rulegate click to copy
$ pip install auditgate click to copy
ALLOW
DENY
ESCALATE
LOGGED
<1ms gate evaluation (benchmarked)
☁️ Cloud-agnostic — runs anywhere Python runs
🔌 Zero dependencies — pure Python stdlib
📦 <500 LOC per gate (core) — auditable in an afternoon
// The Problem

Agents act. Nobody checks.

Your agent ran for 18 hours and burned $47,000. Provider rate limits are coarse. Observability tools watch — they don't prevent. You need a gate, not a dashboard.

💸

Runaway costs

A single misconfigured loop can drain your inference budget in minutes. Provider limits won't save you — they're set at the account level, not the agent level.

🔓

Ungoverned actions

Agents call APIs, write databases, send emails. If there's no policy layer between intent and execution, your agent is operating with root access.

📊

Post-hoc monitoring

Existing tools tell you what went wrong after it happens. By then, the damage is done. You need enforcement at the point of execution.

🧩

Monolithic governance

Enterprise platforms sell $100K dashboards to compliance teams. Developers need lightweight primitives they can compose into their pipeline.

// Composable Primitives

Four primitives. One enforcement layer.

Each primitive is independently deployable, pip-installable, cloud-agnostic, and auditable in an afternoon. No vendor lock-in. Runs anywhere Python runs.

Live

ActionGate

Rate limiting and cooldowns for agent actions. Controls frequency, prevents runaway loops, enforces execution boundaries.

Verdict → ALLOW | BLOCK
Live

BudgetGate

Deterministic spend governance. Cost caps, token budgets, and reserve/commit flow for both fixed and dynamic costs.

Verdict → ALLOW | BLOCK
Live

RuleGate

Deterministic policy enforcement. Define rules as callable predicates — block dangerous actions, enforce domain constraints, evaluate context before execution.

Verdict → ALLOW | DENY
Live

AuditGate

Compliance-grade logging. Every decision, every verdict, every override — structured, queryable, and tamper-evident with hash-chained integrity.

Verdict → LOGGED
// Quick Start

Ship in 30 seconds.

Install. Import. Guard. Every action passes through the gate before it executes.

agent.py
from actiongate import Engine, Gate, Policy

# Initialize
engine = Engine()

# Define a gate: 10 calls per 60-second window
gate = Gate("openai", "chat", "agent:1")

# Guard your agent's action
@engine.guard(gate, Policy(max_calls=10, window=60))
def call_openai(prompt: str) -> str:
    return openai.chat(prompt)

# If the agent exceeds 10 calls/min → BLOCKED
# No exception. No runaway. Deterministic.
budget_example.py
from budgetgate import Engine, Ledger, Budget
from decimal import Decimal

# Set a $50 budget for this agent session
engine = Engine()
ledger = Ledger("openai", "gpt-4", "session:42")
budget = Budget(max_spend=Decimal("50.00"))

@engine.guard(ledger, budget, cost=Decimal("0.03"))
def call_gpt4(prompt: str) -> str:
    return openai.chat(model="gpt-4", prompt=prompt)

# Agent hits $50? Gate closes. No overrun.
policy_example.py
from rulegate import Engine, Rule, Ruleset, Context

engine = Engine()

# Rules are just callables that return bool
def no_pii(ctx: Context) -> bool:
    return "ssn" not in str(ctx.kwargs.get("query", "")).lower()

def business_hours(ctx: Context) -> bool:
    return 9 <= datetime.now().hour < 17

@engine.guard(Rule("api", "search"), Ruleset(predicates=(no_pii, business_hours)))
def search(query: str) -> list[str]:
    return api.search(query)

# PII detected or off-hours? Blocked before execution.
audit_example.py
from auditgate import Engine, Trail, Verdict, Severity

# Tamper-evident audit trail with hash chaining
engine = Engine(recorded_by="agent:1")
trail = Trail("openai", "chat", "agent:1")

# Log a gate decision
engine.record(trail,
    verdict=Verdict.ALLOW,
    severity=Severity.INFO,
    gate_type="actiongate",
    gate_identity="openai:chat@agent:1",
    detail=ag_decision.to_dict(),
)

# Every entry is SHA-256 hashed and chained.
# Verify integrity via CLI:
# $ auditgate verify audit_log.json
// Framework Adapters

Works with your stack.

Drop-in adapters for OpenAI and LangChain. All four gates evaluate on every call. Adapters are Apache-2.0. The [all] extra includes all four gates.

Live

OpenAI

Gate function/tool calls before execution. Works with both Chat Completions and Responses API.

pip install actiongate-openai
Live

LangChain

@gated_tool decorator and GatedTool class. Raises ToolException on block — agents handle it automatically.

pip install actiongate-langchain
$ pip install actiongate-openai[all] click to copy
$ pip install actiongate-langchain[all] click to copy
// How It Works

Four gates, one pipeline.

Four gates evaluate in sequence. Every action must pass the first three before execution. AuditGate logs the full decision chain. Click a scenario to see the pipeline in real time.

ActionGate
rate limit check
waiting
BudgetGate
spend check
waiting
RuleGate
policy eval
waiting
AuditGate
audit log
waiting
Action
openai.chat()
pending
Total gate overhead:
// Why ActionGate

Not a platform. Not a dashboard. Primitives.

Platforms sell you a dashboard. Observability tools watch after the fact. ActionGate gives you composable enforcement primitives at the point of execution.

Dimension Provider Limits Observability Tools ActionGate
Enforcement Account-level None (observe only) Per-agent, per-action
Timing Provider-side Post-execution Pre-execution
Rate limiting Account-level caps Alerts after spike ✓ ActionGate
Composable ✓ Stack gates
Policy rules ✓ RuleGate
Budget governance Alerts after spend ✓ BudgetGate
Audit trail Vendor-locked logs ✓ AuditGate (hash-chained)
Framework adapters Vendor SDKs ✓ OpenAI, LangChain
Licensing Proprietary Proprietary Apache-2.0 (all four gates)
Self-hosted Partial ✓ All gates run on your infra
// Get Started

Your agents need a gate.
Build one in 30 seconds.

Self-hostable. No vendor lock-in. No cloud dependency. Star the repo, install the gates, and start governing your agents today.

★ Star on GitHub Read the Docs →