Skip to main content

AgentAssert Type-C kernel — formal behavioral contracts for AI agent harnesses. Provider-blind, transport-blind runtime enforcement.

Project description

agentassert-typec-core

Formal behavioral contract kernel. Provider-blind, transport-blind.

This is the core engine — zero LLM deps, zero HTTP deps. Every adapter (proxy, SDK, hook) imports this.

Features

  • 7 Process Contract Operators — tool_blocklist, tool_allowlist, must_state, must_precede, context_budget, process_drift, judge_predicate
  • ContractSpec DSL — YAML-based, dsl_version: "0.4" for full Type-C, dsl_version: "0.3" for ABC compatibility
  • JSD Drift Tracker — Welford-style incremental (O(1) per update), frozen baseline at window boundary
  • Θ Reliability Scorer — Θ = 0.35C̄ + 0.25(1-D̄) + 0.20/(1+E) + 0.20S
  • Thread-safe SessionMonitor — RLock-protected, evaluate() never blocks for >10ms
  • Pre-compiled AST — all regex patterns compiled once at SessionStart

Install

pip install agentassert-typec-core

Quickstart

from agentassert_typec_core import SessionMonitor, PreAction, DecisionResult

monitor = SessionMonitor.from_yaml("contract.yaml")
event = PreAction(session_id="s1", contract_id="c1", tool="Read", args={})
result = monitor.evaluate(event)
print(result.decision.name)  # ALLOW or DENY

Optional: OTel

pip install agentassert-typec-core[otel]

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentassert_typec_core-0.4.0.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentassert_typec_core-0.4.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file agentassert_typec_core-0.4.0.tar.gz.

File metadata

  • Download URL: agentassert_typec_core-0.4.0.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for agentassert_typec_core-0.4.0.tar.gz
Algorithm Hash digest
SHA256 bef8b63c79f5d63b99a9c3cd7453dcf09c88870dcc1110a29c7ef54765dea8d9
MD5 325dbe94bc8348d1b60d7b766eae0a8b
BLAKE2b-256 1db9d9d07d195a6ac8692d07151bb36e219cf524d5d248a2743b20ac2241cddc

See more details on using hashes here.

File details

Details for the file agentassert_typec_core-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentassert_typec_core-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1ddee485cacbc588dca0d439b59874d1f1c2fed4c9d4f19e7551ecb5b8e12e2
MD5 4c4c1348eca3b9e1ccd5b871f9642b1c
BLAKE2b-256 9982737d1ab546d46ebaab78c1495d75546ffe6c90582eaa6fb721726c3f48fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page