Getting Started with agentAssert
Start with a synthetic approval-flag check using the released Python API. Your application supplies the signals and calls the check before a protected action. This example does not need an API key, an LLM or an agent framework.
Watch the 5-Minute Technical Masterclass
Author Varun Pratap Bhardwaj breaks down the 18,000-mission empirical study, the 4-tuple $C = (P, I, G, R)$ architecture, and the convex moment polytope certifier.
Installation
Install the core `agentassert-abc` library via PyPI with optional YAML and numerical certificate solvers.
python -m pip install "agentassert-abc[yaml,math]"
Define Your Contract
Save this YAML as contract.yaml. The hard invariant requires the caller-supplied release.approved flag to be true.
contractspec: "0.1"
kind: agent
name: synthetic-release-check
description: Checks a caller-supplied approval flag.
version: "1.0.0"
invariants:
hard:
- name: release-approved
check:
field: release.approved
equals: true Check the Supplied State
Save this Python as app.py beside contract.yaml and run python app.py. The approved state returns zero hard violations; the unapproved state raises ContractBreachError. Call the check before the protected action.
import agentassert_abc as aa
from agentassert_abc.integrations.generic import GenericAdapter
adapter = GenericAdapter(aa.load("contract.yaml"))
print(adapter.check({"release.approved": True}).hard_violations)
# 0
try:
adapter.check_and_raise({"release.approved": False})
except aa.ContractBreachError:
print("Unapproved state: ContractBreachError")
else:
raise AssertionError("The unapproved state must raise") Choose an Enforcement Boundary
This is a structured-signal check, not a PII classifier or blanket protection for a host. Use the adapter coverage documentation to place enforcement before an action. Published research provides the assumptions for statistical and compositional claims; this two-state example does not reproduce those experiments.
Read enforcement coverage → Read the research →Open Source Code, Benchmarks & YAML Contracts
All Python source code, mathematical verification certificates, 18,000 mission datasets, and YAML contract templates are open-source and available on GitHub.