AgentAssert: contracts and examples
12 contract templates and 9 Python examples for runtime behavioral checks. Connect your observation fields, adapt the contract and inspect violations.
Choose a task, inspect its requirements and open the linked source before running it. Examples describe declared checks and inputs; they do not certify broader outcomes.
Catalog reviewed 1 October 2026. Source snapshot · Repository
Devtools
Contract template
Code generation
Contract template for code generation; includes declared checks for no secrets in output, no malicious code patterns, license compliance.
import agentassert_abc as aa contract = aa.load("contracts/examples/code-generation.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Customer Support
Contract template
Customer support
Contract template for customer support; includes declared checks for no pii disclosure, no false commitments, escalation on legal threats.
import agentassert_abc as aa contract = aa.load("contracts/examples/customer-support.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Ecommerce
Contract template
Ecommerce customer service
Contract template for ecommerce customer service; includes declared checks for no pii disclosure, no unauthorized account changes, no false promises.
import agentassert_abc as aa contract = aa.load("contracts/examples/ecommerce-customer-service.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Contract template
Ecommerce order management
Contract template for ecommerce order management; includes declared checks for no unauthorized refunds, no price override, order status accuracy.
import agentassert_abc as aa contract = aa.load("contracts/examples/ecommerce-order-management.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Contract template
Ecommerce product recommendation
Contract template for ecommerce product recommendation; includes declared checks for no competitor products, no false availability, no unauthorized discounts.
import agentassert_abc as aa contract = aa.load("contracts/examples/ecommerce-product-recommendation.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Finance
Contract template
Financial advisor
Contract template for financial advisor; includes declared checks for no unauthorized trades, suitability requirement, risk disclosure mandatory.
import agentassert_abc as aa contract = aa.load("contracts/examples/financial-advisor.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Healthcare
Contract template
Healthcare triage
Contract template for healthcare triage; includes declared checks for no diagnosis, emergency detection mandatory, no medication dosage advice.
import agentassert_abc as aa contract = aa.load("contracts/examples/healthcare-triage.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Mcp
Contract template
Mcp tool server
Contract template for mcp tool server; includes declared checks for tool schema compliance, no unauthorized resource access, input validation required.
import agentassert_abc as aa contract = aa.load("contracts/examples/mcp-tool-server.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Rag
Contract template
Rag agent
Contract template for rag agent; includes declared checks for no hallucination beyond context, source citation required, chunk relevance threshold.
import agentassert_abc as aa contract = aa.load("contracts/examples/rag-agent.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Research
Contract template
Research assistant
Contract template for research assistant; includes declared checks for source attribution required, no fabricated citations, no plagiarism.
import agentassert_abc as aa contract = aa.load("contracts/examples/research-assistant.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Retail
Contract template
Retail shopping assistant
Contract template for retail shopping assistant; includes declared checks for no counterfeit promotion, price accuracy, return policy compliance.
import agentassert_abc as aa contract = aa.load("contracts/examples/retail-shopping-assistant.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Telecom
Contract template
Telecom customer support
Contract template for telecom customer support; includes declared checks for no unauthorized plan changes, billing accuracy, no pii exposure.
import agentassert_abc as aa contract = aa.load("contracts/examples/telecom-customer-support.yaml")- Requirements
- Install agentassert-abc[yaml,math] and download or clone the linked YAML file. Supply the observation fields required by the contract.
- Status
- Shipped template; adapt before deployment
- Scope
- Checks evaluate caller-supplied observations. A template does not itself detect PII, hallucinations or medical risk, and does not certify regulatory compliance.
Python examples
Python example
Synthetic structured-signal proof; no network or agent framework required.
Demonstrates the API usage in the linked Python example.
python examples/00_quick_proof.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 01: Basic Contract Monitoring.
Demonstrates the API usage in the linked Python example.
python examples/01_basic_monitoring.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 02: E-Commerce Product Recommendation – Full Session.
Demonstrates the API usage in the linked Python example.
python examples/02_ecommerce_session.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 03: Drift Detection – JSD-Based Behavioral Drift.
Demonstrates the API usage in the linked Python example.
python examples/03_drift_detection.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 04: synthetic SPRT demonstration
Explore sequential testing through the synthetic observations in the linked example.
python examples/04_sprt_certification.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- This synthetic example demonstrates an API and statistical test. It does not certify a production agent or measure deployed reliability.
Python example
Example 05: LangGraph Integration – Contract Middleware.
Demonstrates the API usage in the linked Python example.
python examples/05_langgraph_middleware.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 06: CrewAI Integration – Task Guardrails.
Demonstrates the API usage in the linked Python example.
python examples/06_crewai_integration.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 07: Compositional Pipeline – Multi-Agent Safety Bounds.
Demonstrates the API usage in the linked Python example.
python examples/07_composition_pipeline.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Python example
Example 08: MCP Tool Server Monitoring.
Demonstrates the API usage in the linked Python example.
python examples/08_mcp_tool_monitoring.py- Requirements
- Install agentassert-abc[yaml,math], clone the source, and review this example's imports and adapter setup before running.
- Status
- Shipped Python example; requirements vary
- Scope
- An example demonstrates its declared observations and API path. Framework integrations can need additional packages; these listings do not claim every example was executed in this website build.
Explore the Qualixar catalog and ask questions in the community hub.