AgentAssert Type-C enforces formal behavioral contracts on any AI agent without modifying a single line of agent code. A lightweight HTTP proxy sits between your agent and your LLM provider — intercepting every request and response, evaluating it against your YAML contract, and returning a structured violation response when a contract is breached. 7 operators cover the full contract surface: cost ceiling, latency SLA, tool allowlist, topic boundary, PII filter, repetition guard, and message sequence integrity. JSD-based semantic drift detection catches prompt injection and goal drift. The Θ reliability scorer gives (p,δ,k)-satisfaction guarantees — math, not marketing. 213 tests, 100% coverage on core, MIT license.
Point one env var at the proxy. Your existing agent code is completely unchanged. Works with any language, any framework.
cost_ceiling, latency_sla, allowed_tools, topic_boundary, pii_filter, repetition_guard, message_sequence — covering cost, latency, safety, and behavioral integrity.
Jensen-Shannon Divergence measures semantic drift from defined topic boundaries. Catches prompt injection and goal drift before your agent acts on them.
(p,δ,k)-satisfaction guarantee: 'With probability ≥ p, at least k operators pass, with confidence δ.' Formal math, not vibes.
Works with Anthropic, OpenAI, Azure OpenAI, and any OpenAI-compatible endpoint. Provider-agnostic by design.
pip install agentassert-typec-claude-code enforces contracts at the Claude Code hook layer — before the HTTP request is even made.
Works with Claude Code, Antigravity, Cursor, Windsurf, Cline, and any tool that speaks HTTP to an LLM provider.
AgentAssert: Behavioral Contracts for AI Agent Compliance
Varun Pratap Bhardwaj, 2026
Read on arXiv →