AgentAssert brings formal behavioral contracts to AI agents. Define preconditions, postconditions, and invariants using a domain-specific language. The system detects behavioral drift using Jensen-Shannon divergence and automatically triggers recovery re-prompting when agents violate their contracts.
12 contract templates and 9 Python examples for runtime behavioral checks. Connect your observation fields, adapt the contract and inspect violations.
Browse contracts and examples →Check an approval signal before your application proceeds with a protected action. The application supplies the signal and invokes the check.
python -m pip install "agentassert-abc[yaml,math]"The synthetic two-state proof returned no hard violations for true and raised ContractBreachError for false. It is not a PII classifier or a guarantee for every host action. Research results retain their paper assumptions.
A domain-specific language for defining behavioral contracts: preconditions, postconditions, invariants.
Jensen-Shannon divergence monitoring. Detect when agent behavior deviates from contracted norms.
Automatic intervention when contracts are violated. Re-prompt agents back to compliant behavior.
Probabilistic contract satisfaction with confidence bounds. Statistical guarantees for stochastic agents.
Ornstein-Uhlenbeck process modeling of behavioral drift with Lyapunov stability proofs.
Contracts compose across multi-agent systems. Verify pipeline-level compliance from component contracts.
AgentAssert: Behavioral Contracts for AI Agent Compliance
Varun Pratap Bhardwaj, 2026
Read on arXiv →