Runtime policy control plane
for production agents.

Block, degrade, escalate — without a redeploy. Behavioral governance that adapts in real time.

CI PyPI Python License
GitHub PyPI

Why agentplane

OPA, Cedar, and Casbin answer "is this allowed?" — a static yes/no. agentplane answers "how should this agent behave right now, given everything that's happened" — and changes the answer without a redeploy.

OPA / Cedar / Casbinagentplane
Decision modelStatic yes/no✓ Stateful behavioral history
Runtime updateConfig reload✓ Live — no restart
VersioningExternal✓ Built-in (diff, rollback, promote)
EscalationNone✓ Alert → HITL → Degrade → Block
DegradationNone✓ Modes with timed recovery
Plug/UnplugNone✓ Hard lockout per agent or tenant
Agent-nativeNo✓ hookpoints, tenant_id, token/cost budgets
AuditExternal✓ Append-only JSONL, every evaluation

Install
bash
# zero-dependency core
pip install agentplane-py

# with OpenTelemetry
pip install "agentplane-py[otel]"

# with persistent store + sync
pip install "agentplane-py[sqlite,sync]"

# everything
pip install "agentplane-py[all]"

Quickstart
python
from agentplane import (
    PolicyEngine, Policy, Selector, PolicyContext,
    AllowlistRule, RateRule, RedactRule, AuditRule,
)

engine = PolicyEngine()

engine.add_policy(Policy(
    id="acme.data-access.v1",
    selector=Selector(tenants=["acme"], tools=["sql_run"]),
    blocking=[
        AllowlistRule(tools=["sql_run", "search"]),
        RateRule(limit=100, window="1h", per="tenant"),
        RedactRule(fields=["ssn", "api_key"]),
    ],
    non_blocking=[AuditRule()],
    priority=100,
))

ctx = PolicyContext.new(
    agent_id="my-agent", tenant_id="acme",
    hookpoint="before_tool_call", tool_name="sql_run",
)

await engine.evaluate(ctx)  # raises PolicyBlocked or PolicyDegraded on enforcement

Features

Everything needed to govern agents in production — without changing agent code.

🔒

Blocking + Non-blocking

Blocking rules wait for a decision. Non-blocking rules fire async. Agents never wait for audit, alerts, or metrics.

📈

Stateful Escalation

Time-aware chains: Alert → HITL → Degrade → Block. Tracks history — 3 breaches in 10 min escalates differently than 1 breach a week ago.

Plug / Unplug

Hard lockout per agent or entire tenant. Cut all access instantly — no redeploy. Re-plug to restore. Perfect for budget exhaustion or incidents.

🔄

Versioning

Publish, diff, rollback. Every change is audited. Rollback creates a new version — history is never destroyed.

🎯

Precise Selectors

Target by agent, tenant, tool, hookpoint, or tag. One policy can cover all agents; another just one tool for one tenant in prod.

🔗

agenthooks Integration

One line: engine.attach(registry). Policies enforce at hookpoints automatically — no agent code changes.

📦

Embedded + Service

Embed in-process for zero latency. Or run the service for centralized policy management. Both sync — agents work offline.

🛡️

Degradation Modes

READ_ONLY · NO_EXTERNAL · RATE_THROTTLE · HUMAN_LOOP · SAFE_TOOLS_ONLY · FULL_BLOCK. Auto-recover by time or condition.


Plug / Unplug

Hard kill switch for agents. Cut all access — no rules evaluated, no tools reachable — until you re-plug.

python
from agentplane import PolicyEngine, PlugBoard

board = PlugBoard()
engine = PolicyEngine(plug_board=board)

# Agent runs out of daily budget — cut all access
board.unplug("billing-agent", reason="budget exhausted", by="ops-team")

# Security incident — lock out entire tenant
board.unplug_all("acme", reason="security incident", by="security-team")

# Restore access
board.plug("billing-agent")

Rule Coverage
RuleTypeDescription
AllowlistRuleblockingTool allowlist
DenylistRuleblockingTool denylist
RedactRuleblockingMark fields as redacted in audit
RateRuleblockingSliding-window rate limiter per agent/tenant/session
RequireTenantRuleblockingTenant allowlist
TokenBudgetRuleblockingToken budget per window
CostBudgetRuleblockingUSD cost budget per window
ApiAllowlistRuleblockingAPI path + method allowlist
ApiDenylistRuleblockingAPI path + method denylist
InjectionScanRuleblockingPrompt injection detection
AuditRulenon-blockingJSONL audit every evaluation
AlertRulenon-blockingLog / webhook alerts
CostTrackingRulenon-blockingCumulative cost tracking
MetricsRulenon-blockingOTel metrics emission
PIIScanRulenon-blockingPII detection and logging

The Stack

agentplane is the control plane. Each layer has one job.

agentplane
control plane — runtime policy, versioning, escalation
wire-ai
governance — loops, HITL, SLA, audit
agenthooks
extensibility — hookpoints, customer hooks
AgentGuard
safety — injection, PII, toxic, cost
agent-gateway
routing — protocol translation